lib/slosilo/key.rb in slosilo-0.2.2 vs lib/slosilo/key.rb in slosilo-0.2.3

- old
+ new

@@ -25,13 +25,23 @@ key = cipher.random_key ctxt = cipher.encrypt plaintext, key: key key = @key.public_encrypt key [ctxt, key] end + + def encrypt_message plaintext + c, k = encrypt plaintext + k + c + end def decrypt ciphertext, skey key = @key.private_decrypt skey cipher.decrypt ciphertext, key: key + end + + def decrypt_message ciphertext + k, c = ciphertext.unpack("A256A*") + decrypt c, k end def to_s @key.public_key.to_pem end