Asymmetric crypt algorithm (gnupg)

Categories

Component ID

2420589

Component name

Asymmetric crypt algorithm (gnupg)

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1443

Component created

Component changed

Component body

This project aims to provide simple encryption method for using asymmetric gnupg (pgp) crypt algorithm.
The idea behind this is to have a way for encrypting data by using public key without even possibility to decrypt it on server side, because there is no private key within a server's filesystem at all.

How to use this module:

Use admin/config/system/gpg_acrypt for adding your public key.

There is only one function

function acrypt_gpg_encrypt($src_filename, $dest_filename = NULL, $gpg_pub_key = NULL);

that can be used as

$source_file = 'private://webform_export_471.csv';
$encrypted_file = 'public://webform_export_471.csv.gpg';

$status = acrypt_gpg_encrypt($source_file, $encrypted_file);

if ($status) {
  // Removing source file for security.
  unlink($source_file);
}

You can check encrypted file at $encrypted_file path

PS. For decryption you can use console gpg app

gpg --output webform_export_471.csv --decrypt webform_export_471.csv.gpg
where decrypted data will be saved to webform_export_471.csv file.

Tip - do not decrypt files on the same server where you were encrypted them. Unfortunately there is a chance you forget about removing private key, adding security hole as well.