Nanvault::Crypto
Inherits Reference / Object
Crypto class
Constants
AES_BLOCK_SIZE = 16
CIPHER_ALG_DEFAULT = "aes-256-ctr"
HMAC_ALG = OpenSSL::Algorithm::SHA256
MAX_CHAR = 126
MIN_CHAR = 33
password generation constants alphabet is made up of chars corresponding to ints between these values
PBKDF2_ALG = OpenSSL::Algorithm::SHA256
PBKDF2_ITERATIONS = 10000
PBKDF2_KEY_SIZE = 80
Class methods
decrypt(cipher_iv, cipher_key, ciphertext, algorithm = CIPHER_ALG_DEFAULT)
class method to decrypt ciphertext
encrypt(cipher_iv, cipher_key, plaintext, algorithm = CIPHER_ALG_DEFAULT)
class method to encrypt plaintext
Macros
get_safe_pass_len(n)
get safe password length macro calculates password length to get at least n bit security NOTE: the "-1" is there because Random::Secure.rand(k) returns numbers from 0 to k-1