EncryptTransform.h [plain text]
#if !defined(__ENCRYPT_TRANSFORM__)
#define __ENCRYPT_TRANSFORM__ 1
#include <CommonCrypto/CommonCryptor.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/cssmapi.h>
#include <Security/cssmapple.h>
#include <Security/cssmtype.h>
#include <Security/SecKey.h>
#include "Transform.h"
#include "TransformFactory.h"
class EncryptDecryptBase : public Transform
{
protected:
CSSM_PADDING m_cssm_padding;
CSSM_ENCRYPT_MODE m_mode;
CSSM_KEY_PTR m_cssm_key; CSSM_CC_HANDLE m_handle; Boolean m_forEncryption;
Boolean m_oaep_padding;
CFMutableDataRef m_processedData;
CFMutableDataRef m_accumulator;
SecTransformAttributeRef inputAH;
static dispatch_once_t serializerSetUp;
static dispatch_queue_t serializerTransformStartingExecution;
virtual void Finalize();
virtual Boolean TransformCanExecute();
virtual CFErrorRef TransformStartingExecution();
CFErrorRef SerializedTransformStartingExecution();
virtual void AttributeChanged(SecTransformAttributeRef ah, CFTypeRef value);
CFDataRef apply_oaep_padding(CFDataRef value);
CFDataRef remove_oaep_padding(CFDataRef value);
EncryptDecryptBase(CFStringRef type);
virtual ~EncryptDecryptBase();
void SendCSSMError(CSSM_RETURN error);
public:
virtual CFDictionaryRef CopyState();
virtual void RestoreState(CFDictionaryRef state);
virtual bool InitializeObject(SecKeyRef key, CFErrorRef *error);
};
class EncryptTransform : public EncryptDecryptBase
{
protected:
public:
static TransformFactory* MakeTransformFactory();
public:
protected:
EncryptTransform() ;
public:
virtual ~EncryptTransform();
static SecTransformRef Make();
};
class DecryptTransform : public EncryptDecryptBase
{
protected:
public:
static TransformFactory* MakeTransformFactory();
public:
protected:
DecryptTransform();
public:
virtual ~DecryptTransform();
static SecTransformRef Make();
};
#endif