]> git.saurik.com Git - apple/security.git/blob - AppleCSP/CryptKitCSP/FEEKeys.h
Security-54.tar.gz
[apple/security.git] / AppleCSP / CryptKitCSP / FEEKeys.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
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
8 * using this file.
9 *
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.
16 */
17
18
19 /*
20 * FEEKeys.h - FEE-related asymmetric key pair classes.
21 *
22 * Created 2/21/2001 by dmitch.
23 */
24
25 #ifdef CRYPTKIT_CSP_ENABLE
26
27 #ifndef _FEE_KEYS_H_
28 #define _FEE_KEYS_H_
29
30 #include "AppleCSPContext.h"
31 #include "AppleCSPSession.h"
32 #include <CryptKitCSP/cryptkitcsp.h>
33 #include <CryptKit/feeTypes.h>
34
35 namespace CryptKit {
36
37 /*
38 * FEE version of a BinaryKey.
39 */
40 class FEEBinaryKey : public BinaryKey {
41 public:
42 FEEBinaryKey(feePubKey feeKey = NULL);
43 ~FEEBinaryKey();
44 void generateKeyBlob(
45 CssmAllocator &allocator,
46 CssmData &blob,
47 CSSM_KEYBLOB_FORMAT &format);
48
49 feePubKey feeKey() { return mFeeKey; }
50 private:
51 feePubKey mFeeKey;
52 };
53
54 class FEEKeyPairGenContext :
55 public AppleCSPContext, private AppleKeyPairGenContext {
56 public:
57 FEEKeyPairGenContext(
58 AppleCSPSession &session,
59 const Context &) :
60 AppleCSPContext(session) {}
61
62 ~FEEKeyPairGenContext() { }
63
64 /* no init functionality, but we need to implement it */
65 void init(
66 const Context &,
67 bool) { }
68
69 // this one is specified in, and called from, CSPFullPluginSession
70 void generate(
71 const Context &context,
72 CssmKey &pubKey,
73 CssmKey &privKey);
74
75 // this one is specified in, and called from, AppleKeyPairGenContext
76 void generate(
77 const Context &context,
78 BinaryKey &pubBinKey,
79 BinaryKey &privBinKey,
80 uint32 &keySize);
81
82 }; /* KeyPairGenContext */
83
84 /*
85 * CSPKeyInfoProvider for FEE keys
86 */
87 class FEEKeyInfoProvider : public CSPKeyInfoProvider
88 {
89 private:
90 FEEKeyInfoProvider(
91 const CssmKey &cssmKey);
92 public:
93 static CSPKeyInfoProvider *provider(
94 const CssmKey &cssmKey);
95 ~FEEKeyInfoProvider() { }
96 void CssmKeyToBinary(
97 BinaryKey **binKey); // RETURNED
98 void QueryKeySizeInBits(
99 CSSM_KEY_SIZE &keySize); // RETURNED
100 };
101
102 } /* namespace CryptKit */
103
104 #endif /* _FEE_KEYS_H_ */
105 #endif /* CRYPTKIT_CSP_ENABLE */