6 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
7 #define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
8 #define GET_ALG_CLASS(x) (x&57344)
9 #define GET_ALG_TYPE(x) (x&7680)
10 #define GET_ALG_SID(x) (x&511)
11 #define ALG_CLASS_ANY 0
12 #define ALG_CLASS_SIGNATURE 8192
13 #define ALG_CLASS_MSG_ENCRYPT 16384
14 #define ALG_CLASS_DATA_ENCRYPT 24576
15 #define ALG_CLASS_HASH 32768
16 #define ALG_CLASS_KEY_EXCHANGE 40960
17 #define ALG_TYPE_ANY 0
18 #define ALG_TYPE_DSS 512
19 #define ALG_TYPE_RSA 1024
20 #define ALG_TYPE_BLOCK 1536
21 #define ALG_TYPE_STREAM 2048
23 #define ALG_SID_RSA_ANY 0
24 #define ALG_SID_RSA_PKCS 1
25 #define ALG_SID_RSA_MSATWORK 2
26 #define ALG_SID_RSA_ENTRUST 3
27 #define ALG_SID_RSA_PGP 4
28 #define ALG_SID_DSS_ANY 0
29 #define ALG_SID_DSS_PKCS 1
30 #define ALG_SID_DSS_DMS 2
34 #define ALG_SID_SEAL 2
40 #define ALG_SID_EXAMPLE 80
41 #define CALG_MD2 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD2)
42 #define CALG_MD4 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD4)
43 #define CALG_MD5 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD5)
44 #define CALG_SHA (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_SHA)
45 #define CALG_MAC (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MAC)
46 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE|ALG_TYPE_RSA|ALG_SID_RSA_ANY)
47 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE|ALG_TYPE_DSS|ALG_SID_DSS_ANY)
48 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_RSA|ALG_SID_RSA_ANY)
49 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_DES)
50 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_RC2)
51 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_STREAM|ALG_SID_RC4)
52 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_STREAM|ALG_SID_SEAL)
53 #define CRYPT_VERIFYCONTEXT 0xF0000000
54 #define CRYPT_NEWKEYSET 8
55 #define CRYPT_DELETEKEYSET 16
56 #define CRYPT_MACHINE_KEYSET 32
57 #define CRYPT_EXPORTABLE 1
58 #define CRYPT_USER_PROTECTED 2
59 #define CRYPT_CREATE_SALT 4
60 #define CRYPT_UPDATE_KEY 8
62 #define PUBLICKEYBLOB 6
63 #define AT_KEYEXCHANGE 1
64 #define AT_SIGNATURE 2
65 #define CRYPT_USERDATA 1
70 #define KP_MODE_BITS 5
71 #define KP_PERMISSIONS 6
74 #define PKCS5_PADDING 1
75 #define CRYPT_MODE_CBC 1
76 #define CRYPT_MODE_ECB 2
77 #define CRYPT_MODE_OFB 3
78 #define CRYPT_MODE_CFB 4
79 #define CRYPT_MODE_CTS 5
80 #define CRYPT_ENCRYPT 1
81 #define CRYPT_DECRYPT 2
82 #define CRYPT_EXPORT 4
84 #define CRYPT_WRITE 16
89 #define CRYPT_FAILED FALSE
90 #define CRYPT_SUCCEED TRUE
91 #define RCRYPT_SUCCEEDED(r) ((r)==CRYPT_SUCCEED)
92 #define RCRYPT_FAILED(r) ((r)==CRYPT_FAILED)
94 #define PP_ENUMCONTAINERS 2
98 #define PP_CONTAINER 6
101 #define CRYPT_IMPL_HARDWARE 1
102 #define CRYPT_IMPL_SOFTWARE 2
103 #define CRYPT_IMPL_MIXED 3
104 #define CRYPT_IMPL_UNKNOWN 4
105 #define PROV_RSA_FULL 1
106 #define PROV_RSA_SIG 2
108 #define PROV_FORTEZZA 4
109 #define PROV_MS_MAIL 5
111 #define PROV_STT_MER 7
112 #define PROV_STT_ACQ 8
113 #define PROV_STT_BRND 9
114 #define PROV_STT_ROOT 10
115 #define PROV_STT_ISS 11
117 #define CUR_BLOB_VERSION 2
119 typedef struct _VTableProvStruc
{FARPROC FuncVerifyImage
;} VTableProvStruc
,*PVTableProvStruc
;
120 typedef ULONG HCRYPTPROV
;
121 typedef ULONG HCRYPTKEY
;
122 typedef ULONG HCRYPTHASH
;
123 typedef struct _PROV_ENUMALGS
{
129 typedef struct _PUBLICKEYSTRUC
{
135 typedef struct _RSAPUBKEY
{
140 BOOL WINAPI
CryptAcquireContextA(HCRYPTPROV
*,LPCSTR
,LPCSTR
,DWORD
,DWORD
);
141 BOOL WINAPI
CryptAcquireContextW(HCRYPTPROV
*,LPCWSTR
,LPCWSTR
,DWORD
,DWORD
);
142 BOOL WINAPI
CryptReleaseContext(HCRYPTPROV
,DWORD
);
143 BOOL WINAPI
CryptGenKey(HCRYPTPROV
,ALG_ID
,DWORD
,HCRYPTKEY
*);
144 BOOL WINAPI
CryptDeriveKey(HCRYPTPROV
,ALG_ID
,HCRYPTHASH
,DWORD
,HCRYPTKEY
*);
145 BOOL WINAPI
CryptDestroyKey(HCRYPTKEY
);
146 BOOL WINAPI
CryptSetKeyParam(HCRYPTKEY
,DWORD
,PBYTE
,DWORD
);
147 BOOL WINAPI
CryptGetKeyParam(HCRYPTKEY
,DWORD
,PBYTE
,PDWORD
,DWORD
);
148 BOOL WINAPI
CryptSetHashParam(HCRYPTHASH
,DWORD
,PBYTE
,DWORD
);
149 BOOL WINAPI
CryptGetHashParam(HCRYPTHASH
,DWORD
,PBYTE
,PDWORD
,DWORD
);
150 BOOL WINAPI
CryptSetProvParam(HCRYPTPROV
,DWORD
,PBYTE
,DWORD
);
151 BOOL WINAPI
CryptGetProvParam(HCRYPTPROV
,DWORD
,PBYTE
,PDWORD
,DWORD
);
152 BOOL WINAPI
CryptGenRandom(HCRYPTPROV
,DWORD
,PBYTE
);
153 BOOL WINAPI
CryptGetUserKey(HCRYPTPROV
,DWORD
,HCRYPTKEY
*);
154 BOOL WINAPI
CryptExportKey(HCRYPTKEY
,HCRYPTKEY
,DWORD
,DWORD
,PBYTE
,PDWORD
);
155 BOOL WINAPI
CryptImportKey(HCRYPTPROV
,PBYTE
,DWORD
,HCRYPTKEY
,DWORD
,HCRYPTKEY
*);
156 BOOL WINAPI
CryptEncrypt(HCRYPTKEY
,HCRYPTHASH
,BOOL
,DWORD
,PBYTE
,PDWORD
,DWORD
);
157 BOOL WINAPI
CryptDecrypt(HCRYPTKEY
,HCRYPTHASH
,BOOL
,DWORD
,PBYTE
,PDWORD
);
158 BOOL WINAPI
CryptCreateHash(HCRYPTPROV
,ALG_ID
,HCRYPTKEY
,DWORD
,HCRYPTHASH
*);
159 BOOL WINAPI
CryptHashData(HCRYPTHASH
,PBYTE
,DWORD
,DWORD
);
160 BOOL WINAPI
CryptHashSessionKey(HCRYPTHASH
,HCRYPTKEY
,DWORD
);
161 BOOL WINAPI
CryptGetHashValue(HCRYPTHASH
,DWORD
,PBYTE
,PDWORD
);
162 BOOL WINAPI
CryptDestroyHash(HCRYPTHASH
);
163 BOOL WINAPI
CryptSignHashA(HCRYPTHASH
,DWORD
,LPCSTR
,DWORD
,PBYTE
,PDWORD
);
164 BOOL WINAPI
CryptSignHashW(HCRYPTHASH
,DWORD
,LPCWSTR
,DWORD
,PBYTE
,PDWORD
);
165 BOOL WINAPI
CryptVerifySignatureA(HCRYPTHASH
,PBYTE
,DWORD
,HCRYPTKEY
,LPCSTR
,DWORD
);
166 BOOL WINAPI
CryptVerifySignatureW(HCRYPTHASH
,PBYTE
,DWORD
,HCRYPTKEY
,LPCWSTR
,DWORD
);
167 BOOL WINAPI
CryptSetProviderA(LPCSTR
,DWORD
);
168 BOOL WINAPI
CryptSetProviderW(LPCWSTR
,DWORD
);
170 #define CryptAcquireContext CryptAcquireContextW
171 #define CryptSignHash CryptSignHashW
172 #define CryptVerifySignature CryptVerifySignatureW
173 #define CryptSetProvider CryptSetProviderW
174 #define MS_DEF_PROV MS_DEF_PROV_W
176 #define CryptAcquireContext CryptAcquireContextA
177 #define CryptSignHash CryptSignHashA
178 #define CryptVerifySignature CryptVerifySignatureA
179 #define CryptSetProvider CryptSetProviderA
180 #define MS_DEF_PROV MS_DEF_PROV_A