]>
git.saurik.com Git - apple/security.git/blob - AppleCSP/RSA_DSA/RSA_DSA_utils.h
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.
22 #ifndef _RSA_DSA_UTILS_H_
23 #define _RSA_DSA_UTILS_H_
25 #include <openssl/rsa.h>
26 #include <openssl/dsa.h>
27 #include <AppleCSP/AppleCSPSession.h>
28 #include <Security/context.h>
36 * -- obtain CSSM key (there must only be one)
37 * -- validate keyClass
38 * -- validate keyUsage
39 * -- convert to RSA *, allocating the RSA key if necessary
42 const Context
&context
,
43 AppleCSPSession
&session
,
44 CSSM_KEYCLASS keyClass
, // CSSM_KEYCLASS_{PUBLIC,PRIVATE}_KEY
45 CSSM_KEYUSE usage
, // CSSM_KEYUSE_ENCRYPT, CSSM_KEYUSE_SIGN, etc.
46 bool &mallocdKey
); // RETURNED
49 * Convert a CssmKey to an RSA * key. May result in the creation of a new
50 * RSA (when cssmKey is a raw key); allocdKey is true in that case
51 * in which case the caller generally has to free the allocd key).
54 const CssmKey
&cssmKey
,
55 AppleCSPSession
&session
,
56 bool &allocdKey
); // RETURNED
59 * Convert a raw CssmKey to a newly alloc'd RSA *.
62 const CssmKey
&cssmKey
);
66 * -- obtain CSSM key (there must only be one)
67 * -- validate keyClass
68 * -- validate keyUsage
69 * -- convert to DSA *, allocating the DSA key if necessary
72 const Context
&context
,
73 AppleCSPSession
&session
,
74 CSSM_KEYCLASS keyClass
, // CSSM_KEYCLASS_{PUBLIC,PRIVATE}_KEY
75 CSSM_KEYUSE usage
, // CSSM_KEYUSE_ENCRYPT, CSSM_KEYUSE_SIGN, etc.
76 bool &mallocdKey
); // RETURNED
79 * Convert a CssmKey to an DSA * key. May result in the creation of a new
80 * DSA (when cssmKey is a raw key); allocdKey is true in that case
81 * in which case the caller generally has to free the allocd key).
84 const CssmKey
&cssmKey
,
85 AppleCSPSession
&session
,
86 bool &allocdKey
); // RETURNED
89 * Convert a raw CssmKey to a newly alloc'd DSA *.
92 const CssmKey
&cssmKey
);
98 #endif /*_RSA_DSA_UTILS_H_ */