Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

wrapKey method

Returns a KeyOperation object which will asynchronously return an array containing the key material of key, encrypted with keyEncryptionKey using the specified keyWrappingAlgorithm.

IE11

 

Syntax

var retVal = SubtleCrypto.wrapKey(key, keyEncryptionKey, keyWrappingAlgorithm);

Parameters

key [in]

Type: Key

The Key object whose key material is to be extracted.

keyEncryptionKey [in]

Type: Key

This Key object is used to encrypt the key material.

keyWrappingAlgorithm [in]

Type: any

An object identifying the cryptographic algorithm to use for encrypting the key material (along with any required algorithmic parameters). The supported cryptographic algorithms are as follows:

  • AES-KW
  • RSA-OAEP
  • AES-GCM

Return value

Type: KeyOperation

An object that will asynchronously return the encrypted key material.

Remarks

The Key object received by the keyEncryptionKey parameter is used to encrypt the content master key, not the key itself (this key is encrypted using the content master key.

The wrapKey method protects key material in a JSON Web Key (JWK) structure encapsulated with JSON Web Encryption (JWE). Specifically, the key material of key is encrypted using a randomly-generated content encryption key, which in turn is encrypted with keyEncryptionKey using the specified keyWrappingAlgorithm.

The algorithm used for the content encryption key is always AES-GCM. The wrapKey method can be used to wrap the key material for any Key object.

For a code example, see unwrapKey.

See also

SubtleCrypto

 

 

Show:
© 2014 Microsoft