| Class | MCollective::SSL |
| In: |
lib/mcollective/ssl.rb
|
| Parent: | Object |
A class that assists in encrypting and decrypting data using a combination of RSA and AES
Data will be AES encrypted for speed, the Key used in # the AES stage will be encrypted using RSA
ssl = SSL.new(public_key, private_key, passphrase)
data = File.read("largefile.dat")
crypted_data = ssl.encrypt_with_private(data)
pp crypted_data
This will result in a hash of data like:
crypted = {:key => "crd4NHvG....=",
:data => "XWXlqN+i...=="}
The key and data will all be base 64 encoded already by default you can pass a 2nd parameter as false to encrypt_with_private and counterparts that will prevent the base 64 encoding
You can pass the data hash into ssl.decrypt_with_public which should return your original data
There are matching methods for using a public key to encrypt data to be decrypted using a private key
| private_key_file | [R] | |
| public_key_file | [R] | |
| ssl_cipher | [R] |
Creates a RFC 4122 version 5 UUID. If string is supplied it will produce repeatable UUIDs for that string else a random 128bit string will be used from OpenSSL::BN
Code used with permission from:
https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/uuid.rb
Encrypts supplied data using AES and then encrypts using RSA the key and IV
Return a hash with everything optionally base 64 encoded
Encrypts supplied data using AES and then encrypts using RSA the key and IV
Return a hash with everything optionally base 64 encoded
Reads either a :public or :private key from disk, uses an optional passphrase to read the private key