8#define XP_MIN_SIGNATURE_LEN_IN_BYTES 256
10#define CryptoX_Result int
11#define CryptoX_Success 0
12#define CryptoX_Error (-1)
13#define CryptoX_Succeeded(X) ((X) == CryptoX_Success)
14#define CryptoX_Failed(X) ((X) != CryptoX_Success)
22#define CryptoX_InvalidHandleValue NULL
23#define CryptoX_ProviderHandle void*
24#define CryptoX_SignatureHandle VFYContext *
25#define CryptoX_PublicKey SECKEYPublicKey *
26#define CryptoX_Certificate CERTCertificate *
32 unsigned int certDataSize,
33 SECKEYPublicKey** publicKey);
35 SECKEYPublicKey *
const *publicKey);
37 const unsigned char *signature,
38 unsigned int signatureLen);
43#define CryptoX_InitCryptoProvider(CryptoHandle) \
45#define CryptoX_VerifyBegin(CryptoHandle, SignatureHandle, PublicKey) \
46 NSS_VerifyBegin(SignatureHandle, PublicKey)
47#define CryptoX_FreeSignatureHandle(SignatureHandle) \
48 VFY_DestroyContext(*SignatureHandle, PR_TRUE)
49#define CryptoX_VerifyUpdate(SignatureHandle, buf, len) \
50 VFY_Update(*SignatureHandle, (const unsigned char*)(buf), len)
51#define CryptoX_LoadPublicKey(CryptoHandle, certData, dataSize, publicKey) \
52 NSS_LoadPublicKey(certData, dataSize, publicKey)
53#define CryptoX_VerifySignature(hash, publicKey, signedData, len) \
54 NSS_VerifySignature(hash, (const unsigned char *)(signedData), len)
55#define CryptoX_FreePublicKey(key) \
56 SECKEY_DestroyPublicKey(*key)
57#define CryptoX_FreeCertificate(cert) \
58 CERT_DestroyCertificate(*cert)
62#define CryptoX_InvalidHandleValue NULL
63#define CryptoX_ProviderHandle void*
64#define CryptoX_SignatureHandle void*
65#define CryptoX_PublicKey void*
66#define CryptoX_Certificate void*
75 void* aBuf,
unsigned int aLen);
77 unsigned int aDataSize,
81 const unsigned char* aSignature,
82 unsigned int aSignatureLen);
89#define CryptoX_InitCryptoProvider(aProviderHandle) \
90 CryptoMac_InitCryptoProvider()
91#define CryptoX_VerifyBegin(aCryptoHandle, aInputData, aPublicKey) \
92 CryptoMac_VerifyBegin(aInputData)
93#define CryptoX_VerifyUpdate(aInputData, aBuf, aLen) \
94 CryptoMac_VerifyUpdate(aInputData, aBuf, aLen)
95#define CryptoX_LoadPublicKey(aProviderHandle, aCertData, aDataSize, \
97 CryptoMac_LoadPublicKey(aCertData, aDataSize, aPublicKey)
98#define CryptoX_VerifySignature(aInputData, aPublicKey, aSignature, \
100 CryptoMac_VerifySignature(aInputData, aPublicKey, aSignature, aSignatureLen)
101#define CryptoX_FreeSignatureHandle(aInputData) \
102 CryptoMac_FreeSignatureHandle(aInputData)
103#define CryptoX_FreePublicKey(aPublicKey) \
104 CryptoMac_FreePublicKey(aPublicKey)
105#define CryptoX_FreeCertificate(aCertificate)
115 DWORD sizeOfCertData,
116 HCRYPTKEY *publicKey);
117CryptoX_Result CryptoAPI_VerifyBegin(HCRYPTPROV provider, HCRYPTHASH* hash);
119 BYTE *buf, DWORD len);
122 const BYTE *signature,
125#define CryptoX_InvalidHandleValue ((ULONG_PTR)NULL)
126#define CryptoX_ProviderHandle HCRYPTPROV
127#define CryptoX_SignatureHandle HCRYPTHASH
128#define CryptoX_PublicKey HCRYPTKEY
129#define CryptoX_Certificate HCERTSTORE
130#define CryptoX_InitCryptoProvider(CryptoHandle) \
131 CryptoAPI_InitCryptoContext(CryptoHandle)
132#define CryptoX_VerifyBegin(CryptoHandle, SignatureHandle, PublicKey) \
133 CryptoAPI_VerifyBegin(CryptoHandle, SignatureHandle)
134#define CryptoX_FreeSignatureHandle(SignatureHandle)
135#define CryptoX_VerifyUpdate(SignatureHandle, buf, len) \
136 CryptoAPI_VerifyUpdate(SignatureHandle, (BYTE *)(buf), len)
137#define CryptoX_LoadPublicKey(CryptoHandle, certData, dataSize, publicKey) \
138 CryptoAPI_LoadPublicKey(CryptoHandle, (BYTE*)(certData), dataSize, publicKey)
139#define CryptoX_VerifySignature(hash, publicKey, signedData, len) \
140 CryptoAPI_VerifySignature(hash, publicKey, signedData, len)
141#define CryptoX_FreePublicKey(key) \
142 CryptDestroyKey(*(key))
143#define CryptoX_FreeCertificate(cert) \
144 CertCloseStore(*(cert), CERT_CLOSE_STORE_FORCE_FLAG);
154#define CryptoX_InvalidHandleValue NULL
155#define CryptoX_ProviderHandle void*
156#define CryptoX_SignatureHandle void*
157#define CryptoX_PublicKey void*
158#define CryptoX_Certificate void*
159#define CryptoX_InitCryptoProvider(CryptoHandle) \
161#define CryptoX_VerifyBegin(CryptoHandle, SignatureHandle, PublicKey) \
163#define CryptoX_FreeSignatureHandle(SignatureHandle)
164#define CryptoX_VerifyUpdate(SignatureHandle, buf, len) CryptoX_Error
165#define CryptoX_LoadPublicKey(CryptoHandle, certData, dataSize, publicKey) \
167#define CryptoX_VerifySignature(hash, publicKey, signedData, len) CryptoX_Error
168#define CryptoX_FreePublicKey(key) CryptoX_Error
CryptoX_Result CryptoMac_LoadPublicKey(const unsigned char *aCertData, unsigned int aDataSize, CryptoX_PublicKey *aPublicKey)
void CryptoMac_FreePublicKey(CryptoX_PublicKey *aPublicKey)
CryptoX_Result CryptoMac_VerifyUpdate(CryptoX_SignatureHandle *aInputData, void *aBuf, unsigned int aLen)
void CryptoMac_FreeSignatureHandle(CryptoX_SignatureHandle *aInputData)
CryptoX_Result CryptoMac_InitCryptoProvider()
CryptoX_Result CryptoMac_VerifySignature(CryptoX_SignatureHandle *aInputData, CryptoX_PublicKey *aPublicKey, const unsigned char *aSignature, unsigned int aSignatureLen)
CryptoX_Result CryptoMac_VerifyBegin(CryptoX_SignatureHandle *aInputData)
#define CryptoX_PublicKey
#define CryptoX_SignatureHandle