]>
git.saurik.com Git - apple/security.git/blob - Security/libsecurity_apple_csp/lib/FEEKeys.h
2 * Copyright (c) 2000-2001,2011,2014 Apple 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 * FEEKeys.h - FEE-related asymmetric key pair classes.
24 #ifdef CRYPTKIT_CSP_ENABLE
29 #include "AppleCSPContext.h"
30 #include "AppleCSPSession.h"
31 #include "AppleCSPKeys.h"
32 #include "cryptkitcsp.h"
33 #include <security_cryptkit/feeTypes.h>
38 * FEE/ECDSA version of a BinaryKey.
40 class FEEBinaryKey
: public BinaryKey
{
42 FEEBinaryKey(feePubKey feeKey
= NULL
);
47 CSSM_KEYBLOB_FORMAT
&format
,
48 AppleCSPSession
&session
,
49 const CssmKey
*paramKey
, /* optional, unused here */
50 CSSM_KEYATTR_FLAGS
&attrFlags
); /* IN/OUT */
52 feePubKey
feeKey() { return mFeeKey
; }
57 class FEEKeyPairGenContext
:
58 public AppleCSPContext
, private AppleKeyPairGenContext
{
61 AppleCSPSession
&session
,
63 AppleCSPContext(session
) {}
65 ~FEEKeyPairGenContext() { }
67 /* no init functionality, but we need to implement it */
72 // this one is specified in, and called from, CSPFullPluginSession
74 const Context
&context
,
78 // this one is specified in, and called from, AppleKeyPairGenContext
80 const Context
&context
,
82 BinaryKey
&privBinKey
,
85 }; /* KeyPairGenContext */
88 * CSPKeyInfoProvider for FEE and ECDSA keys
90 class FEEKeyInfoProvider
: public CSPKeyInfoProvider
94 const CssmKey
&cssmKey
,
95 AppleCSPSession
&session
);
97 static CSPKeyInfoProvider
*provider(
98 const CssmKey
&cssmKey
,
99 AppleCSPSession
&session
);
101 ~FEEKeyInfoProvider() { }
102 void CssmKeyToBinary(
103 CssmKey
*paramKey
, // optional, ignored here
104 CSSM_KEYATTR_FLAGS
&attrFlags
, // IN/OUT
105 BinaryKey
**binKey
); // RETURNED
106 void QueryKeySizeInBits(
107 CSSM_KEY_SIZE
&keySize
); // RETURNED
108 bool getHashableBlob(
109 Allocator
&allocator
,
113 } /* namespace CryptKit */
115 #endif /* _FEE_KEYS_H_ */
116 #endif /* CRYPTKIT_CSP_ENABLE */