forked from JetBrains/phpstorm-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgnupg.php
322 lines (297 loc) · 7 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
<?php
/** GNUPG Constants
* @link https://php.net/manual/en/gnupg.constants.php
*/
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);
/**
* GNUPG Encryption Class
* @link https://php.net/manual/en/book.gnupg.php
* Class gnupg
*/
class gnupg {
/**
* Add a key for decryption
* @link https://php.net/manual/en/function.gnupg-adddecryptkey.php
* @phpstub
*
* @param string $fingerprint
* @param string $passphrase
*
* @return bool
*/
function adddecryptkey($fingerprint, $passphrase)
{
}
/**
* Verifies a signed text
* @link https://php.net/manual/en/function.gnupg-verify.php
* @phpstub
*
* * @param string $signed_text
* @param string $signature
* @param string $plaintext
*
* @return array|false On success, this function returns information about the signature.
* On failure, this function returns false.
*/
function verify($signed_text, $signature, &$plaintext = NULL)
{
}
/**
* Add a key for encryption
* @link https://php.net/manual/en/function.gnupg-addencryptkey.php
* @phpstub
*
* @param string $fingerprint
*
* @return bool
*/
function addencryptkey($fingerprint)
{
}
/**
* Add a key for signing
* @link https://php.net/manual/en/function.gnupg-addsignkey.php
* @phpstub
*
* @param string $fingerprint
* @param string $passphrase
*
* @return bool
*/
function addsignkey($fingerprint, $passphrase = NULL)
{
}
/**
* Removes all keys which were set for decryption before
* @link https://php.net/manual/en/function.gnupg-cleardecryptkeys.php
* @phpstub
*
* @return bool
*/
function cleardecryptkeys()
{
}
/**
* Removes all keys which were set for encryption before
* @link https://php.net/manual/en/function.gnupg-clearencryptkeys.php
* @phpstub
*
*
* @return bool
*/
function clearencryptkeys()
{
}
/**
* Removes all keys which were set for signing before
* @link https://php.net/manual/en/function.gnupg-clearsignkeys.php
* @phpstub
*
*
* @return bool
*/
function clearsignkeys()
{
}
/**
* Decrypts a given text
* @link https://php.net/manual/en/function.gnupg-decrypt.php
* @phpstub
*
* @param string $text
*
* @return string|false On success, this function returns the decrypted text.
* On failure, this function returns false.
*/
function decrypt($text)
{
}
/**
* Decrypts and verifies a given text
* @link https://php.net/manual/en/function.gnupg-decryptverify.php
* @phpstub
*
* @param string $text
* @param string $plaintext
*
* @return array|false On success, this function returns information about the signature and
* fills the parameter with the decrypted text.
* On failure, this function returns false.
*/
function decryptverify($text, &$plaintext)
{
}
/**
* Encrypts a given text
* @link https://php.net/manual/en/function.gnupg-encrypt.php
* @phpstub
*
* @param string $plaintext
*
* @return string|false On success, this function returns the encrypted text.
* On failure, this function returns false.
*/
function encrypt($plaintext)
{
}
/**
* Encrypts and signs a given text
* @link https://php.net/manual/en/function.gnupg-encryptsign.php
* @phpstub
*
* @param string $plaintext
*
* @return string|false On success, this function returns the encrypted and signed text.
* On failure, this function returns false.
*/
function encryptsign($plaintext)
{
}
/**
* Exports a key
* @link https://php.net/manual/en/function.gnupg-export.php
* @phpstub
*
* @param string $fingerprint
*
* @return string|false On success, this function returns the keydata.
* On failure, this function returns false.
*/
function export($fingerprint)
{
}
/**
* Returns the errortext, if a function fails
* @link https://php.net/manual/en/function.gnupg-geterror.php
* @phpstub
*
*
* @return string|false Returns an errortext, if an error has occurred, otherwise false.
*/
function geterror()
{
}
/**
* Returns the currently active protocol for all operations
* @link https://php.net/manual/en/function.gnupg-getprotocol.php
* @phpstub
*
*
* @return int Returns the currently active protocol, which can be one of
* or
* .
*/
function getprotocol()
{
}
/**
* Imports a key
* @link https://php.net/manual/en/function.gnupg-import.php
* @phpstub
*
* @param string $keydata
*
* @return array|false On success, this function returns and info-array about the importprocess.
* On failure, this function returns false.
*/
function import($keydata)
{
}
/**
* Initialize a connection
* @link https://php.net/manual/en/function.gnupg-init.php
* @phpstub
*
* @return resource A GnuPG ``resource`` connection used by other GnuPG functions.
*/
function init()
{
}
/**
* Returns an array with information about all keys that matches the given pattern
* @link https://php.net/manual/en/function.gnupg-keyinfo.php
* @phpstub
*
* @param string $pattern
*
* @return array Returns an array with information about all keys that matches the given
* pattern or false, if an error has occurred.
*/
function keyinfo($pattern)
{
}
/**
* Toggle armored output
* @link https://php.net/manual/en/function.gnupg-setarmor.php
* @phpstub
*
* @param int $armor
*
* @return bool
*/
function setarmor($armor)
{
}
/**
* Sets the mode for error_reporting
* @link https://php.net/manual/en/function.gnupg-seterrormode.php
* @phpstub
*
* @param int $errormode
*
* @return void
*/
function seterrormode($errormode)
{
}
/**
* Sets the mode for signing
* @link https://php.net/manual/en/function.gnupg-setsignmode.php
* @phpstub
*
* @param int $signmode
*
* @return bool
*/
function setsignmode($signmode)
{
}
/**
* Signs a given text
* @link https://php.net/manual/en/function.gnupg-sign.php
* @phpstub
*
* @param string $plaintext
*
* @return string|false On success, this function returns the signed text or the signature.
* On failure, this function returns false.
*/
function sign($plaintext)
{
}
}