-
Notifications
You must be signed in to change notification settings - Fork 0
/
PrivateKey.pas
294 lines (197 loc) · 14.4 KB
/
PrivateKey.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
unit PrivateKey;
interface
type
HCkPublicKey = Pointer;
HCkBinData = Pointer;
HCkPrivateKey = Pointer;
HCkByteData = Pointer;
HCkString = Pointer;
HCkStringBuilder = Pointer;
HCkTask = Pointer;
HCkJsonObject = Pointer;
// Note: The callback functions use the cdecl calling convention, while all other functions use stdcall.
TPrivateKeyAbortCheck = function(): Integer; cdecl;
TPrivateKeyProgressInfo = procedure(name: PWideChar; value: PWideChar); cdecl;
TPrivateKeyPercentDone = function(pctDone: Integer): Integer; cdecl;
TPrivateKeyTaskCompleted = procedure(task: HCkTask); cdecl;
function CkPrivateKey_Create: HCkPrivateKey; stdcall;
procedure CkPrivateKey_Dispose(handle: HCkPrivateKey); stdcall;
procedure CkPrivateKey_SetAbortCheck(objHandle: HCkPrivateKey; fn: TPrivateKeyAbortCheck) stdcall;
procedure CkPrivateKey_SetProgressInfo(objHandle: HCkPrivateKey; fn: TPrivateKeyProgressInfo) stdcall;
procedure CkPrivateKey_SetPercentDone(objHandle: HCkPrivateKey; fn: TPrivateKeyPercentDone) stdcall;
procedure CkPrivateKey_SetTaskCompleted(objHandle: HCkPrivateKey; fn: TPrivateKeyTaskCompleted) stdcall;
function CkPrivateKey_getBitLength(objHandle: HCkPrivateKey): Integer; stdcall;
procedure CkPrivateKey_getDebugLogFilePath(objHandle: HCkPrivateKey; outPropVal: HCkString); stdcall;
procedure CkPrivateKey_putDebugLogFilePath(objHandle: HCkPrivateKey; newPropVal: PWideChar); stdcall;
function CkPrivateKey__debugLogFilePath(objHandle: HCkPrivateKey): PWideChar; stdcall;
procedure CkPrivateKey_getKeyType(objHandle: HCkPrivateKey; outPropVal: HCkString); stdcall;
function CkPrivateKey__keyType(objHandle: HCkPrivateKey): PWideChar; stdcall;
procedure CkPrivateKey_getLastErrorHtml(objHandle: HCkPrivateKey; outPropVal: HCkString); stdcall;
function CkPrivateKey__lastErrorHtml(objHandle: HCkPrivateKey): PWideChar; stdcall;
procedure CkPrivateKey_getLastErrorText(objHandle: HCkPrivateKey; outPropVal: HCkString); stdcall;
function CkPrivateKey__lastErrorText(objHandle: HCkPrivateKey): PWideChar; stdcall;
procedure CkPrivateKey_getLastErrorXml(objHandle: HCkPrivateKey; outPropVal: HCkString); stdcall;
function CkPrivateKey__lastErrorXml(objHandle: HCkPrivateKey): PWideChar; stdcall;
function CkPrivateKey_getLastMethodSuccess(objHandle: HCkPrivateKey): wordbool; stdcall;
procedure CkPrivateKey_putLastMethodSuccess(objHandle: HCkPrivateKey; newPropVal: wordbool); stdcall;
procedure CkPrivateKey_getPkcs8EncryptAlg(objHandle: HCkPrivateKey; outPropVal: HCkString); stdcall;
procedure CkPrivateKey_putPkcs8EncryptAlg(objHandle: HCkPrivateKey; newPropVal: PWideChar); stdcall;
function CkPrivateKey__pkcs8EncryptAlg(objHandle: HCkPrivateKey): PWideChar; stdcall;
procedure CkPrivateKey_getUncommonOptions(objHandle: HCkPrivateKey; outPropVal: HCkString); stdcall;
procedure CkPrivateKey_putUncommonOptions(objHandle: HCkPrivateKey; newPropVal: PWideChar); stdcall;
function CkPrivateKey__uncommonOptions(objHandle: HCkPrivateKey): PWideChar; stdcall;
function CkPrivateKey_getVerboseLogging(objHandle: HCkPrivateKey): wordbool; stdcall;
procedure CkPrivateKey_putVerboseLogging(objHandle: HCkPrivateKey; newPropVal: wordbool); stdcall;
procedure CkPrivateKey_getVersion(objHandle: HCkPrivateKey; outPropVal: HCkString); stdcall;
function CkPrivateKey__version(objHandle: HCkPrivateKey): PWideChar; stdcall;
function CkPrivateKey_GetJwk(objHandle: HCkPrivateKey; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getJwk(objHandle: HCkPrivateKey): PWideChar; stdcall;
function CkPrivateKey_GetJwkThumbprint(objHandle: HCkPrivateKey; hashAlg: PWideChar; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getJwkThumbprint(objHandle: HCkPrivateKey; hashAlg: PWideChar): PWideChar; stdcall;
function CkPrivateKey_GetPkcs1(objHandle: HCkPrivateKey; outData: HCkByteData): wordbool; stdcall;
function CkPrivateKey_GetPkcs1ENC(objHandle: HCkPrivateKey; encoding: PWideChar; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getPkcs1ENC(objHandle: HCkPrivateKey; encoding: PWideChar): PWideChar; stdcall;
function CkPrivateKey_GetPkcs1Pem(objHandle: HCkPrivateKey; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getPkcs1Pem(objHandle: HCkPrivateKey): PWideChar; stdcall;
function CkPrivateKey_GetPkcs8(objHandle: HCkPrivateKey; outData: HCkByteData): wordbool; stdcall;
function CkPrivateKey_GetPkcs8ENC(objHandle: HCkPrivateKey; encoding: PWideChar; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getPkcs8ENC(objHandle: HCkPrivateKey; encoding: PWideChar): PWideChar; stdcall;
function CkPrivateKey_GetPkcs8Encrypted(objHandle: HCkPrivateKey; password: PWideChar; outData: HCkByteData): wordbool; stdcall;
function CkPrivateKey_GetPkcs8EncryptedENC(objHandle: HCkPrivateKey; encoding: PWideChar; password: PWideChar; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getPkcs8EncryptedENC(objHandle: HCkPrivateKey; encoding: PWideChar; password: PWideChar): PWideChar; stdcall;
function CkPrivateKey_GetPkcs8EncryptedPem(objHandle: HCkPrivateKey; password: PWideChar; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getPkcs8EncryptedPem(objHandle: HCkPrivateKey; password: PWideChar): PWideChar; stdcall;
function CkPrivateKey_GetPkcs8Pem(objHandle: HCkPrivateKey; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getPkcs8Pem(objHandle: HCkPrivateKey): PWideChar; stdcall;
function CkPrivateKey_GetPublicKey(objHandle: HCkPrivateKey): HCkPublicKey; stdcall;
function CkPrivateKey_GetRawHex(objHandle: HCkPrivateKey; pubKey: HCkStringBuilder; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getRawHex(objHandle: HCkPrivateKey; pubKey: HCkStringBuilder): PWideChar; stdcall;
function CkPrivateKey_GetRsaDer(objHandle: HCkPrivateKey; outData: HCkByteData): wordbool; stdcall;
function CkPrivateKey_GetRsaPem(objHandle: HCkPrivateKey; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getRsaPem(objHandle: HCkPrivateKey): PWideChar; stdcall;
function CkPrivateKey_GetXml(objHandle: HCkPrivateKey; outStr: HCkString): wordbool; stdcall;
function CkPrivateKey__getXml(objHandle: HCkPrivateKey): PWideChar; stdcall;
function CkPrivateKey_LoadAnyFormat(objHandle: HCkPrivateKey; privKeyData: HCkBinData; password: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadAnyFormatFile(objHandle: HCkPrivateKey; path: PWideChar; password: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadEd25519(objHandle: HCkPrivateKey; privKey: PWideChar; pubKey: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadEncryptedPem(objHandle: HCkPrivateKey; pemStr: PWideChar; password: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadEncryptedPemFile(objHandle: HCkPrivateKey; path: PWideChar; password: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadJwk(objHandle: HCkPrivateKey; jsonStr: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadPem(objHandle: HCkPrivateKey; str: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadPemFile(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadPkcs1(objHandle: HCkPrivateKey; data: HCkByteData): wordbool; stdcall;
function CkPrivateKey_LoadPkcs1File(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadPkcs8(objHandle: HCkPrivateKey; data: HCkByteData): wordbool; stdcall;
function CkPrivateKey_LoadPkcs8Encrypted(objHandle: HCkPrivateKey; data: HCkByteData; password: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadPkcs8EncryptedFile(objHandle: HCkPrivateKey; path: PWideChar; password: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadPkcs8File(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadPvk(objHandle: HCkPrivateKey; data: HCkByteData; password: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadPvkFile(objHandle: HCkPrivateKey; path: PWideChar; password: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadRsaDer(objHandle: HCkPrivateKey; data: HCkByteData): wordbool; stdcall;
function CkPrivateKey_LoadRsaDerFile(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadXml(objHandle: HCkPrivateKey; xml: PWideChar): wordbool; stdcall;
function CkPrivateKey_LoadXmlFile(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SaveLastError(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SavePemFile(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SavePkcs1File(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SavePkcs8EncryptedFile(objHandle: HCkPrivateKey; password: PWideChar; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SavePkcs8EncryptedPemFile(objHandle: HCkPrivateKey; password: PWideChar; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SavePkcs8File(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SavePkcs8PemFile(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SaveRsaDerFile(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SaveRsaPemFile(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_SaveXmlFile(objHandle: HCkPrivateKey; path: PWideChar): wordbool; stdcall;
function CkPrivateKey_UploadToCloud(objHandle: HCkPrivateKey; jsonIn: HCkJsonObject; jsonOut: HCkJsonObject): wordbool; stdcall;
function CkPrivateKey_UploadToCloudAsync(objHandle: HCkPrivateKey; jsonIn: HCkJsonObject; jsonOut: HCkJsonObject): HCkTask; stdcall;
implementation
{$Include chilkatDllPath.inc}
function CkPrivateKey_Create; external DLLName;
procedure CkPrivateKey_Dispose; external DLLName;
procedure CkPrivateKey_SetAbortCheck; external DLLName;
procedure CkPrivateKey_SetProgressInfo; external DLLName;
procedure CkPrivateKey_SetPercentDone; external DLLName;
procedure CkPrivateKey_SetTaskCompleted; external DLLName;
function CkPrivateKey_getBitLength; external DLLName;
procedure CkPrivateKey_getDebugLogFilePath; external DLLName;
procedure CkPrivateKey_putDebugLogFilePath; external DLLName;
function CkPrivateKey__debugLogFilePath; external DLLName;
procedure CkPrivateKey_getKeyType; external DLLName;
function CkPrivateKey__keyType; external DLLName;
procedure CkPrivateKey_getLastErrorHtml; external DLLName;
function CkPrivateKey__lastErrorHtml; external DLLName;
procedure CkPrivateKey_getLastErrorText; external DLLName;
function CkPrivateKey__lastErrorText; external DLLName;
procedure CkPrivateKey_getLastErrorXml; external DLLName;
function CkPrivateKey__lastErrorXml; external DLLName;
function CkPrivateKey_getLastMethodSuccess; external DLLName;
procedure CkPrivateKey_putLastMethodSuccess; external DLLName;
procedure CkPrivateKey_getPkcs8EncryptAlg; external DLLName;
procedure CkPrivateKey_putPkcs8EncryptAlg; external DLLName;
function CkPrivateKey__pkcs8EncryptAlg; external DLLName;
procedure CkPrivateKey_getUncommonOptions; external DLLName;
procedure CkPrivateKey_putUncommonOptions; external DLLName;
function CkPrivateKey__uncommonOptions; external DLLName;
function CkPrivateKey_getVerboseLogging; external DLLName;
procedure CkPrivateKey_putVerboseLogging; external DLLName;
procedure CkPrivateKey_getVersion; external DLLName;
function CkPrivateKey__version; external DLLName;
function CkPrivateKey_GetJwk; external DLLName;
function CkPrivateKey__getJwk; external DLLName;
function CkPrivateKey_GetJwkThumbprint; external DLLName;
function CkPrivateKey__getJwkThumbprint; external DLLName;
function CkPrivateKey_GetPkcs1; external DLLName;
function CkPrivateKey_GetPkcs1ENC; external DLLName;
function CkPrivateKey__getPkcs1ENC; external DLLName;
function CkPrivateKey_GetPkcs1Pem; external DLLName;
function CkPrivateKey__getPkcs1Pem; external DLLName;
function CkPrivateKey_GetPkcs8; external DLLName;
function CkPrivateKey_GetPkcs8ENC; external DLLName;
function CkPrivateKey__getPkcs8ENC; external DLLName;
function CkPrivateKey_GetPkcs8Encrypted; external DLLName;
function CkPrivateKey_GetPkcs8EncryptedENC; external DLLName;
function CkPrivateKey__getPkcs8EncryptedENC; external DLLName;
function CkPrivateKey_GetPkcs8EncryptedPem; external DLLName;
function CkPrivateKey__getPkcs8EncryptedPem; external DLLName;
function CkPrivateKey_GetPkcs8Pem; external DLLName;
function CkPrivateKey__getPkcs8Pem; external DLLName;
function CkPrivateKey_GetPublicKey; external DLLName;
function CkPrivateKey_GetRawHex; external DLLName;
function CkPrivateKey__getRawHex; external DLLName;
function CkPrivateKey_GetRsaDer; external DLLName;
function CkPrivateKey_GetRsaPem; external DLLName;
function CkPrivateKey__getRsaPem; external DLLName;
function CkPrivateKey_GetXml; external DLLName;
function CkPrivateKey__getXml; external DLLName;
function CkPrivateKey_LoadAnyFormat; external DLLName;
function CkPrivateKey_LoadAnyFormatFile; external DLLName;
function CkPrivateKey_LoadEd25519; external DLLName;
function CkPrivateKey_LoadEncryptedPem; external DLLName;
function CkPrivateKey_LoadEncryptedPemFile; external DLLName;
function CkPrivateKey_LoadJwk; external DLLName;
function CkPrivateKey_LoadPem; external DLLName;
function CkPrivateKey_LoadPemFile; external DLLName;
function CkPrivateKey_LoadPkcs1; external DLLName;
function CkPrivateKey_LoadPkcs1File; external DLLName;
function CkPrivateKey_LoadPkcs8; external DLLName;
function CkPrivateKey_LoadPkcs8Encrypted; external DLLName;
function CkPrivateKey_LoadPkcs8EncryptedFile; external DLLName;
function CkPrivateKey_LoadPkcs8File; external DLLName;
function CkPrivateKey_LoadPvk; external DLLName;
function CkPrivateKey_LoadPvkFile; external DLLName;
function CkPrivateKey_LoadRsaDer; external DLLName;
function CkPrivateKey_LoadRsaDerFile; external DLLName;
function CkPrivateKey_LoadXml; external DLLName;
function CkPrivateKey_LoadXmlFile; external DLLName;
function CkPrivateKey_SaveLastError; external DLLName;
function CkPrivateKey_SavePemFile; external DLLName;
function CkPrivateKey_SavePkcs1File; external DLLName;
function CkPrivateKey_SavePkcs8EncryptedFile; external DLLName;
function CkPrivateKey_SavePkcs8EncryptedPemFile; external DLLName;
function CkPrivateKey_SavePkcs8File; external DLLName;
function CkPrivateKey_SavePkcs8PemFile; external DLLName;
function CkPrivateKey_SaveRsaDerFile; external DLLName;
function CkPrivateKey_SaveRsaPemFile; external DLLName;
function CkPrivateKey_SaveXmlFile; external DLLName;
function CkPrivateKey_UploadToCloud; external DLLName;
function CkPrivateKey_UploadToCloudAsync; external DLLName;
end.