Generate a seed suitable for use with makeKeyPair
Generate a nonce suitable for encrypting a lock box.
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.
Encrypt a message using a public key for the recipient (pk) and signed with the private key of the sender 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).
Generate a new random key pair.
Generate a key pair from a seed.
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.
Decrypt a sealed box using the recipient's key pair. If decryption fails, return null.
Anonymously encrypt a message using the recipients public key. A new key pair is generated for each invocation, so a nonce isn't needed.
Struct containing a key pair for public key encryption
Struct containing a message encrypted and signed using public key cryptography. Includes the ciphertext and the nonce used to encrypt it.
1 import std.string : representation; 2 immutable ubyte[] message = representation("hello"); 3 auto alice = makeKeyPair(); 4 auto bob = makeKeyPair(); 5 auto box = lockBox(message, bob.publicKey, alice.privateKey); 6 assert(openLockBox(box, alice.publicKey, bob.privateKey) == message);
1 import std.string : representation; 2 immutable ubyte[] message = representation("hello"); 3 auto keys = makeKeyPair(); 4 auto box = sealBox(message, keys.publicKey); 5 assert(openSealedBox(box, keys) == message);