Ravn::
Crypto module
Extended With |
|
A module containing Ravn
libsodium utility methods.
Constants
- BUFSIZE
File encryption is broken into chunks to conserve memory. This is the maximum buffer size. It should not be altered without serious consideration - past files won’t be readable.
- HEADERSIZE
The additional overhead for any encrypted ciphertext. (24 byte nonce plus a 16 byte authenticator).
Public Class Methods
Reset memoized values; primarily for testing.
Public Instance Methods
Create and return a new secret box with the private key.
Decrypt bytes
binary ciphertext, returning the original message. If a public_key
is given, decrypt the message from the key’s owner.
Decrypt an input
file of arbitrary size in a memory efficient fashion, writing it to output
. This expects 40 byte nonce and authenticator data for each BUFSIZE
iteration. input
and output
must be Pathname objects - the output will be overwritten.
Encrypt and return a simple message
string as binary ciphertext. If a public_key
is given, encrypt the message for that instead of the local key.
Encrypt an input
file of arbitrary size in a memory efficient fashion, writing it to output
stream. This writes a 40 byte nonce and authenticator data for each BUFSIZE
iteration. input
and output
must be Pathname objects - the output will be overwritten.
Return an instantiated RbNaCl::PrivateKey object read from disk. If a keyfile does not exist, generate a new one - this is primarily for development usage.
The key is stored in Base64 for easy visual comparison, and to mimic Wireguard display for private keys.
Return the RBNaCl::PublicKey side of the current key
.