class Sodium::CryptoBox

Overview

Use Sodium::CryptoBox::SecretKey#box

Included Modules

Defined in:

sodium/crypto_box.cr
sodium/crypto_box/public_key.cr
sodium/crypto_box/secret_key.cr

Constant Summary

MAC_SIZE = LibSodium.crypto_box_macbytes.to_i

Instance Method Summary

Instance methods inherited from module Sodium::Wipe

close close, finalize finalize

Instance Method Detail

def decrypt(src : Bytes, dst = Bytes.new(src.bytesize - MAC_SIZE), nonce = Nonce.random) : Bytes #

Returns decrypted message.

Optionally supply a destination buffer.


[View source]
def decrypt(src) #

Returns decrypted message.


[View source]
def encrypt(src : Bytes, dst = Bytes.new(src.bytesize + MAC_SIZE), nonce = Nonce.random) : Tuple(Bytes, Nonce) #

Encrypts data and returns {ciphertext, nonce}

Optionally supply a destination buffer.


[View source]
def encrypt(src) #

Encrypts data and returns {ciphertext, nonce}


[View source]