FEEAsymmetricContext.h [plain text]
#ifdef CRYPTKIT_CSP_ENABLE
#ifndef _FEE_ASYMMETRIC_CONTEXT_H_
#define _FEE_ASYMMETRIC_CONTEXT_H_
#include <security_cdsa_plugin/CSPsession.h>
#include "AppleCSP.h"
#include "AppleCSPContext.h"
#include "AppleCSPSession.h"
#include "BlockCryptor.h"
#include <security_cryptkit/feeFEED.h>
#include <security_cryptkit/feeFEEDExp.h>
namespace CryptKit {
class FEEDContext : public BlockCryptor {
public:
FEEDContext(AppleCSPSession &session) :
BlockCryptor(session),
mFeeFeed(NULL),
mPrivKey(NULL),
mPubKey(NULL),
mInitFlag(false) { }
~FEEDContext();
void init(const Context &context, bool encoding = true);
void encryptBlock(
const void *plainText, size_t plainTextLen,
void *cipherText,
size_t &cipherTextLen, bool final);
void decryptBlock(
const void *cipherText, size_t cipherTextLen,
void *plainText,
size_t &plainTextLen, bool final);
size_t inputSize(
size_t outSize); size_t outputSize(
bool final = false,
size_t inSize = 0); void minimumProgress(
size_t &in,
size_t &out);
private:
feeFEED mFeeFeed;
feePubKey mPrivKey;
bool mAllocdPrivKey;
feePubKey mPubKey;
bool mAllocdPubKey;
bool mInitFlag; };
class FEEDExpContext : public BlockCryptor {
public:
FEEDExpContext(AppleCSPSession &session) :
BlockCryptor(session),
mFeeFeedExp(NULL),
mFeeKey(NULL),
mInitFlag(false) { }
~FEEDExpContext();
void init(const Context &context, bool encoding = true);
void encryptBlock(
const void *plainText, size_t plainTextLen,
void *cipherText,
size_t &cipherTextLen, bool final);
void decryptBlock(
const void *cipherText, size_t cipherTextLen,
void *plainText,
size_t &plainTextLen, bool final);
private:
feeFEEDExp mFeeFeedExp;
feePubKey mFeeKey;
bool mAllocdFeeKey;
bool mInitFlag; };
}
#endif
#endif