#ifdef CRYPTKIT_CSP_ENABLE
#ifndef _FEE_KEYS_H_
#define _FEE_KEYS_H_
#include "AppleCSPContext.h"
#include "AppleCSPSession.h"
#include "AppleCSPKeys.h"
#include "cryptkitcsp.h"
#include <security_cryptkit/feeTypes.h>
namespace CryptKit {
class FEEBinaryKey : public BinaryKey {
public:
FEEBinaryKey(feePubKey feeKey = NULL);
~FEEBinaryKey();
void generateKeyBlob(
Allocator &allocator,
CssmData &blob,
CSSM_KEYBLOB_FORMAT &format,
AppleCSPSession &session,
const CssmKey *paramKey,
CSSM_KEYATTR_FLAGS &attrFlags);
feePubKey feeKey() { return mFeeKey; }
private:
feePubKey mFeeKey;
};
class FEEKeyPairGenContext :
public AppleCSPContext, private AppleKeyPairGenContext {
public:
FEEKeyPairGenContext(
AppleCSPSession &session,
const Context &) :
AppleCSPContext(session) {}
~FEEKeyPairGenContext() { }
void init(
const Context &,
bool) { }
void generate(
const Context &context,
CssmKey &pubKey,
CssmKey &privKey);
void generate(
const Context &context,
BinaryKey &pubBinKey,
BinaryKey &privBinKey,
uint32 &keySize);
};
class FEEKeyInfoProvider : public CSPKeyInfoProvider
{
private:
FEEKeyInfoProvider(
const CssmKey &cssmKey,
AppleCSPSession &session);
public:
static CSPKeyInfoProvider *provider(
const CssmKey &cssmKey,
AppleCSPSession &session);
~FEEKeyInfoProvider() { }
void CssmKeyToBinary(
CssmKey *paramKey, CSSM_KEYATTR_FLAGS &attrFlags, BinaryKey **binKey); void QueryKeySizeInBits(
CSSM_KEY_SIZE &keySize); bool getHashableBlob(
Allocator &allocator,
CssmData &hashBlob);
};
}
#endif
#endif