Decrypt

Decrypt["password",enc]

attempts to decrypt the encrypted object enc using the specified password.

Decrypt[keyspec,enc]

attempts to decrypt using the cryptographic key specification keyspec.

Decrypt[key,bytes]

attempts to decrypt the ByteArray object bytes, to give another ByteArray object.

Decrypt[obj]

interactively requests a password with which to try to decrypt obj.

Details

Examples

open allclose all

Basic Examples  (3)

Encrypt a message with a password:

Decrypt with the same password to get back the message:

Generate a key:

Encrypt using the key:

Decrypt using the key:

Generate public and private keys:

Encrypt using the public key:

Decrypt using the private key:

Alternatively, encrypt using the private key:

Now decrypt using the public key:

Scope  (2)

Encrypt any expression:

Decrypt to get back the exact expression:

Decrypt can be passed a ByteArray:

Applications  (1)

Write simple cryptographic signing and verification functions:

Generate a pair of public and private keys:

Define an expression to sign:

Generate a signature:

Verify that the signature is authentic:

Verifying with another expression will fail:

Possible Issues  (1)

Decrypting using the wrong key will yield a message:

Introduced in 2015
 (10.1)
 |
Updated in 2019
 (12.0)