forked from HvyIndustries/crane-php-stubs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
openssl.php
1181 lines (1112 loc) · 41.1 KB
/
openssl.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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// Start of openssl v.7.0.4-7ubuntu2
/**
* (PHP 5 >= 5.6.0, PHP 7)<br/>
* Retrieve the available certificate locations
* @link http://php.net/manual/en/function.openssl-get-cert-locations.php
* @return array an array with the available certificate locations.
*/
function openssl_get_cert_locations(): array {}
/**
* (PHP 5 >= 5.6.0, PHP 7)<br/>
* Generate a new signed public key and challenge
* @link http://php.net/manual/en/function.openssl-spki-new.php
* @param $privkey
* @param $challenge
* @param $algo [optional]
* @return mixed a signed public key and challenge string or NULL on failure.
*/
function openssl_spki_new($privkey, $challenge, $algo) {}
/**
* (PHP 5 >= 5.6.0, PHP 7)<br/>
* Verifies a signed public key and challenge
* @link http://php.net/manual/en/function.openssl-spki-verify.php
* @param $spki
* @return mixed a boolean on success or failure.
*/
function openssl_spki_verify($spki) {}
/**
* (PHP 5 >= 5.6.0, PHP 7)<br/>
* Exports a valid PEM formatted public key signed public key and challenge
* @link http://php.net/manual/en/function.openssl-spki-export.php
* @param $spki
* @return mixed the associated PEM formatted public key or NULL on failure.
*/
function openssl_spki_export($spki) {}
/**
* (PHP 5 >= 5.6.0, PHP 7)<br/>
* Exports the challenge assoicated with a signed public key and challenge
* @link http://php.net/manual/en/function.openssl-spki-export-challenge.php
* @param $spki
* @return mixed the associated challenge string or NULL on failure.
*/
function openssl_spki_export_challenge($spki) {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Frees a private key
* @link http://php.net/manual/en/function.openssl-pkey-free.php
* @param resource $key <p>
* Resource holding the key.
* </p>
* @return void No value is returned.
*/
function openssl_pkey_free($key) {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Generates a new private key
* @link http://php.net/manual/en/function.openssl-pkey-new.php
* @param array $configargs [optional] <p>
* You can finetune the key generation (such as specifying the number of
* bits) using <i>configargs</i>. See
* <b>openssl_csr_new</b> for more information about
* <i>configargs</i>.
* </p>
* @return resource a resource identifier for the pkey on success, or <b>FALSE</b> on
* error.
*/
function openssl_pkey_new(array $configargs = null) {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Gets an exportable representation of a key into a string
* @link http://php.net/manual/en/function.openssl-pkey-export.php
* @param mixed $key
* @param string $out
* @param string $passphrase [optional] <p>
* The key is optionally protected by <i>passphrase</i>.
* </p>
* @param array $configargs [optional] <p>
* <i>configargs</i> can be used to fine-tune the export
* process by specifying and/or overriding options for the openssl
* configuration file. See <b>openssl_csr_new</b> for more
* information about <i>configargs</i>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_pkey_export($key, string &$out, string $passphrase = null, array $configargs = null): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Gets an exportable representation of a key into a file
* @link http://php.net/manual/en/function.openssl-pkey-export-to-file.php
* @param mixed $key
* @param string $outfilename <p>
* Path to the output file.
* </p>
* @param string $passphrase [optional] <p>
* The key can be optionally protected by a
* <i>passphrase</i>.
* </p>
* @param array $configargs [optional] <p>
* <i>configargs</i> can be used to fine-tune the export
* process by specifying and/or overriding options for the openssl
* configuration file. See <b>openssl_csr_new</b> for more
* information about <i>configargs</i>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_pkey_export_to_file($key, string $outfilename, string $passphrase = null, array $configargs = null): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Get a private key
* @link http://php.net/manual/en/function.openssl-pkey-get-private.php
* @param mixed $key <p>
* <i>key</i> can be one of the following:
* a string having the format
* file://path/to/file.pem. The named file must
* contain a PEM encoded certificate/private key (it may contain both).
* @param string $passphrase [optional] <p>
* The optional parameter <i>passphrase</i> must be used
* if the specified key is encrypted (protected by a passphrase).
* </p>
* @return resource a positive key resource identifier on success, or <b>FALSE</b> on error.
*/
function openssl_pkey_get_private($key, string $passphrase = "") {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Extract public key from certificate and prepare it for use
* @link http://php.net/manual/en/function.openssl-pkey-get-public.php
* @param mixed $certificate <p>
* <i>certificate</i> can be one of the following:
* an X.509 certificate resource
* @return resource a positive key resource identifier on success, or <b>FALSE</b> on error.
*/
function openssl_pkey_get_public($certificate) {}
/**
* (PHP 5 >= 5.2.0, PHP 7)<br/>
* Returns an array with the key details
* @link http://php.net/manual/en/function.openssl-pkey-get-details.php
* @param resource $key <p>
* Resource holding the key.
* </p>
* @return array an array with the key details in success or <b>FALSE</b> in failure.
* Returned array has indexes bits (number of bits),
* key (string representation of the public key) and
* type (type of the key which is one of
* <b>OPENSSL_KEYTYPE_RSA</b>,
* <b>OPENSSL_KEYTYPE_DSA</b>,
* <b>OPENSSL_KEYTYPE_DH</b>,
* <b>OPENSSL_KEYTYPE_EC</b> or -1 meaning unknown).
* </p>
* <p>
* Depending on the key type used, additional details may be returned. Note that
* some elements may not always be available.
*/
function openssl_pkey_get_details($key): array {}
/**
* (PHP 4 >= 4.0.4, PHP 5, PHP 7)<br/>
* Free key resource
* @link http://php.net/manual/en/function.openssl-free-key.php
* @param resource $key_identifier
* @return void No value is returned.
*/
function openssl_free_key($key_identifier) {}
/**
* (PHP 4 >= 4.0.4, PHP 5, PHP 7)<br/>
* Alias of <b>openssl_pkey_get_private</b>
* @link http://php.net/manual/en/function.openssl-get-privatekey.php
* @param $key
* @param $passphrase [optional]
*/
function openssl_get_privatekey($key, $passphrase) {}
/**
* (PHP 4 >= 4.0.4, PHP 5, PHP 7)<br/>
* Alias of <b>openssl_pkey_get_public</b>
* @link http://php.net/manual/en/function.openssl-get-publickey.php
* @param $cert
*/
function openssl_get_publickey($cert) {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Parse an X.509 certificate and return a resource identifier for
it
* @link http://php.net/manual/en/function.openssl-x509-read.php
* @param mixed $x509certdata
* @return resource a resource identifier on success or <b>FALSE</b> on failure.
*/
function openssl_x509_read($x509certdata) {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Free certificate resource
* @link http://php.net/manual/en/function.openssl-x509-free.php
* @param resource $x509cert
* @return void No value is returned.
*/
function openssl_x509_free($x509cert) {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Parse an X509 certificate and return the information as an array
* @link http://php.net/manual/en/function.openssl-x509-parse.php
* @param mixed $x509cert
* @param bool $shortnames [optional] <p>
* <i>shortnames</i> controls how the data is indexed in the
* array - if <i>shortnames</i> is <b>TRUE</b> (the default) then
* fields will be indexed with the short name form, otherwise, the long name
* form will be used - e.g.: CN is the shortname form of commonName.
* </p>
* @return array The structure of the returned data is (deliberately) not
* yet documented, as it is still subject to change.
*/
function openssl_x509_parse($x509cert, bool $shortnames = true): array {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Verifies if a certificate can be used for a particular purpose
* @link http://php.net/manual/en/function.openssl-x509-checkpurpose.php
* @param mixed $x509cert <p>
* The examined certificate.
* </p>
* @param int $purpose <p>
* <table>
* <b>openssl_x509_checkpurpose</b> purposes
* <tr valign="top">
* <td>Constant</td>
* <td>Description</td>
* </tr>
* <tr valign="top">
* <td>X509_PURPOSE_SSL_CLIENT</td>
* <td>Can the certificate be used for the client side of an SSL
* connection?</td>
* </tr>
* <tr valign="top">
* <td>X509_PURPOSE_SSL_SERVER</td>
* <td>Can the certificate be used for the server side of an SSL
* connection?</td>
* </tr>
* <tr valign="top">
* <td>X509_PURPOSE_NS_SSL_SERVER</td>
* <td>Can the cert be used for Netscape SSL server?</td>
* </tr>
* <tr valign="top">
* <td>X509_PURPOSE_SMIME_SIGN</td>
* <td>Can the cert be used to sign S/MIME email?</td>
* </tr>
* <tr valign="top">
* <td>X509_PURPOSE_SMIME_ENCRYPT</td>
* <td>Can the cert be used to encrypt S/MIME email?</td>
* </tr>
* <tr valign="top">
* <td>X509_PURPOSE_CRL_SIGN</td>
* <td>Can the cert be used to sign a certificate revocation list
* (CRL)?</td>
* </tr>
* <tr valign="top">
* <td>X509_PURPOSE_ANY</td>
* <td>Can the cert be used for Any/All purposes?</td>
* </tr>
* </table>
* These options are not bitfields - you may specify one only!
* </p>
* @param array $cainfo [optional] <p>
* <i>cainfo</i> should be an array of trusted CA files/dirs
* as described in Certificate
* Verification.
* </p>
* @param string $untrustedfile [optional] <p>
* If specified, this should be the name of a PEM encoded file holding
* certificates that can be used to help verify the certificate, although
* no trust is placed in the certificates that come from that file.
* </p>
* @return int <b>TRUE</b> if the certificate can be used for the intended purpose,
* <b>FALSE</b> if it cannot, or -1 on error.
*/
function openssl_x509_checkpurpose($x509cert, int $purpose, array $cainfo = array(), string $untrustedfile = null): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Checks if a private key corresponds to a certificate
* @link http://php.net/manual/en/function.openssl-x509-check-private-key.php
* @param mixed $cert <p>
* The certificate.
* </p>
* @param mixed $key <p>
* The private key.
* </p>
* @return bool <b>TRUE</b> if <i>key</i> is the private key that
* corresponds to <i>cert</i>, or <b>FALSE</b> otherwise.
*/
function openssl_x509_check_private_key($cert, $key): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Exports a certificate as a string
* @link http://php.net/manual/en/function.openssl-x509-export.php
* @param mixed $x509
* @param string $output <p>
* On success, this will hold the PEM.
* </p>
* @param bool $notext [optional] The optional parameter <i>notext</i> affects
* the verbosity of the output; if it is <b>FALSE</b>, then additional human-readable
* information is included in the output. The default value of
* <i>notext</i> is <b>TRUE</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_x509_export($x509, string &$output, bool $notext = true): bool {}
/**
* (PHP 5.6, PHP 7)<br/>
* Calculates the fingerprint, or digest, of a given X.509 certificate
* @link http://php.net/manual/en/function.openssl-x509-fingerprint.php
* @param mixed $x509
* @param string $hash_algorithm [optional] <p>
* The hash algorithm to use, e.g. "md5" or "sha1"
* </p>
* @param bool $raw_output [optional] <p>
* When set to <b>TRUE</b>, outputs raw binary data. <b>FALSE</b> outputs lowercase hexits.
* </p>
* @return bool a string containing the calculated certificate fingerprint as lowercase hexits unless <i>raw_output</i> is set to <b>TRUE</b> in which case the raw binary representation of the message digest is returned.
* </p>
* <p>
* Returns <b>FALSE</b> on failure.
*/
function openssl_x509_fingerprint($x509, string $hash_algorithm = "sha1", bool $raw_output = false): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Exports a certificate to file
* @link http://php.net/manual/en/function.openssl-x509-export-to-file.php
* @param mixed $x509
* @param string $outfilename <p>
* Path to the output file.
* </p>
* @param bool $notext [optional] The optional parameter <i>notext</i> affects
* the verbosity of the output; if it is <b>FALSE</b>, then additional human-readable
* information is included in the output. The default value of
* <i>notext</i> is <b>TRUE</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_x509_export_to_file($x509, string $outfilename, bool $notext = true): bool {}
/**
* (PHP 5 >= 5.2.2, PHP 7)<br/>
* Exports a PKCS#12 Compatible Certificate Store File to variable.
* @link http://php.net/manual/en/function.openssl-pkcs12-export.php
* @param mixed $x509
* @param string $out <p>
* On success, this will hold the PKCS#12.
* </p>
* @param mixed $priv_key <p>
* Private key component of PKCS#12 file.
* </p>
* @param string $pass <p>
* Encryption password for unlocking the PKCS#12 file.
* </p>
* @param array $args [optional]
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_pkcs12_export($x509, string &$out, $priv_key, string $pass, array $args = null): bool {}
/**
* (PHP 5 >= 5.2.2, PHP 7)<br/>
* Exports a PKCS#12 Compatible Certificate Store File
* @link http://php.net/manual/en/function.openssl-pkcs12-export-to-file.php
* @param mixed $x509
* @param string $filename <p>
* Path to the output file.
* </p>
* @param mixed $priv_key <p>
* Private key component of PKCS#12 file.
* </p>
* @param string $pass <p>
* Encryption password for unlocking the PKCS#12 file.
* </p>
* @param array $args [optional]
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_pkcs12_export_to_file($x509, string $filename, $priv_key, string $pass, array $args = null): bool {}
/**
* (PHP 5 >= 5.2.2, PHP 7)<br/>
* Parse a PKCS#12 Certificate Store into an array
* @link http://php.net/manual/en/function.openssl-pkcs12-read.php
* @param string $pkcs12 <p>
* The certificate store contents, not its file name.
* </p>
* @param array $certs <p>
* On success, this will hold the Certificate Store Data.
* </p>
* @param string $pass <p>
* Encryption password for unlocking the PKCS#12 file.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_pkcs12_read(string $pkcs12, array &$certs, string $pass): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Generates a CSR
* @link http://php.net/manual/en/function.openssl-csr-new.php
* @param array $dn <p>
* The Distinguished Name to be used in the certificate.
* </p>
* @param resource $privkey <p>
* <i>privkey</i> should be set to a private key that was
* previously generated by <b>openssl_pkey_new</b> (or
* otherwise obtained from the other openssl_pkey family of functions).
* The corresponding public portion of the key will be used to sign the
* CSR.
* </p>
* @param array $configargs [optional] <p>
* By default, the information in your system openssl.conf
* is used to initialize the request; you can specify a configuration file
* section by setting the config_section_section key of
* <i>configargs</i>. You can also specify an alternative
* openssl configuration file by setting the value of the
* config key to the path of the file you want to use.
* The following keys, if present in <i>configargs</i>
* behave as their equivalents in the openssl.conf, as
* listed in the table below.
* <table>
* Configuration overrides
* <tr valign="top">
* <td><i>configargs</i> key</td>
* <td>type</td>
* <td>openssl.conf equivalent</td>
* <td>description</td>
* </tr>
* <tr valign="top">
* <td>digest_alg</td>
* <td>string</td>
* <td>default_md</td>
* <td>Selects which digest method to use</td>
* </tr>
* <tr valign="top">
* <td>x509_extensions</td>
* <td>string</td>
* <td>x509_extensions</td>
* <td>Selects which extensions should be used when creating an x509
* certificate</td>
* </tr>
* <tr valign="top">
* <td>req_extensions</td>
* <td>string</td>
* <td>req_extensions</td>
* <td>Selects which extensions should be used when creating a CSR</td>
* </tr>
* <tr valign="top">
* <td>private_key_bits</td>
* <td>integer</td>
* <td>default_bits</td>
* <td>Specifies how many bits should be used to generate a private
* key</td>
* </tr>
* <tr valign="top">
* <td>private_key_type</td>
* <td>integer</td>
* <td>none</td>
* <td>Specifies the type of private key to create. This can be one
* of <b>OPENSSL_KEYTYPE_DSA</b>,
* <b>OPENSSL_KEYTYPE_DH</b> or
* <b>OPENSSL_KEYTYPE_RSA</b>.
* The default value is <b>OPENSSL_KEYTYPE_RSA</b> which
* is currently the only supported key type.
* </td>
* </tr>
* <tr valign="top">
* <td>encrypt_key</td>
* <td>boolean</td>
* <td>encrypt_key</td>
* <td>Should an exported key (with passphrase) be encrypted?</td>
* </tr>
* <tr valign="top">
* <td>encrypt_key_cipher</td>
* <td>integer</td>
* <td>none</td>
* <td>
* One of cipher constants.
* </td>
* </tr>
* </table>
* </p>
* @param array $extraattribs [optional] <p>
* <i>extraattribs</i> is used to specify additional
* configuration options for the CSR. Both <i>dn</i> and
* <i>extraattribs</i> are associative arrays whose keys are
* converted to OIDs and applied to the relevant part of the request.
* </p>
* @return mixed the CSR.
*/
function openssl_csr_new(array $dn, &$privkey, array $configargs = null, array $extraattribs = null) {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Exports a CSR as a string
* @link http://php.net/manual/en/function.openssl-csr-export.php
* @param resource $csr
* @param string $out
* @param bool $notext [optional] The optional parameter <i>notext</i> affects
* the verbosity of the output; if it is <b>FALSE</b>, then additional human-readable
* information is included in the output. The default value of
* <i>notext</i> is <b>TRUE</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_csr_export($csr, string &$out, bool $notext = true): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Exports a CSR to a file
* @link http://php.net/manual/en/function.openssl-csr-export-to-file.php
* @param resource $csr
* @param string $outfilename <p>
* Path to the output file.
* </p>
* @param bool $notext [optional] The optional parameter <i>notext</i> affects
* the verbosity of the output; if it is <b>FALSE</b>, then additional human-readable
* information is included in the output. The default value of
* <i>notext</i> is <b>TRUE</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_csr_export_to_file($csr, string $outfilename, bool $notext = true): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Sign a CSR with another certificate (or itself) and generate a certificate
* @link http://php.net/manual/en/function.openssl-csr-sign.php
* @param mixed $csr <p>
* A CSR previously generated by <b>openssl_csr_new</b>.
* It can also be the path to a PEM encoded CSR when specified as
* file://path/to/csr or an exported string generated
* by <b>openssl_csr_export</b>.
* </p>
* @param mixed $cacert <p>
* The generated certificate will be signed by <i>cacert</i>.
* If <i>cacert</i> is <b>NULL</b>, the generated certificate
* will be a self-signed certificate.
* </p>
* @param mixed $priv_key <p>
* <i>priv_key</i> is the private key that corresponds to
* <i>cacert</i>.
* </p>
* @param int $days <p>
* <i>days</i> specifies the length of time for which the
* generated certificate will be valid, in days.
* </p>
* @param array $configargs [optional] <p>
* You can finetune the CSR signing by <i>configargs</i>.
* See <b>openssl_csr_new</b> for more information about
* <i>configargs</i>.
* </p>
* @param int $serial [optional] <p>
* An optional the serial number of issued certificate. If not specified
* it will default to 0.
* </p>
* @return resource an x509 certificate resource on success, <b>FALSE</b> on failure.
*/
function openssl_csr_sign($csr, $cacert, $priv_key, int $days, array $configargs = null, int $serial = 0) {}
/**
* (PHP 5 >= 5.2.0, PHP 7)<br/>
* Returns the subject of a CERT
* @link http://php.net/manual/en/function.openssl-csr-get-subject.php
* @param mixed $csr
* @param bool $use_shortnames [optional]
* @return array
*/
function openssl_csr_get_subject($csr, bool $use_shortnames = true): array {}
/**
* (PHP 5 >= 5.2.0, PHP 7)<br/>
* Returns the public key of a CERT
* @link http://php.net/manual/en/function.openssl-csr-get-public-key.php
* @param mixed $csr
* @param bool $use_shortnames [optional]
* @return resource
*/
function openssl_csr_get_public_key($csr, bool $use_shortnames = true) {}
/**
* (PHP 5 >= 5.3.0, PHP 7)<br/>
* Computes a digest
* @link http://php.net/manual/en/function.openssl-digest.php
* @param string $data <p>
* The data.
* </p>
* @param string $method <p>
* The digest method.
* </p>
* @param bool $raw_output [optional] <p>
* Setting to <b>TRUE</b> will return as raw output data, otherwise the return
* value is binhex encoded.
* </p>
* @return string the digested hash value on success or <b>FALSE</b> on failure.
*/
function openssl_digest(string $data, string $method, bool $raw_output = false): string {}
/**
* (PHP 5 >= 5.3.0, PHP 7)<br/>
* Encrypts data
* @link http://php.net/manual/en/function.openssl-encrypt.php
* @param string $data <p>
* The data.
* </p>
* @param string $method <p>
* The cipher method. For a list of available cipher methods, use <b>openssl_get_cipher_methods</b>.
* </p>
* @param string $password <p>
* The password.
* </p>
* @param int $options [optional] <p>
* <i>options</i> can be one of
* <b>OPENSSL_RAW_DATA</b>,
* <b>OPENSSL_ZERO_PADDING</b>.
* </p>
* @param string $iv [optional] <p>
* A non-NULL Initialization Vector.
* </p>
* @return string the encrypted string on success or <b>FALSE</b> on failure.
*/
function openssl_encrypt(string $data, string $method, string $password, int $options = 0, string $iv = ""): string {}
/**
* (PHP 5 >= 5.3.0, PHP 7)<br/>
* Decrypts data
* @link http://php.net/manual/en/function.openssl-decrypt.php
* @param string $data <p>
* The data.
* </p>
* @param string $method <p>
* The cipher method.
* </p>
* @param string $password <p>
* The password.
* </p>
* @param int $options [optional] <p>
* <i>options</i> can be one of
* <b>OPENSSL_RAW_DATA</b>,
* <b>OPENSSL_ZERO_PADDING</b>.
* </p>
* @param string $iv [optional] <p>
* A non-NULL Initialization Vector.
* </p>
* @return string The decrypted string on success or <b>FALSE</b> on failure.
*/
function openssl_decrypt(string $data, string $method, string $password, int $options = 0, string $iv = ""): string {}
/**
* (PHP 5 >= PHP 5.3.3, PHP 7)<br/>
* Gets the cipher iv length
* @link http://php.net/manual/en/function.openssl-cipher-iv-length.php
* @param string $method <p>
* The cipher method, see <b>openssl_get_cipher_methods</b> for a list of potential values.
* </p>
* @return int the cipher length on success, or <b>FALSE</b> on failure.
*/
function openssl_cipher_iv_length(string $method): int {}
/**
* (PHP 4 >= 4.0.4, PHP 5, PHP 7)<br/>
* Generate signature
* @link http://php.net/manual/en/function.openssl-sign.php
* @param string $data <p>
* The string of data you wish to sign
* </p>
* @param string $signature <p>
* If the call was successful the signature is returned in
* <i>signature</i>.
* </p>
* @param mixed $priv_key_id <p>
* resource - a key, returned by <b>openssl_get_privatekey</b>
* </p>
* <p>
* string - a PEM formatted key
* </p>
* @param mixed $signature_alg [optional] <p>
* int - one of these Signature Algorithms.
* </p>
* <p>
* string - a valid string returned by <b>openssl_get_md_methods</b> example, "sha256WithRSAEncryption" or "sha384".
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_sign(string $data, string &$signature, $priv_key_id, $signature_alg = OPENSSL_ALGO_SHA1): bool {}
/**
* (PHP 4 >= 4.0.4, PHP 5, PHP 7)<br/>
* Verify signature
* @link http://php.net/manual/en/function.openssl-verify.php
* @param string $data <p>
* The string of data used to generate the signature previously
* </p>
* @param string $signature <p>
* A raw binary string, generated by <b>openssl_sign</b> or similar means
* </p>
* @param mixed $pub_key_id <p>
* resource - a key, returned by <b>openssl_get_publickey</b>
* </p>
* <p>
* string - a PEM formatted key, example, "-----BEGIN PUBLIC KEY-----
* MIIBCgK..."
* </p>
* @param mixed $signature_alg [optional] <p>
* int - one of these Signature Algorithms.
* </p>
* <p>
* string - a valid string returned by <b>openssl_get_md_methods</b> example, "sha1WithRSAEncryption" or "sha512".
* </p>
* @return int 1 if the signature is correct, 0 if it is incorrect, and
* -1 on error.
*/
function openssl_verify(string $data, string $signature, $pub_key_id, $signature_alg = OPENSSL_ALGO_SHA1): int {}
/**
* (PHP 4 >= 4.0.4, PHP 5, PHP 7)<br/>
* Seal (encrypt) data
* @link http://php.net/manual/en/function.openssl-seal.php
* @param string $data <p>
* The data to seal.
* </p>
* @param string $sealed_data <p>
* The sealed data.
* </p>
* @param array $env_keys <p>
* Array of encrypted keys.
* </p>
* @param array $pub_key_ids <p>
* Array of public key resource identifiers.
* </p>
* @param string $method [optional] <p>
* The cipher method.
* </p>
* @return int the length of the sealed data on success, or <b>FALSE</b> on error.
* If successful the sealed data is returned in
* <i>sealed_data</i>, and the envelope keys in
* <i>env_keys</i>.
*/
function openssl_seal(string $data, string &$sealed_data, array &$env_keys, array $pub_key_ids, string $method = "RC4"): int {}
/**
* (PHP 4 >= 4.0.4, PHP 5, PHP 7)<br/>
* Open sealed data
* @link http://php.net/manual/en/function.openssl-open.php
* @param string $sealed_data
* @param string $open_data <p>
* If the call is successful the opened data is returned in this
* parameter.
* </p>
* @param string $env_key
* @param mixed $priv_key_id
* @param string $method [optional]
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_open(string $sealed_data, string &$open_data, string $env_key, $priv_key_id, string $method = null): bool {}
/**
* (PHP 5 >= 5.5.0, PHP 7)<br/>
* Generates a PKCS5 v2 PBKDF2 string, defaults to SHA-1
* @link http://php.net/manual/en/function.openssl-pbkdf2.php
* @param string $password <p>
* </p>
* @param string $salt <p>
* </p>
* @param int $key_length <p>
* </p>
* @param int $iterations <p>
* </p>
* @param string $digest_algorithm [optional] <p>
* </p>
* @return string string or <b>FALSE</b> on failure.
*/
function openssl_pbkdf2(string $password, string $salt, int $key_length, int $iterations, string $digest_algorithm = null): string {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Verifies the signature of an S/MIME signed message
* @link http://php.net/manual/en/function.openssl-pkcs7-verify.php
* @param string $filename <p>
* Path to the message.
* </p>
* @param int $flags <p>
* <i>flags</i> can be used to affect how the signature is
* verified - see PKCS7 constants
* for more information.
* </p>
* @param string $outfilename [optional] <p>
* If the <i>outfilename</i> is specified, it should be a
* string holding the name of a file into which the certificates of the
* persons that signed the messages will be stored in PEM format.
* </p>
* @param array $cainfo [optional] <p>
* If the <i>cainfo</i> is specified, it should hold
* information about the trusted CA certificates to use in the verification
* process - see certificate
* verification for more information about this parameter.
* </p>
* @param string $extracerts [optional] <p>
* If the <i>extracerts</i> is specified, it is the filename
* of a file containing a bunch of certificates to use as untrusted CAs.
* </p>
* @param string $content [optional] <p>
* You can specify a filename with <i>content</i> that will
* be filled with the verified data, but with the signature information
* stripped.
* </p>
* @return mixed <b>TRUE</b> if the signature is verified, <b>FALSE</b> if it is not correct
* (the message has been tampered with, or the signing certificate is invalid),
* or -1 on error.
*/
function openssl_pkcs7_verify(string $filename, int $flags, string $outfilename = null, array $cainfo = null, string $extracerts = null, string $content = null) {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Decrypts an S/MIME encrypted message
* @link http://php.net/manual/en/function.openssl-pkcs7-decrypt.php
* @param string $infilename
* @param string $outfilename <p>
* The decrypted message is written to the file specified by
* <i>outfilename</i>.
* </p>
* @param mixed $recipcert
* @param mixed $recipkey [optional]
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_pkcs7_decrypt(string $infilename, string $outfilename, $recipcert, $recipkey = null): bool {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Sign an S/MIME message
* @link http://php.net/manual/en/function.openssl-pkcs7-sign.php
* @param string $infilename
* @param string $outfilename
* @param mixed $signcert
* @param mixed $privkey
* @param array $headers <p>
* <i>headers</i> is an array of headers that
* will be prepended to the data after it has been signed (see
* <b>openssl_pkcs7_encrypt</b> for more information about
* the format of this parameter).
* </p>
* @param int $flags [optional] <p>
* <i>flags</i> can be used to alter the output - see PKCS7 constants.
* </p>
* @param string $extracerts [optional] <p>
* <i>extracerts</i> specifies the name of a file containing
* a bunch of extra certificates to include in the signature which can for
* example be used to help the recipient to verify the certificate that you used.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_pkcs7_sign(string $infilename, string $outfilename, $signcert, $privkey, array $headers, int $flags = PKCS7_DETACHED, string $extracerts = null): bool {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Encrypt an S/MIME message
* @link http://php.net/manual/en/function.openssl-pkcs7-encrypt.php
* @param string $infile
* @param string $outfile
* @param mixed $recipcerts <p>
* Either a lone X.509 certificate, or an array of X.509 certificates.
* </p>
* @param array $headers <p>
* <i>headers</i> is an array of headers that
* will be prepended to the data after it has been encrypted.
* </p>
* <p>
* <i>headers</i> can be either an associative array
* keyed by header name, or an indexed array, where each element contains
* a single header line.
* </p>
* @param int $flags [optional] <p>
* <i>flags</i> can be used to specify options that affect
* the encoding process - see PKCS7
* constants.
* </p>
* @param int $cipherid [optional] <p>
* One of cipher constants.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_pkcs7_encrypt(string $infile, string $outfile, $recipcerts, array $headers, int $flags = 0, int $cipherid = OPENSSL_CIPHER_RC2_40): bool {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Encrypts data with private key
* @link http://php.net/manual/en/function.openssl-private-encrypt.php
* @param string $data
* @param string $crypted
* @param mixed $key
* @param int $padding [optional] <p>
* <i>padding</i> can be one of
* <b>OPENSSL_PKCS1_PADDING</b>,
* <b>OPENSSL_NO_PADDING</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_private_encrypt(string $data, string &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Decrypts data with private key
* @link http://php.net/manual/en/function.openssl-private-decrypt.php
* @param string $data
* @param string $decrypted
* @param mixed $key <p>
* <i>key</i> must be the private key corresponding that
* was used to encrypt the data.
* </p>
* @param int $padding [optional] <p>
* <i>padding</i> can be one of
* <b>OPENSSL_PKCS1_PADDING</b>,
* <b>OPENSSL_SSLV23_PADDING</b>,
* <b>OPENSSL_PKCS1_OAEP_PADDING</b>,
* <b>OPENSSL_NO_PADDING</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_private_decrypt(string $data, string &$decrypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Encrypts data with public key
* @link http://php.net/manual/en/function.openssl-public-encrypt.php
* @param string $data
* @param string $crypted <p>
* This will hold the result of the encryption.
* </p>
* @param mixed $key <p>
* The public key.
* </p>
* @param int $padding [optional] <p>
* <i>padding</i> can be one of
* <b>OPENSSL_PKCS1_PADDING</b>,
* <b>OPENSSL_SSLV23_PADDING</b>,
* <b>OPENSSL_PKCS1_OAEP_PADDING</b>,
* <b>OPENSSL_NO_PADDING</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_public_encrypt(string $data, string &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {}
/**
* (PHP 4 >= 4.0.6, PHP 5, PHP 7)<br/>
* Decrypts data with public key
* @link http://php.net/manual/en/function.openssl-public-decrypt.php
* @param string $data
* @param string $decrypted
* @param mixed $key <p>
* <i>key</i> must be the public key corresponding that
* was used to encrypt the data.
* </p>
* @param int $padding [optional] <p>
* <i>padding</i> can be one of
* <b>OPENSSL_PKCS1_PADDING</b>,
* <b>OPENSSL_NO_PADDING</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function openssl_public_decrypt(string $data, string &$decrypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {}
/**
* (PHP 5 >= 5.3.0, PHP 7)<br/>
* Gets available digest methods
* @link http://php.net/manual/en/function.openssl-get-md-methods.php
* @param bool $aliases [optional] <p>
* Set to <b>TRUE</b> if digest aliases should be included within the
* returned array.
* </p>
* @return array An array of available digest methods.
*/
function openssl_get_md_methods(bool $aliases = false): array {}
/**
* (PHP 5 >= 5.3.0, PHP 7)<br/>
* Gets available cipher methods
* @link http://php.net/manual/en/function.openssl-get-cipher-methods.php
* @param bool $aliases [optional] <p>
* Set to <b>TRUE</b> if cipher aliases should be included within the
* returned array.
* </p>
* @return array An array of available cipher methods.
*/