chloride.lockbox

Undocumented in source.

Members

Aliases

LockBoxMacLength
alias LockBoxMacLength = crypto_box_MACBYTES
Undocumented in source.
LockBoxSeed
alias LockBoxSeed = ubyte[crypto_box_SEEDBYTES]
Undocumented in source.
Nonce
alias Nonce = ubyte[crypto_box_NONCEBYTES]
Undocumented in source.
PrivateKey
alias PrivateKey = ubyte[crypto_box_SECRETKEYBYTES]
Undocumented in source.
PublicKey
alias PublicKey = ubyte[crypto_box_PUBLICKEYBYTES]
Undocumented in source.
makeLockBoxSeed
alias makeLockBoxSeed = randomArray!LockBoxSeed

Generate a seed suitable for use with makeKeyPair

makeNonce
alias makeNonce = randomArray!Nonce

Generate a nonce suitable for encrypting a lock box.

Functions

decryptLockBox
ubyte[] decryptLockBox(ubyte[] cipher, Nonce nonce, PublicKey pk, PrivateKey sk)

Decrypt a message using a private key for the recipient (sk) and verify the signature with the public key of the sender (pk). Returns null if decryption or verification failed.

encryptLockBox
ubyte[] encryptLockBox(ubyte[] message, Nonce nonce, PublicKey pk, PrivateKey sk)

Encrypt a message using a public key for the recipient (pk) and signed with the private key of the sender sk.

lockBox
LockBox lockBox(ubyte[] message, PublicKey pk, PrivateKey sk)

Encrypt and sign message using public key cryptography. The message is encrypted using the public key of the recipient (pk) and signed with the private key of the sender (sk).

makeKeyPair
KeyPair makeKeyPair()

Generate a new random key pair.

makeKeyPair
KeyPair makeKeyPair(LockBoxSeed seed)

Generate a key pair from a seed.

openLockBox
ubyte[] openLockBox(LockBox box, PublicKey pk, PrivateKey sk)

Decrypt a LockBox encrypted and signed using public key cryptography. The message is decrypted using the private key of the recipient (sk) and the signature is verified using the public key of the sender (pk). If decryption or verification fails, null is returned.

openSealedBox
ubyte[] openSealedBox(ubyte[] cipher, KeyPair keys)

Decrypt a sealed box using the recipient's key pair. If decryption fails, return null.

sealBox
ubyte[] sealBox(ubyte[] message, PublicKey pk)

Anonymously encrypt a message using the recipients public key. A new key pair is generated for each invocation, so a nonce isn't needed.

Structs

KeyPair
struct KeyPair

Struct containing a key pair for public key encryption

LockBox
struct LockBox

Struct containing a message encrypted and signed using public key cryptography. Includes the ciphertext and the nonce used to encrypt it.

Meta