-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathssl_pem.pas
230 lines (194 loc) · 13.6 KB
/
ssl_pem.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
{$i ssl.inc}
unit ssl_pem;
interface
uses ssl_types;
var
PEM_read_bio_PrivateKey: function(bp: PBIO; x: PPEVP_PKEY; cb: pem_password_cb; u: pointer): PEVP_PKEY; cdecl = nil;
PEM_read_PrivateKey: function(var fp: FILE; x: PPEVP_PKEY; cb: pem_password_cb; u: pointer): PEVP_PKEY; cdecl = nil;
PEM_write_bio_PrivateKey: function(bp: PBIO; x: PEVP_PKEY; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
PEM_write_PrivateKey: function(var fp: FILE; x: PEVP_PKEY; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: Pointer): TC_INT; cdecl = nil;
PEM_write_bio_PKCS8PrivateKey: function(bp: PBIO; x: PEVP_PKEY; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
PEM_write_PKCS8PrivateKey: function(var fp: FILE; x: PEVP_PKEY; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: Pointer): TC_INT; cdecl = nil;
PEM_write_bio_PKCS8PrivateKey_nid: function (bp: PBIO; x: PEVP_PKEY; nid: TC_INT; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
PEM_write_PKCS8PrivateKey_nid: function(var fp: FILE; x: PEVP_PKEY; nid: TC_INT; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: Pointer): TC_INT; cdecl = nil;
PEM_read_bio_PUBKEY: function(bp: PBIO; x: PPEVP_PKEY; cb: pem_password_cb; u: pointer): PEVP_PKEY; cdecl = nil;
PEM_read_PUBKEY: function (var fp: FILE; x: PPEVP_PKEY; cb: pem_password_cb; u: pointer): PEVP_PKEY; cdecl = nil;
PEM_write_bio_PUBKEY: function (bp: PBIO; x: PEVP_PKEY): TC_INT; cdecl = nil;
PEM_write_PUBKEY: function(var fp: FILE; x: PEVP_PKEY): TC_INT; cdecl = nil;
PEM_read_bio_Parameters: function(bp: PBIO; x: PPEVP_PKEY): PEVP_PKEY; cdecl = nil;
PEM_write_bio_Parameters: function(bp: PBIO; x: PEVP_PKEY): TC_INT; cdecl = nil;
{$REGION 'RSA'}
PEM_read_bio_RSAPrivateKey: function(bp: PBIO; x: PPRSA; cb: pem_password_cb; u: pointer): PRSA; cdecl = nil;
PEM_read_RSAPrivateKey: function(var fp: FILE; x: PPRSA; cb: pem_password_cb; u: pointer): PRSA; cdecl = nil;
PEM_write_bio_RSAPrivateKey: function(bp: PBIO; x: PRSA; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
PEM_write_RSAPrivateKey: function(var fp: FILE; x: PRSA; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
PEM_read_bio_RSAPublicKey:function(bp: PBIO; x: PPRSA; cb: pem_password_cb; u: pointer): PRSA; cdecl = nil;
PEM_read_RSAPublicKey: function(var fp: FILE; x: PPRSA; cb: pem_password_cb; u: pointer): PRSA; cdecl = nil;
PEM_write_bio_RSAPublicKey: function(bp: PBIO; x: PRSA): TC_INT; cdecl = nil;
PEM_write_RSAPublicKey: function(var fp: FILE; x: PRSA): TC_INT; cdecl = nil;
PEM_read_bio_RSA_PUBKEY:function(bp: PBIO; x: PPRSA; cb: pem_password_cb; u: pointer): PRSA; cdecl = nil;
PEM_read_RSA_PUBKEY: function(var fp: FILE; x: PPRSA; cb: pem_password_cb; u: pointer): PRSA; cdecl = nil;
PEM_write_bio_RSA_PUBKEY: function(bp: PBIO; x: PRSA): TC_INT; cdecl = nil;
PEM_write_RSA_PUBKEY: function(var fp: FILE; x: PRSA): TC_INT; cdecl = nil;
{$ENDREGION}
{$REGION 'DSA'}
PEM_read_bio_DSAPrivateKey: function(bp: PBIO; x: PPDSA; cb: pem_password_cb; u: pointer): PDSA; cdecl = nil;
PEM_read_DSAPrivateKey: function(var fp: FILE; x: PPDSA; cb: pem_password_cb; u: pointer): PDSA; cdecl = nil;
PEM_write_bio_DSAPrivateKey:function(bp: PBIO; x: PDSA; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
PEM_write_DSAPrivateKey: function(var fp: FILE; x: PDSA; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
PEM_read_bio_DSA_PUBKEY: function(bp: PBIO; x: PPDSA; cb: pem_password_cb; u: pointer): PDSA; cdecl = nil;
PEM_read_DSA_PUBKEY: function(var fp: FILE; x: PPDSA; cb: pem_password_cb; u: pointer): PDSA; cdecl = nil;
PEM_write_bio_DSA_PUBKEY: function(bp: PBIO; x: PDSA): TC_INT; cdecl = nil;
PEM_write_DSA_PUBKEY: function(var fp: FILE; x: PDSA): TC_INT; cdecl = nil;
PEM_read_bio_DSAparams: function(bp: PBIO; x: PPDSA; cb: pem_password_cb; u: Pointer): PDSA; cdecl = nil;
PEM_read_DSAparams: function(var fp: FILE; x: PPDSA; cb: pem_password_cb; u: pointer): PDSA; cdecl = nil;
PEM_write_bio_DSAparams: function(bp: PBIO; x: PDSA): TC_INT; cdecl = nil;
PEM_write_DSAparams: function(var fp: FILE; x: PDSA): TC_INT; cdecl = nil;
{$ENDREGION}
{$REGION 'DH'}
PEM_read_bio_DHparams: function(bp: PBIO; x: PPDH; cb: pem_password_cb; u: pointer): PDH; cdecl = nil;
PEM_read_DHparams: function(var fp: FILE; x: PPDH; cb: pem_password_cb; u: pointer): PDH; cdecl = nil;
PEM_write_bio_DHparams: function(bp: PBIO; x: PDH): TC_INT; cdecl = nil;
PEM_write_DHparams: function(var fp: FILE; x: PDH): TC_INT; cdecl = nil;
{$ENDREGION}
{$REGION 'X509'}
PEM_read_bio_X509: function(bp: PBIO; x: PPX509; cb: pem_password_cb; u: pointer): PX509; cdecl = nil;
PEM_read_X509: function(var fp: FILE; x: PPX509; cb: pem_password_cb; u: pointer): PX509; cdecl = nil;
PEM_write_bio_X509: function(bp: PBIO; x: PX509): TC_INT; cdecl = nil;
PEM_write_X509: function(var fp: FILE; x: PX509): TC_INT; cdecl = nil;
PEM_read_bio_X509_AUX: function(bp: PBIO; x: PPX509; cb: pem_password_cb; u: pointer): PX509; cdecl = nil;
PEM_read_X509_AUX: function(var fp: FILE; x: PPX509; cb: pem_password_cb; u: pointer): PX509; cdecl = nil;
PEM_write_bio_X509_AUX: function(bp: PBIO; x: PX509): TC_INT; cdecl = nil;
PEM_write_X509_AUX: function(var fp: FILE; x: PX509): TC_INT; cdecl = nil;
PEM_read_bio_X509_REQ: function(bp: PBIO; x: PPX509_REQ; cb: pem_password_cb; u: pointer): PX509_REQ; cdecl = nil;
PEM_read_X509_REQ: function(var fp: FILE; x: PPX509_REQ; cb: pem_password_cb; u: pointer): PX509_REQ; cdecl = nil;
PEM_write_bio_X509_REQ: function(bp: PBIO; x: PX509_REQ): TC_INT; cdecl = nil;
PEM_write_X509_REQ: function(var fp: FILE; x: PX509_REQ): TC_INT; cdecl = nil;
PEM_write_bio_X509_REQ_NEW: function(bp: PBIO; x: PX509_REQ): TC_INT; cdecl = nil;
PEM_write_X509_REQ_NEW: function(var fp: FILE; x: PX509_REQ): TC_INT; cdecl = nil;
PEM_read_bio_X509_CRL: function(bp: PBIO; x: PPX509_CRL; cb: pem_password_cb; u: pointer): PX509_CRL; cdecl = nil;
PEM_read_X509_CRL: function(var fp: FILE; x: PPX509_CRL; cb: pem_password_cb; u: pointer): PX509_CRL; cdecl = nil;
PEM_write_bio_X509_CRL: function(bp: PBIO; x: PX509_CRL): TC_INT; cdecl = nil;
PEM_write_X509_CRL: function(var fp: FILE; x: PX509_CRL): TC_INT; cdecl = nil;
{$ENDREGION}
{$REGION 'PKCS7}
PEM_read_bio_PKCS7: function(bp: PBIO; x: PPPKCS7; cb: pem_password_cb; u: pointer): PPKCS7; cdecl = nil;
PEM_read_PKCS7: function(var fp: FILE; x: PPPKCS7; cb: pem_password_cb; u: pointer): PPKCS7; cdecl = nil;
PEM_write_bio_PKCS7: function(bp: PBIO; x: PPKCS7): TC_INT; cdecl = nil;
PEM_write_PKCS7: function(var fp: FILE; x: PPKCS7): TC_INT; cdecl = nil;
{$ENDREGION}
{$REGION 'NETSCAPE'}
PEM_read_bio_NETSCAPE_CERT_SEQUENCE: function(bp: PBIO; x: PPNETSCAPE_CERT_SEQUENCE; cb: pem_password_cb; u: pointer): PNETSCAPE_CERT_SEQUENCE; cdecl = nil;
PEM_read_NETSCAPE_CERT_SEQUENCE: function(var fp: FILE; x: PPNETSCAPE_CERT_SEQUENCE; cb: pem_password_cb; u: pointer): PNETSCAPE_CERT_SEQUENCE; cdecl = nil;
PEM_write_bio_NETSCAPE_CERT_SEQUENCE: function(bp: PBIO; x: PNETSCAPE_CERT_SEQUENCE): TC_INT; cdecl = nil;
PEM_write_NETSCAPE_CERT_SEQUENCE: function(var fp: FILE; x: PNETSCAPE_CERT_SEQUENCE): TC_INT; cdecl = nil;
{$ENDREGION}
PEM_write_ECPrivateKey: function(var fp: FILE; x: PEC_KEY; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
PEM_write_bio_ECPrivateKey: function(bp: PBIO; x: PEC_KEY; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
i2d_PKCS8PrivateKey_bio: function(bp: PBIO; x: PEVP_PKEY; enc: PEVP_CIPHER; kstr: PAnsiChar;
klen: TC_INT; cb: pem_password_cb; u: pointer): TC_INT; cdecl = nil;
procedure SSL_InitPEM;
implementation
uses ssl_lib;
procedure SSL_InitPEM;
begin
if @PEM_read_bio_PrivateKey = nil then
begin
@PEM_read_bio_PrivateKey:= LoadFunctionCLib('PEM_read_bio_PrivateKey');
@PEM_read_PrivateKey:= LoadFunctionCLib('PEM_read_PrivateKey');
@PEM_write_bio_PrivateKey := LoadFunctionCLib('PEM_write_bio_PrivateKey');
@PEM_write_PrivateKey:= LoadFunctionCLib('PEM_write_PrivateKey');
@PEM_write_bio_PKCS8PrivateKey:= LoadFunctionCLib('PEM_write_bio_PKCS8PrivateKey');
@PEM_write_PKCS8PrivateKey:= LoadFunctionCLib('PEM_write_PKCS8PrivateKey');
@PEM_write_bio_PKCS8PrivateKey_nid:= LoadFunctionCLib('PEM_write_bio_PKCS8PrivateKey_nid');
@PEM_write_PKCS8PrivateKey_nid:= LoadFunctionCLib('PEM_write_PKCS8PrivateKey_nid');
@PEM_read_bio_PUBKEY:= LoadFunctionCLib('PEM_read_bio_PUBKEY');
@PEM_read_PUBKEY:= LoadFunctionCLib('PEM_read_PUBKEY');
@PEM_write_bio_PUBKEY:= LoadFunctionCLib('PEM_write_bio_PUBKEY');
@PEM_write_PUBKEY:= LoadFunctionCLib('PEM_write_PUBKEY');
{$REGION 'RSA'}
@PEM_read_bio_RSAPrivateKey:= LoadFunctionCLib('PEM_read_bio_RSAPrivateKey');
@PEM_read_RSAPrivateKey:= LoadFunctionCLib('PEM_read_RSAPrivateKey');
@PEM_write_bio_RSAPrivateKey:= LoadFunctionCLib('PEM_write_bio_RSAPrivateKey');
@PEM_write_RSAPrivateKey:= LoadFunctionCLib('PEM_write_RSAPrivateKey');
@PEM_read_bio_RSAPublicKey:= LoadFunctionCLib('PEM_read_bio_RSAPublicKey');
@PEM_read_RSAPublicKey:=LoadFunctionCLib('PEM_read_RSAPublicKey');
@PEM_write_bio_RSAPublicKey:= LoadFunctionCLib('PEM_write_bio_RSAPublicKey');
@PEM_write_RSAPublicKey:= LoadFunctionCLib('PEM_write_RSAPublicKey');
@PEM_read_bio_RSA_PUBKEY:= LoadFunctionCLib('PEM_read_bio_RSA_PUBKEY');
@PEM_read_RSA_PUBKEY:= LoadFunctionCLib('PEM_read_RSA_PUBKEY');
@PEM_write_bio_RSA_PUBKEY:= LoadFunctionCLib('PEM_write_bio_RSA_PUBKEY');
@PEM_write_RSA_PUBKEY:= LoadFunctionCLib('PEM_write_RSA_PUBKEY');
{$ENDREGION}
{$REGION 'DSA'}
@PEM_read_bio_DSAPrivateKey:= LoadFunctionCLib('PEM_write_RSA_PUBKEY');
@PEM_read_DSAPrivateKey:=LoadFunctionCLib('PEM_read_DSAPrivateKey');
@PEM_write_bio_DSAPrivateKey:= LoadFunctionCLib('PEM_write_bio_DSAPrivateKey');
@PEM_write_DSAPrivateKey:= LoadFunctionCLib('PEM_write_DSAPrivateKey');
@PEM_read_bio_DSA_PUBKEY:= LoadFunctionCLib('PEM_read_bio_DSA_PUBKEY');
@PEM_read_DSA_PUBKEY:= LoadFunctionCLib('PEM_read_DSA_PUBKEY');
@PEM_write_bio_DSA_PUBKEY:= LoadFunctionCLib('PEM_write_bio_DSA_PUBKEY');
@PEM_write_DSA_PUBKEY:= LoadFunctionCLib('PEM_write_DSA_PUBKEY');
@PEM_read_bio_DSAparams:= LoadFunctionCLib('PEM_read_bio_DSAparams');
@PEM_read_DSAparams := LoadFunctionCLib('PEM_read_DSAparams');
@PEM_write_bio_DSAparams:= LoadFunctionCLib('PEM_write_bio_DSAparams');
@PEM_write_DSAparams:= LoadFunctionCLib('PEM_write_DSAparams');
{$ENDREGION}
{$REGION 'DH'}
@PEM_read_bio_DHparams:= LoadFunctionCLib('PEM_read_bio_DHparams');
@PEM_read_DHparams:= LoadFunctionCLib('PEM_read_DHparams');
@PEM_write_bio_DHparams:=LoadFunctionCLib('PEM_write_bio_DHparams');
@PEM_write_DHparams:= LoadFunctionCLib('PEM_write_DHparams');
{$ENDREGION}
{$REGION 'X509'}
@PEM_read_bio_X509:= LoadFunctionCLib('PEM_read_bio_X509');
@PEM_read_X509:= LoadFunctionCLib('PEM_read_X509');
@PEM_write_bio_X509:= LoadFunctionCLib('PEM_write_bio_X509');
@PEM_write_X509:=LoadFunctionCLib('PEM_write_X509');
@PEM_read_bio_X509_AUX:= LoadFunctionCLib('PEM_read_bio_X509_AUX');
@PEM_read_X509_AUX:= LoadFunctionCLib('PEM_read_X509_AUX');
@PEM_write_bio_X509_AUX:= LoadFunctionCLib('PEM_write_bio_X509_AUX');
@PEM_write_X509_AUX:= LoadFunctionCLib('PEM_write_X509_AUX');
@PEM_read_bio_X509_REQ:= LoadFunctionCLib('PEM_read_bio_X509_REQ');
@PEM_read_X509_REQ:= LoadFunctionCLib('PEM_read_X509_REQ');
@PEM_write_bio_X509_REQ:= LoadFunctionCLib('PEM_write_bio_X509_REQ');
@PEM_write_X509_REQ:= LoadFunctionCLib('PEM_write_X509_REQ');
@PEM_write_bio_X509_REQ_NEW:= LoadFunctionCLib('PEM_write_bio_X509_REQ_NEW');
@PEM_write_X509_REQ_NEW:= LoadFunctionCLib('PEM_write_X509_REQ_NEW');
@PEM_read_bio_X509_CRL:= LoadFunctionCLib('PEM_read_bio_X509_CRL');
@PEM_read_X509_CRL:= LoadFunctionCLib('PEM_read_X509_CRL');
@PEM_write_bio_X509_CRL:= LoadFunctionCLib('PEM_write_bio_X509_CRL');
@PEM_write_X509_CRL:= LoadFunctionCLib('PEM_write_X509_CRL');
{$ENDREGION}
{$REGION 'PKCS7}
@PEM_read_bio_PKCS7:= LoadFunctionCLib('PEM_read_bio_PKCS7');
@PEM_read_PKCS7:= LoadFunctionCLib('PEM_read_PKCS7');
@PEM_write_bio_PKCS7:= LoadFunctionCLib('PEM_write_bio_PKCS7');
@PEM_write_PKCS7:= LoadFunctionCLib('PEM_write_PKCS7');
{$ENDREGION}
{$REGION 'NETSCAPE'}
@PEM_read_bio_NETSCAPE_CERT_SEQUENCE:= LoadFunctionCLib('PEM_read_bio_NETSCAPE_CERT_SEQUENCE');
@PEM_read_NETSCAPE_CERT_SEQUENCE:= LoadFunctionCLib('PEM_read_NETSCAPE_CERT_SEQUENCE');
@PEM_write_bio_NETSCAPE_CERT_SEQUENCE:= LoadFunctionCLib('PEM_write_bio_NETSCAPE_CERT_SEQUENCE');
@PEM_write_NETSCAPE_CERT_SEQUENCE:= LoadFunctionCLib('PEM_write_NETSCAPE_CERT_SEQUENCE');
{$ENDREGION}
@PEM_write_ECPrivateKey := LoadFunctionCLib('PEM_write_ECPrivateKey');
@PEM_write_bio_ECPrivateKey := LoadFunctionCLib('PEM_write_bio_ECPrivateKey');
@i2d_PKCS8PrivateKey_bio := LoadFunctionCLib('i2d_PKCS8PrivateKey_bio');
@PEM_read_bio_Parameters:= LoadFunctionCLib('PEM_read_bio_Parameters');
@PEM_write_bio_Parameters:= LoadFunctionCLib('PEM_write_bio_Parameters');
end;
end;
end.