2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 * openRsaSnacc.h - glue between openrsa and SNACC
23 #ifndef _OPEN_RSA_SNACC_H_
24 #define _OPEN_RSA_SNACC_H_
27 #include <openssl/rsa.h>
28 #include <openssl/dsa.h>
29 #include <openssl/dh.h>
30 #include <Security/cssmtype.h>
31 #include <Security/cssmdata.h>
32 #include <Security/asn-incl.h>
33 #include <Security/sm_vdatypes.h>
40 * Convert between SNACC-style BigIntegerStr and openssl-style BIGNUM.
42 BIGNUM
*bigIntStrToBn(
43 BigIntegerStr
&snaccInt
);
46 BigIntegerStr
&snaccInt
);
49 /* estimate size of encoded BigIntegerStr */
50 unsigned sizeofBigInt(
51 BigIntegerStr
&bigInt
);
54 * int --> BigIntegerStr
56 void snaccIntToBigIntegerStr(
58 BigIntegerStr
&bigInt
);
61 * Replacements for d2i_RSAPublicKey, etc.
63 CSSM_RETURN
RSAPublicKeyDecode(
67 CSSM_RETURN
RSAPublicKeyEncode(
69 CssmOwnedData
&encodedKey
);
70 CSSM_RETURN
RSAPrivateKeyDecode(
74 CSSM_RETURN
RSAPrivateKeyEncode(
76 CssmOwnedData
&encodedKey
);
78 CSSM_RETURN
generateDigestInfo(
79 const void *messageDigest
,
81 CSSM_ALGORITHMS digestAlg
, // CSSM_ALGID_SHA1, etc.
82 CssmOwnedData
&encodedInfo
,
83 size_t maxEncodedSize
);
85 CSSM_RETURN
DSAPublicKeyDecode(
89 CSSM_RETURN
DSAPublicKeyEncode(
91 CssmOwnedData
&encodedKey
);
92 CSSM_RETURN
DSAPrivateKeyDecode(
96 CSSM_RETURN
DSAPrivateKeyEncode(
98 CssmOwnedData
&encodedKey
);
100 CSSM_RETURN
DSASigEncode(
102 CssmOwnedData
&encodedSig
);
103 CSSM_RETURN
DSASigDecode(
108 CSSM_RETURN
DHPrivateKeyDecode(
112 CSSM_RETURN
DHPrivateKeyEncode(
114 CssmOwnedData
&encodedKey
);
121 #endif /* _OPEN_RSA_SNACC_H_ */