Git init
[external/xmlsec1.git] / include / xmlsec / mscrypto / crypto.h
1 /** 
2  * XMLSec library
3  *
4  * This is free software; see Copyright file in the source
5  * distribution for preciese wording.
6  * 
7  * Copyrigth (C) 2003 Cordys R&D BV, All rights reserved.
8  */
9 #ifndef __XMLSEC_MSCRYPTO_CRYPTO_H__
10 #define __XMLSEC_MSCRYPTO_CRYPTO_H__    
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif /* __cplusplus */ 
15
16 #include <windows.h>
17 #include <wincrypt.h>
18
19 #include <xmlsec/xmlsec.h>
20 #include <xmlsec/keys.h>
21 #include <xmlsec/transforms.h>
22 #include <xmlsec/dl.h>
23
24 XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_mscrypto(void);
25
26 /**
27  * Init shutdown
28  */
29 XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoInit              (void);
30 XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoShutdown          (void);
31
32 XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeysMngrInit      (xmlSecKeysMngrPtr mngr);
33 XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoGenerateRandom    (xmlSecBufferPtr buffer,
34                                                                          size_t size);
35
36 XMLSEC_CRYPTO_EXPORT void               xmlSecMSCryptoErrorsDefaultCallback(const char* file, 
37                                                                         int line, 
38                                                                         const char* func,
39                                                                         const char* errorObject, 
40                                                                         const char* errorSubject,
41                                                                         int reason, 
42                                                                         const char* msg);
43
44 /**
45  * Utils
46  */
47 XMLSEC_CRYPTO_EXPORT BYTE*              xmlSecMSCryptoCertStrToName     (DWORD dwCertEncodingType, 
48                                                                          LPCTSTR pszX500, 
49                                                                          DWORD dwStrType,
50                                                                          DWORD* len);
51
52
53
54 /********************************************************************
55  *
56  * DSA transform
57  *
58  *******************************************************************/
59 #ifndef XMLSEC_NO_DSA
60
61 /**
62  * xmlSecMSCryptoKeyDataDsaId:
63  * 
64  * The DSA key klass.
65  */
66 #define xmlSecMSCryptoKeyDataDsaId \
67         xmlSecMSCryptoKeyDataDsaGetKlass()
68 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataDsaGetKlass        (void);
69
70 /**
71  * xmlSecMSCryptoTransformDsaSha1Id:
72  * 
73  * The DSA SHA1 signature transform klass.
74  */
75 #define xmlSecMSCryptoTransformDsaSha1Id \
76         xmlSecMSCryptoTransformDsaSha1GetKlass()
77 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformDsaSha1GetKlass(void);
78
79 #endif /* XMLSEC_NO_DSA */
80
81 /********************************************************************
82  *
83  * GOST2001 transform
84  *
85  *******************************************************************/
86 #ifndef XMLSEC_NO_GOST
87
88 /**
89  * xmlSecMSCryptoKeyDataGost2001Id:
90  * 
91  * The GOST2001 key klass.
92  */
93 #define xmlSecMSCryptoKeyDataGost2001Id \
94         xmlSecMSCryptoKeyDataGost2001GetKlass()
95 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataGost2001GetKlass   (void);
96
97 /**
98  * xmlSecMSCryptoTransformGost2001GostR3411_94Id:
99  * 
100  * The GOST2001 GOSTR3411_94 signature transform klass.
101  */
102 #define xmlSecMSCryptoTransformGost2001GostR3411_94Id \
103         xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass()
104 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass(void);
105
106 #endif /* XMLSEC_NO_GOST */
107
108 /********************************************************************
109  *
110  * RSA transforms
111  *
112  *******************************************************************/
113 #ifndef XMLSEC_NO_RSA
114
115 /**
116  * xmlSecMSCryptoKeyDataRsaId:
117  * 
118  * The RSA key klass.
119  */
120 #define xmlSecMSCryptoKeyDataRsaId \
121         xmlSecMSCryptoKeyDataRsaGetKlass()
122 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataRsaGetKlass(void);
123
124
125 /**
126  * xmlSecMSCryptoTransformRsaSha1Id:
127  * 
128  * The RSA-SHA1 signature transform klass.
129  */
130
131 #define xmlSecMSCryptoTransformRsaSha1Id        \
132         xmlSecMSCryptoTransformRsaSha1GetKlass()
133 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaSha1GetKlass(void);
134
135 /**
136  * xmlSecMSCryptoTransformRsaPkcs1Id:
137  * 
138  * The RSA PKCS1 key transport transform klass.
139  */
140 #define xmlSecMSCryptoTransformRsaPkcs1Id \
141         xmlSecMSCryptoTransformRsaPkcs1GetKlass()
142 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaPkcs1GetKlass(void);
143
144 /**
145  * xmlSecMSCryptoTransformRsaOaepId:
146  * 
147  * The RSA PKCS1 key transport transform klass.
148  */
149 /*
150 #define xmlSecMSCryptoTransformRsaOaepId \
151         xmlSecMSCryptoTransformRsaOaepGetKlass()
152 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaOaepGetKlass(void);
153 */
154 #endif /* XMLSEC_NO_RSA */
155
156 /********************************************************************
157  *
158  * SHA1 transform
159  *
160  *******************************************************************/
161 #ifndef XMLSEC_NO_SHA1
162
163 /**
164  * xmlSecMSCryptoTransformSha1Id:
165  * 
166  * The SHA1 digest transform klass.
167  */
168 #define xmlSecMSCryptoTransformSha1Id \
169         xmlSecMSCryptoTransformSha1GetKlass()
170 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformSha1GetKlass(void);
171 #endif /* XMLSEC_NO_SHA1 */
172
173 /********************************************************************
174  *
175  * GOSTR3411_94 transform
176  *
177  *******************************************************************/
178 #ifndef XMLSEC_NO_GOST
179
180 /**
181  * xmlSecMSCryptoTransformGostR3411_94Id:
182  * 
183  * The GOSTR3411_94 digest transform klass.
184  */
185 #define xmlSecMSCryptoTransformGostR3411_94Id \
186         xmlSecMSCryptoTransformGostR3411_94GetKlass()
187 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGostR3411_94GetKlass(void);
188 #endif /* XMLSEC_NO_GOST */
189
190 /********************************************************************
191  *
192  * AES transforms
193  *
194  *******************************************************************/
195 #ifndef XMLSEC_NO_AES
196 /**
197  * xmlSecMSCryptoKeyDataAesId:
198  * 
199  * The AES key data klass.
200  */
201 #define xmlSecMSCryptoKeyDataAesId \
202         xmlSecMSCryptoKeyDataAesGetKlass()
203 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataAesGetKlass(void);
204 XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeyDataAesSet     (xmlSecKeyDataPtr data,
205                                                                          const xmlSecByte* buf,
206                                                                          xmlSecSize bufSize);
207 /**
208  * xmlSecMSCryptoTransformAes128CbcId:
209  * 
210  * The AES128 CBC cipher transform klass.
211  */
212 #define xmlSecMSCryptoTransformAes128CbcId \
213         xmlSecMSCryptoTransformAes128CbcGetKlass()
214 XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecMSCryptoTransformAes128CbcGetKlass(void);
215
216 /**
217  * xmlSecMSCryptoTransformAes192CbcId:
218  * 
219  * The AES192 CBC cipher transform klass.
220  */
221 #define xmlSecMSCryptoTransformAes192CbcId \
222         xmlSecMSCryptoTransformAes192CbcGetKlass()
223 XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecMSCryptoTransformAes192CbcGetKlass(void);
224
225 /**
226  * xmlSecMSCryptoTransformAes256CbcId:
227  * 
228  * The AES256 CBC cipher transform klass.
229  */
230 #define xmlSecMSCryptoTransformAes256CbcId \
231         xmlSecMSCryptoTransformAes256CbcGetKlass()
232 XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecMSCryptoTransformAes256CbcGetKlass(void);
233
234 #endif /* XMLSEC_NO_AES */
235
236
237 /********************************************************************
238  *
239  * DES transform
240  *
241  *******************************************************************/
242 #ifndef XMLSEC_NO_DES
243
244 /**
245  * xmlSecMSCryptoKeyDataDesId:
246  * 
247  * The DES key data klass.
248  */
249 #define xmlSecMSCryptoKeyDataDesId \
250         xmlSecMSCryptoKeyDataDesGetKlass()
251 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataDesGetKlass(void);
252
253 /**
254  * xmlSecMSCryptoTransformDes3CbcId:
255  * 
256  * The DES3 CBC cipher transform klass.
257  */
258 #define xmlSecMSCryptoTransformDes3CbcId \
259         xmlSecMSCryptoTransformDes3CbcGetKlass()
260 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformDes3CbcGetKlass(void);
261
262
263
264 #endif /* XMLSEC_NO_DES */
265
266 #ifdef __cplusplus
267 }
268 #endif /* __cplusplus */
269
270 #endif /* __XMLSEC_MSCRYPTO_CRYPTO_H__ */
271
272 #define __XMLSEC_MSCRYPTO_CRYPTO_H__