@@ -41,6 +41,48 @@ function cleanArray($didYouMeans){
41
41
42
42
43
43
44
+ $ pub_key_file = __DIR__ . '' . \DIRECTORY_SEPARATOR . '.. ' . \DIRECTORY_SEPARATOR . '.api-keys ' . \DIRECTORY_SEPARATOR . 'pub.key ' ;
45
+ $ priv_key_file = __DIR__ . '' . \DIRECTORY_SEPARATOR . '.. ' . \DIRECTORY_SEPARATOR . '.api-keys ' . \DIRECTORY_SEPARATOR . 'priv.key ' ;
46
+
47
+ if (!is_dir (dirname ($ pub_key_file ))){
48
+ mkdir (dirname ($ pub_key_file ), 0755 , true );
49
+ }
50
+
51
+ if (!is_dir (dirname ($ priv_key_file ))){
52
+ mkdir (dirname ($ priv_key_file ), 0755 , true );
53
+ }
54
+
55
+ if (!file_exists ($ pub_key_file ) || !file_exists ($ priv_key_file ) ){
56
+ $ config = array (
57
+ "digest_alg " => "sha512 " ,
58
+ "private_key_bits " => 4096 ,
59
+ "private_key_type " => \OPENSSL_KEYTYPE_RSA ,
60
+ );
61
+
62
+ // Create the private and public key
63
+ $ res = openssl_pkey_new ($ config );
64
+
65
+ // Extract the private key from $res to $privKey
66
+ openssl_pkey_export ($ res , $ privKey );
67
+
68
+ // Extract the public key from $res to $pubKey
69
+ $ pubKey = openssl_pkey_get_details ($ res );
70
+ $ pubKey = $ pubKey ["key " ];
71
+
72
+
73
+ file_put_contents ($ pub_key_file , $ pubKey );
74
+ file_put_contents ($ priv_key_file , $ privKey );
75
+ //$data = 'plaintext data goes here';
76
+
77
+ // Encrypt the data to $encrypted using the public key
78
+ //openssl_public_encrypt($data, $encrypted, $pubKey);
79
+
80
+ // Decrypt the data using the private key and store the results in $decrypted
81
+ //openssl_private_decrypt($encrypted, $decrypted, $privKey);
82
+ }
83
+
84
+
85
+
44
86
$ per_page = 25 ;
45
87
46
88
$ someDirs =[
@@ -179,6 +221,10 @@ function cleanArray($didYouMeans){
179
221
$ code = (new \Nette \PhpGenerator \PsrPrinter )->printFile ($ FileAll );
180
222
181
223
224
+ $ code = false === strpos ($ code , base64_decode ('X19oYWx0X2NvbXBpbGVyKCk7 ' ))
225
+ ? $ loader ->sign ($ code , file_get_contents ($ priv_key_file ), 'X19oYWx0X2NvbXBpbGVyKCk7 ' )
226
+ : $ code ;
227
+
182
228
if ((isset ($ _SERVER ['HTTP_X_SOURCE_ENCODING ' ]) && 'b64 ' === $ _SERVER ['HTTP_X_SOURCE_ENCODING ' ])
183
229
||
184
230
(isset ($ _GET ['source-encoding ' ]) && 'b64 ' === $ _GET ['source-encoding ' ] )
@@ -267,6 +313,13 @@ function cleanArray($didYouMeans){
267
313
}
268
314
269
315
316
+
317
+ $ outPut = false === strpos ($ outPut , base64_decode ('X19oYWx0X2NvbXBpbGVyKCk7 ' ))
318
+ ? $ loader ->sign ($ outPut , file_get_contents ($ priv_key_file ), 'X19oYWx0X2NvbXBpbGVyKCk7 ' )
319
+ : $ outPut ;
320
+
321
+
322
+
270
323
if ((isset ($ _SERVER ['HTTP_X_SOURCE_ENCODING ' ]) && 'b64 ' === $ _SERVER ['HTTP_X_SOURCE_ENCODING ' ])
271
324
||
272
325
(isset ($ _GET ['source-encoding ' ]) && 'b64 ' === $ _GET ['source-encoding ' ] )
0 commit comments