Certencryption - Store strings encrypted.
This is a module which stores strings (like passwords, private keys, ...) in a secure way. Certencryption uses OpenSSL private key for encryption.
use Certencryption;
user "root";
password decrypt($encrypted_string);
To use this module you need a private key with which you can decrypt your data. You also need a public key with which you can encrypt your data.
To generate a public/private keypair you can use the provided generate_key task.
rex Certencryption:generate_key [--name=default [--size=4096]]
This will create a folder keys and place the two keyfiles in it.
To encrypt or decrypt strings you have to include the Certencryption module in your Rexfile.
use Certencryption;
key_file "keys/default";
user "root";
password decrypt($encrypted_string);
The key_file command tells the module which key file it should use for the decryption. To encrypt a string you also need to have a public key. In this example the public key should be found in keys/default.pub.
my $base64_encrypted_string = encrypt("this is secret");
To define which padding should be used, you can define this with the padding function. The default is pkcs1_oaep. Valid padding option are:
- pkcs1_oaep (default)
- pkcs1
- sslv23 (due to a bug, only for decryption)
Copyright 2015 FILIADATA GmbH
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.