Sealed Box¶
Sealed box is a variant of public key encryption scheme which only the receiver’s public key is required. As such, the sender of the message cannot be cryptographically authenticated.
import libnacl.sealed
import libnacl.public
# Define a message to send
msg = b'You\'ve got two empty halves of coconut and you\'re bangin\' \'em together.'
# Generate the key pair
keypair = libnacl.public.SecretKey()
# Create the box
box = libnacl.sealed.SealedBox(keypair)
# Encrypt messages
ctxt = box.encrypt(msg)
# Decrypt messages
bclear = box.decrypt(ctxt)