]>
git.saurik.com Git - apple/security.git/blob - Security/libsecurity_apple_csp/lib/opensshCoding.h
2 * Copyright (c) 2006,2011,2014 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 * opensshCoding.h - Encoding and decoding of OpenSSH format public keys.
29 #ifndef _OPENSSH_CODING_H_
30 #define _OPENSSH_CODING_H_
32 #include <openssl/rsa.h>
33 #include <openssl/dsa.h>
34 #include <Security/cssmtype.h>
35 #include <security_cdsa_utilities/cssmdata.h>
36 #include <CoreFoundation/CFData.h>
43 CFMutableDataRef cfOut
,
46 const unsigned char *&cp
, // IN/OUT
47 unsigned &len
); // IN/OUT
49 extern CSSM_RETURN
RSAPublicKeyEncodeOpenSSH1(
51 const CssmData
&descData
,
52 CssmOwnedData
&encodedKey
);
54 extern CSSM_RETURN
RSAPublicKeyDecodeOpenSSH1(
59 extern CSSM_RETURN
RSAPrivateKeyEncodeOpenSSH1(
61 const CssmData
&descData
,
62 CssmOwnedData
&encodedKey
);
64 extern CSSM_RETURN
RSAPrivateKeyDecodeOpenSSH1(
69 extern CSSM_RETURN
RSAPublicKeyEncodeOpenSSH2(
71 const CssmData
&descData
,
72 CssmOwnedData
&encodedKey
);
74 extern CSSM_RETURN
RSAPublicKeyDecodeOpenSSH2(
79 extern CSSM_RETURN
DSAPublicKeyEncodeOpenSSH2(
81 const CssmData
&descData
,
82 CssmOwnedData
&encodedKey
);
84 extern CSSM_RETURN
DSAPublicKeyDecodeOpenSSH2(
89 /* In opensshWrap.cpp */
91 /* Encode OpenSSHv1 private key, with or without encryption */
92 extern CSSM_RETURN
encodeOpenSSHv1PrivKey(
94 const uint8
*comment
, /* optional */
96 const uint8
*encryptKey
, /* optional; if present, it's 16 bytes of MD5(password) */
97 CFDataRef
*encodedKey
); /* RETURNED */
99 extern CSSM_RETURN
decodeOpenSSHv1PrivKey(
100 const unsigned char *encodedKey
,
101 unsigned encodedKeyLen
,
103 const uint8
*decryptKey
, /* optional; if present, it's 16 bytes of MD5(password) */
104 uint8
**comment
, /* mallocd and RETURNED */
105 unsigned *commentLen
); /* RETURNED */
111 #endif /* _OPENSSH_CODING_H_ */