PKIFNSS.h
Go to the documentation of this file.00001
00009 #ifndef _PKIFNSS_H_
00010 #define _PKIFNSS_H_
00011
00012 #include "PKIFdll.h"
00013 #include "IPKIFCryptoKeyID.h"
00014 #include "components.h"
00015
00016 #include <bitset>
00017
00018 struct CPKIFNSSImpl;
00019 FD_LIST_PTR(CPKIFCredential);
00020 FD_SMART_PTR(CPKIFKeyUsage);
00033 class CAC_API CPKIFNSS : public IPKIFColleague, public IPKIFCryptoKeyID
00034 {
00035 public:
00036 CPKIFNSS(const std::string & dbdir = "");
00037 virtual ~CPKIFNSS(void);
00038
00039
00040 void Initialize();
00041
00042
00043 void GetKeyList(CPKIFCredentialList& v,std::bitset<9>* = NULL);
00044 void GetKeyList(CPKIFCredentialList& v,CPKIFKeyUsagePtr& ku);
00045
00046
00047 bool OwnsKey(const CPKIFCredential& keyID) const;
00048 CPKIFCredentialPtr MakeKeyID(const std::string& asciiHexKeyID);
00049
00050
00051 void Sign(const CPKIFCredential& key, unsigned char* pHashData, int nHashDataLen, unsigned char* pSignature, int* nSignatureLen, PKIFCRYPTO::HASH_ALG hashAlg);
00052 void Decrypt(const CPKIFCredential& key, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen);
00053 void Encrypt(const CPKIFCredential& key, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen);
00054 bool Verify(const CPKIFCredential& key, unsigned char* pHashData, int nHashDataLen, unsigned char* pSignature, int nSignatureLen, PKIFCRYPTO::HASH_ALG hashAlg);
00055
00056 IPKIFCryptContext* CryptInit(CPKIFCredentialPtr& key, bool pad = true);
00057 void Decrypt(IPKIFCryptContext* cryptContext, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool final);
00058 void Encrypt(IPKIFCryptContext* cryptContext, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool final);
00059
00060 enum { thisComponent = TOOLKIT_CRYPTO_NSS };
00061
00062 private:
00064 CPKIFNSS(const CPKIFNSS& copy);
00066 CPKIFNSS& operator=(const CPKIFNSS& rhs);
00067
00068 CPKIFNSSImpl * m_impl;
00069
00070
00071 };
00072 DECLARE_SMART_POINTERS(CPKIFNSS);
00073
00074 #endif