-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
24 lines (20 loc) · 801 Bytes
/
example.php
File metadata and controls
24 lines (20 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
/**
* @author Simon Formanek <mail at simonformanek.cz>
* @copyright (c) 2018, PureHTML
* @license https://opensource.org/licenses/MIT MIT
*/
namespace PureCRYPTO;
require_once 'vendor/autoload.php';
$adminCryptor = new Admin\SslCrypto();
$adminCryptor->createKey('password');
file_put_contents(__DIR__.'/tests/privateKey.asc',
$adminCryptor->getPrivateKey());
file_put_contents(__DIR__.'/tests/publicKey.txt', $adminCryptor->getPublicKey());
$cryptor = new SslCrypto();
$cryptor->setPassphrase('password');
$cryptor->setPrivateKey(file_get_contents(__DIR__.'/tests/privateKey.asc'));
$cryptor->setPublicKey(file_get_contents(__DIR__.'/tests/publicKey.txt'));
$encrypted = $cryptor->encrypt('example plaintext string');
$plaintext = $cryptor->decrypt($encrypted);
echo $plaintext;