Module: Encrypto

Defined in:
lib/encrypto/box.rb,
lib/encrypto/keys.rb,
lib/encrypto/random.rb,
lib/encrypto/version.rb,
lib/encrypto/encrypto.rb,
lib/encrypto/database/encryptor.rb,
lib/encrypto/database/attr_encrypted.rb

Defined Under Namespace

Modules: Database, Keys, Random Classes: Box

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.decrypt_with_keypair(cipher_text, signing_public_key, private_key) ⇒ Object



23
24
25
# File 'lib/encrypto/encrypto.rb', line 23

def self.decrypt_with_keypair(cipher_text, signing_public_key, private_key)
  keypair_box(signing_public_key, private_key).open(cipher_text)
end

.decrypt_with_passphrase(cipher_text, passphrase) ⇒ Object



15
16
17
# File 'lib/encrypto/encrypto.rb', line 15

def self.decrypt_with_passphrase(cipher_text, passphrase)
  passphrase_box(passphrase).open(cipher_text)
end

.encrypt_with_keypair(value, public_key, signing_private_key) ⇒ Object



19
20
21
# File 'lib/encrypto/encrypto.rb', line 19

def self.encrypt_with_keypair(value, public_key, signing_private_key)
  keypair_box(public_key, signing_private_key).box(value)
end

.encrypt_with_passphrase(value, passphrase) ⇒ Object



11
12
13
# File 'lib/encrypto/encrypto.rb', line 11

def self.encrypt_with_passphrase(value, passphrase)
  passphrase_box(passphrase).box(value)
end

.generate_keypairObject



3
4
5
# File 'lib/encrypto/encrypto.rb', line 3

def self.generate_keypair
  Keys.generate_keypair
end

.generate_random_keyObject



7
8
9
# File 'lib/encrypto/encrypto.rb', line 7

def self.generate_random_key
  Random.bytes
end