forked from HvyIndustries/crane-php-stubs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gnupg.php
414 lines (353 loc) · 12.8 KB
/
gnupg.php
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<?php
// Start of gnupg v.1.3.3-dev
class gnupg {
const SIG_MODE_NORMAL = 0;
const SIG_MODE_DETACH = 1;
const SIG_MODE_CLEAR = 2;
const VALIDITY_UNKNOWN = 0;
const VALIDITY_UNDEFINED = 1;
const VALIDITY_NEVER = 2;
const VALIDITY_MARGINAL = 3;
const VALIDITY_FULL = 4;
const VALIDITY_ULTIMATE = 5;
const PROTOCOL_OpenPGP = 0;
const PROTOCOL_CMS = 1;
const SIGSUM_VALID = 1;
const SIGSUM_GREEN = 2;
const SIGSUM_RED = 4;
const SIGSUM_KEY_REVOKED = 16;
const SIGSUM_KEY_EXPIRED = 32;
const SIGSUM_SIG_EXPIRED = 64;
const SIGSUM_KEY_MISSING = 128;
const SIGSUM_CRL_MISSING = 256;
const SIGSUM_CRL_TOO_OLD = 512;
const SIGSUM_BAD_POLICY = 1024;
const SIGSUM_SYS_ERROR = 2048;
const ERROR_WARNING = 1;
const ERROR_EXCEPTION = 2;
const ERROR_SILENT = 3;
public function keyinfo () {}
public function verify () {}
public function geterror () {}
public function clearsignkeys () {}
public function clearencryptkeys () {}
public function cleardecryptkeys () {}
public function setarmor () {}
public function encrypt () {}
public function decrypt () {}
public function export () {}
public function import () {}
public function getprotocol () {}
public function setsignmode () {}
public function sign () {}
public function encryptsign () {}
public function decryptverify () {}
public function addsignkey () {}
public function addencryptkey () {}
public function adddecryptkey () {}
public function deletekey () {}
public function gettrustlist () {}
public function listsignatures () {}
public function seterrormode () {}
}
class gnupg_keylistiterator implements Iterator, Traversable {
public function __construct () {}
public function current () {}
public function key () {}
public function next () {}
public function rewind () {}
public function valid () {}
}
/**
* (PECL gnupg >= 0.4)<br/>
* Initialize a connection
* @link http://php.net/manual/en/function.gnupg-init.php
* @return resource A GnuPG resource connection used by other GnuPG functions.
*/
function gnupg_init () {}
/**
* (PECL gnupg >= 0.1)<br/>
* Returns an array with information about all keys that matches the given pattern
* @link http://php.net/manual/en/function.gnupg-keyinfo.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $pattern <p>
* The pattern being checked against the keys.
* </p>
* @return array an array with information about all keys that matches the given
* pattern or <b>FALSE</b>, if an error has occurred.
*/
function gnupg_keyinfo ($identifier, $pattern) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Signs a given text
* @link http://php.net/manual/en/function.gnupg-sign.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $plaintext <p>
* The plain text being signed.
* </p>
* @return string On success, this function returns the signed text or the signature.
* On failure, this function returns <b>FALSE</b>.
*/
function gnupg_sign ($identifier, $plaintext) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Verifies a signed text
* @link http://php.net/manual/en/function.gnupg-verify.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $signed_text <p>
* The signed text.
* </p>
* @param string $signature <p>
* The signature.
* To verify a clearsigned text, set signature to <b>FALSE</b>.
* </p>
* @param string $plaintext [optional] <p>
* The plain text.
* If this optional parameter is passed, it is
* filled with the plain text.
* </p>
* @return array On success, this function returns information about the signature.
* On failure, this function returns <b>FALSE</b>.
*/
function gnupg_verify ($identifier, $signed_text, $signature, &$plaintext = null) {}
/**
* (PECL gnupg >= 0.5)<br/>
* Removes all keys which were set for signing before
* @link http://php.net/manual/en/function.gnupg-clearsignkeys.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function gnupg_clearsignkeys ($identifier) {}
/**
* (PECL gnupg >= 0.5)<br/>
* Removes all keys which were set for encryption before
* @link http://php.net/manual/en/function.gnupg-clearencryptkeys.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function gnupg_clearencryptkeys ($identifier) {}
/**
* (PECL gnupg >= 0.5)<br/>
* Removes all keys which were set for decryption before
* @link http://php.net/manual/en/function.gnupg-cleardecryptkeys.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function gnupg_cleardecryptkeys ($identifier) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Toggle armored output
* @link http://php.net/manual/en/function.gnupg-setarmor.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param int $armor <p>
* Pass a non-zero integer-value to this function to enable armored-output
* (default).
* Pass 0 to disable armored output.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function gnupg_setarmor ($identifier, $armor) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Encrypts a given text
* @link http://php.net/manual/en/function.gnupg-encrypt.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $plaintext <p>
* The text being encrypted.
* </p>
* @return string On success, this function returns the encrypted text.
* On failure, this function returns <b>FALSE</b>.
*/
function gnupg_encrypt ($identifier, $plaintext) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Decrypts a given text
* @link http://php.net/manual/en/function.gnupg-decrypt.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $text <p>
* The text being decrypted.
* </p>
* @return string On success, this function returns the decrypted text.
* On failure, this function returns <b>FALSE</b>.
*/
function gnupg_decrypt ($identifier, $text) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Exports a key
* @link http://php.net/manual/en/function.gnupg-export.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $fingerprint The fingerprint key.</p>
* @return string On success, this function returns the keydata.
* On failure, this function returns <b>FALSE</b>.
*/
function gnupg_export ($identifier, $fingerprint) {}
/**
* (PECL gnupg >= 0.3)<br/>
* Imports a key
* @link http://php.net/manual/en/function.gnupg-import.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $keydata <p>
* The data key that is being imported.
* </p>
* @return array On success, this function returns and info-array about the importprocess.
* On failure, this function returns <b>FALSE</b>.
*/
function gnupg_import ($identifier, $keydata) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Returns the currently active protocol for all operations
* @link http://php.net/manual/en/function.gnupg-getprotocol.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @return int the currently active protocol, which can be one of
* <b>GNUPG_PROTOCOL_OpenPGP</b> or
* <b>GNUPG_PROTOCOL_CMS</b>.
*/
function gnupg_getprotocol ($identifier) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Sets the mode for signing
* @link http://php.net/manual/en/function.gnupg-setsignmode.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param int $signmode
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function gnupg_setsignmode ($identifier, $signmode) {}
/**
* (PECL gnupg >= 0.2)<br/>
* Encrypts and signs a given text
* @link http://php.net/manual/en/function.gnupg-encryptsign.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $plaintext <p>
* The text being encrypted.
* </p>
* @return string On success, this function returns the encrypted and signed text.
* On failure, this function returns <b>FALSE</b>.
*/
function gnupg_encryptsign ($identifier, $plaintext) {}
/**
* (PECL gnupg >= 0.2)<br/>
* Decrypts and verifies a given text
* @link http://php.net/manual/en/function.gnupg-decryptverify.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $text <p>
* The text being decrypted.
* </p>
* @param string $plaintext <p>
* The parameter <i>plaintext</i> gets filled with the decrypted
* text.
* </p>
* @return array On success, this function returns information about the signature and
* fills the <i>plaintext</i> parameter with the decrypted text.
* On failure, this function returns <b>FALSE</b>.
*/
function gnupg_decryptverify ($identifier, $text, &$plaintext) {}
/**
* (PECL gnupg >= 0.1)<br/>
* Returns the errortext, if a function fails
* @link http://php.net/manual/en/function.gnupg-geterror.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @return string an errortext, if an error has occurred, otherwise <b>FALSE</b>.
*/
function gnupg_geterror ($identifier) {}
/**
* (PECL gnupg >= 0.5)<br/>
* Add a key for signing
* @link http://php.net/manual/en/function.gnupg-addsignkey.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $fingerprint The fingerprint key.</p>
* @param string $passphrase [optional] <p>
* The pass phrase.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function gnupg_addsignkey ($identifier, $fingerprint, $passphrase = null) {}
/**
* (PECL gnupg >= 0.5)<br/>
* Add a key for encryption
* @link http://php.net/manual/en/function.gnupg-addencryptkey.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $fingerprint The fingerprint key.</p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function gnupg_addencryptkey ($identifier, $fingerprint) {}
/**
* (PECL gnupg >= 0.5)<br/>
* Add a key for decryption
* @link http://php.net/manual/en/function.gnupg-adddecryptkey.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param string $fingerprint The fingerprint key.</p>
* @param string $passphrase <p>
* The pass phrase.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function gnupg_adddecryptkey ($identifier, $fingerprint, $passphrase) {}
function gnupg_deletekey () {}
function gnupg_gettrustlist () {}
function gnupg_listsignatures () {}
/**
* (PECL gnupg >= 0.6)<br/>
* Sets the mode for error_reporting
* @link http://php.net/manual/en/function.gnupg-seterrormode.php
* @param resource $identifier The gnupg identifier, from a call to
* <b>gnupg_init</b> or <b>gnupg</b>.</p>
* @param int $errormode <p>
* The error mode.
* </p>
* <p>
* <i>errormode</i> takes a constant indicating what type of
* error_reporting should be used. The possible values are
* <b>GNUPG_ERROR_WARNING</b>,
* <b>GNUPG_ERROR_EXCEPTION</b> and
* <b>GNUPG_ERROR_SILENT</b>.
* By default <b>GNUPG_ERROR_SILENT</b> is used.
* </p>
* @return void No value is returned.
*/
function gnupg_seterrormode ($identifier, $errormode) {}
define ('GNUPG_SIG_MODE_NORMAL', 0);
define ('GNUPG_SIG_MODE_DETACH', 1);
define ('GNUPG_SIG_MODE_CLEAR', 2);
define ('GNUPG_VALIDITY_UNKNOWN', 0);
define ('GNUPG_VALIDITY_UNDEFINED', 1);
define ('GNUPG_VALIDITY_NEVER', 2);
define ('GNUPG_VALIDITY_MARGINAL', 3);
define ('GNUPG_VALIDITY_FULL', 4);
define ('GNUPG_VALIDITY_ULTIMATE', 5);
define ('GNUPG_PROTOCOL_OpenPGP', 0);
define ('GNUPG_PROTOCOL_CMS', 1);
define ('GNUPG_SIGSUM_VALID', 1);
define ('GNUPG_SIGSUM_GREEN', 2);
define ('GNUPG_SIGSUM_RED', 4);
define ('GNUPG_SIGSUM_KEY_REVOKED', 16);
define ('GNUPG_SIGSUM_KEY_EXPIRED', 32);
define ('GNUPG_SIGSUM_SIG_EXPIRED', 64);
define ('GNUPG_SIGSUM_KEY_MISSING', 128);
define ('GNUPG_SIGSUM_CRL_MISSING', 256);
define ('GNUPG_SIGSUM_CRL_TOO_OLD', 512);
define ('GNUPG_SIGSUM_BAD_POLICY', 1024);
define ('GNUPG_SIGSUM_SYS_ERROR', 2048);
define ('GNUPG_ERROR_WARNING', 1);
define ('GNUPG_ERROR_EXCEPTION', 2);
define ('GNUPG_ERROR_SILENT', 3);
// End of gnupg v.1.3.3-dev
?>