updraftplus
Last commit date
central
5 years ago
css
5 years ago
images
5 years ago
includes
5 years ago
js
5 years ago
languages
5 years ago
methods
5 years ago
templates
5 years ago
vendor
5 years ago
admin.php
5 years ago
backup.php
5 years ago
changelog.txt
7 years ago
class-updraftplus.php
5 years ago
example-decrypt.php
8 years ago
index.html
6 years ago
options.php
5 years ago
readme.txt
5 years ago
restorer.php
5 years ago
updraftplus.php
5 years ago
example-decrypt.php
44 lines
| 1 | <?php |
| 2 | // @codingStandardsIgnoreStart |
| 3 | /* |
| 4 | To dump the decrypted file using the given key on stdout, call: |
| 5 | |
| 6 | rijndael_decrypt_file('../path/to/file.crypt' , 'mykey'); |
| 7 | |
| 8 | Thus, here are the easy instructions: |
| 9 | |
| 10 | 1) Add a line like the above into this PHP file (not inside these comments, but outside) |
| 11 | e.g. |
| 12 | rijndael_decrypt_file('/home/myself/myfile.crypt' , 'MYKEY'); |
| 13 | |
| 14 | 2) Run this file (and make sure that includes/Rijndael.php is available, if you are moving this file around) |
| 15 | e.g. |
| 16 | php /home/myself/example-decrypt.php >output.sql.gz |
| 17 | |
| 18 | 3) You may then want to gunzip the resulting file to have a standard SQL file. |
| 19 | e.g. |
| 20 | gunzip output.sql.gz |
| 21 | |
| 22 | */ |
| 23 | // @codingStandardsIgnoreEnd |
| 24 | |
| 25 | /** |
| 26 | * An example of how to decrypt a file |
| 27 | * |
| 28 | * @param String $file Full path to file to decrypt |
| 29 | * @param String $key Key or salting to be used |
| 30 | */ |
| 31 | function rijndael_decrypt_file($file, $key) { |
| 32 | |
| 33 | include_once(dirname(__FILE__).'/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php'); |
| 34 | |
| 35 | $rijndael = new Crypt_Rijndael(); |
| 36 | |
| 37 | $rijndael->setKey($key); |
| 38 | |
| 39 | $ciphertext = file_get_contents($file); |
| 40 | |
| 41 | print $rijndael->decrypt($ciphertext); |
| 42 | |
| 43 | } |
| 44 |