({{, (RefLink[SymmetricKey, paclet:ref/SymmetricKey])[assoc] 
represents all the information needed for encryption, decryption, and other operations in a symmetric cryptographic system.}})

OpenersNotesSection(Spacer1)Details

(RefLink[SymmetricKey, paclet:ref/SymmetricKey]) objects can be used with functions such as (RefLink[Encrypt, paclet:ref/Encrypt]) and (RefLink[Decrypt, paclet:ref/Decrypt]).

A single (RefLink[SymmetricKey, paclet:ref/SymmetricKey]) object can be used for both encryption and decryption.

In (RefLink[SymmetricKey, paclet:ref/SymmetricKey])[assoc], the association assoc contains the following:

Possible methods are as listed for (RefLink[GenerateSymmetricKey, paclet:ref/GenerateSymmetricKey]).

When used in (RefLink[Encrypt, paclet:ref/Encrypt]), the setting "InitializationVector"->(RefLink[None, paclet:ref/None]) specifies that (RefLink[Encrypt, paclet:ref/Encrypt]) should generate a new initialization vector whenever it is called.

(RefLink[SymmetricKey, paclet:ref/SymmetricKey])[assoc]["prop"] gives the specified element of assoc. It is equivalent to assoc["prop"].

(RefLink[SymmetricKey, paclet:ref/SymmetricKey])[…]["Properties"] gives a list of available properties.

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Generate a random symmetric key:

key=GenerateSymmetricKey[]

Use the key to encrypt:

msg=Encrypt[key,"Now is the time..."]

Decrypt the message:

Decrypt[key,msg]

You can retrieve keys and values from the associations with the (RefLink[SymmetricKey, paclet:ref/SymmetricKey]) object:

key["Cipher"]

key["Key"]

key["KeySize"]

key["InitializationVector"]

key["BlockMode"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[GenerateSymmetricKey, paclet:ref/GenerateSymmetricKey])  ▪  (RefLink[Encrypt, paclet:ref/Encrypt])  ▪  (RefLink[Decrypt, paclet:ref/Decrypt])  ▪  (RefLink[PrivateKey, paclet:ref/PrivateKey])  ▪  (RefLink[PublicKey, paclet:ref/PublicKey])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Cryptography, paclet:guide/Cryptography])}})}})