class Nanvault::Crypto
- Nanvault::Crypto
- Reference
- Object
Overview
Crypto class
Defined in:
nanvault.crConstant Summary
-
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 Method Summary
-
.check_hmac(data, key, exp_hmac)
class method to check HMAC
-
.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
-
.genpass
class method to generate a random, safe password
-
.get_keys_iv(salt, password)
class method to get cipher key, HMAC key and cipher IV
Macro Summary
-
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
Class Method Detail
def self.decrypt(cipher_iv, cipher_key, ciphertext, algorithm = CIPHER_ALG_DEFAULT)
#
class method to decrypt ciphertext
def self.encrypt(cipher_iv, cipher_key, plaintext, algorithm = CIPHER_ALG_DEFAULT)
#
class method to encrypt plaintext
Macro Detail
macro 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