Returns a KeyOperation object which will asynchronously return an array containing the key material of key, encrypted with keyEncryptionKey using the specified keyWrappingAlgorithm.
Syntaxvar retVal = SubtleCrypto.wrapKey(key, keyEncryptionKey, keyWrappingAlgorithm);
- key [in]
The Key object whose key material is to be extracted.
- keyEncryptionKey [in]
This Key object is used to encrypt the key material.
- keyWrappingAlgorithm [in]
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:
An object that will asynchronously return the encrypted key material.
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.