]>
git.saurik.com Git - apple/security.git/blob - libsecurity_apple_csp/lib/opensshCoding.h
2 * Copyright (c) 2006 Apple Computer, 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.
27 * Created 8/29/2006 by dmitch.
30 #ifndef _OPENSSH_CODING_H_
31 #define _OPENSSH_CODING_H_
33 #include <openssl/rsa.h>
34 #include <openssl/dsa.h>
35 #include <Security/cssmtype.h>
36 #include <security_cdsa_utilities/cssmdata.h>
37 #include <CoreFoundation/CFData.h>
44 CFMutableDataRef cfOut
,
47 const unsigned char *&cp
, // IN/OUT
48 unsigned &len
); // IN/OUT
50 extern CSSM_RETURN
RSAPublicKeyEncodeOpenSSH1(
52 const CssmData
&descData
,
53 CssmOwnedData
&encodedKey
);
55 extern CSSM_RETURN
RSAPublicKeyDecodeOpenSSH1(
60 extern CSSM_RETURN
RSAPrivateKeyEncodeOpenSSH1(
62 const CssmData
&descData
,
63 CssmOwnedData
&encodedKey
);
65 extern CSSM_RETURN
RSAPrivateKeyDecodeOpenSSH1(
70 extern CSSM_RETURN
RSAPublicKeyEncodeOpenSSH2(
72 const CssmData
&descData
,
73 CssmOwnedData
&encodedKey
);
75 extern CSSM_RETURN
RSAPublicKeyDecodeOpenSSH2(
80 extern CSSM_RETURN
DSAPublicKeyEncodeOpenSSH2(
82 const CssmData
&descData
,
83 CssmOwnedData
&encodedKey
);
85 extern CSSM_RETURN
DSAPublicKeyDecodeOpenSSH2(
90 /* In opensshWrap.cpp */
92 /* Encode OpenSSHv1 private key, with or without encryption */
93 extern CSSM_RETURN
encodeOpenSSHv1PrivKey(
95 const uint8
*comment
, /* optional */
97 const uint8
*encryptKey
, /* optional; if present, it's 16 bytes of MD5(password) */
98 CFDataRef
*encodedKey
); /* RETURNED */
100 extern CSSM_RETURN
decodeOpenSSHv1PrivKey(
101 const unsigned char *encodedKey
,
102 unsigned encodedKeyLen
,
104 const uint8
*decryptKey
, /* optional; if present, it's 16 bytes of MD5(password) */
105 uint8
**comment
, /* mallocd and RETURNED */
106 unsigned *commentLen
); /* RETURNED */
112 #endif /* _OPENSSH_CODING_H_ */