Wolfram Language

Systems-Level Functionality

Use Asymmetric Key Cryptography

Asymmetric key encryption requires the generation of a public and private key, allowing the message to be encrypted with a "public" key but only decrypted using a "private" key.

Generate an asymmetric key pair.

In[1]:=
Click for copyable input
keys = GenerateAsymmetricKeyPair[]
Out[1]=

Encrypt the message using the public key.

In[2]:=
Click for copyable input
encrypted = Encrypt[keys["PublicKey"], "The gold is located off the coast of Honduras."]
Out[2]=

The message cannot be decrypted using the public key that encrypted it. The private key must be used.

In[3]:=
Click for copyable input
Decrypt[keys["PublicKey"], encrypted]
Out[3]=
In[4]:=
Click for copyable input
Decrypt[keys["PrivateKey"], encrypted]
Out[4]=

Related Examples

de es fr ja ko pt-br ru zh