Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

SubtleCrypto.wrapKey()

The SubtleCrypto.wrapKey() method returns a Promise of a wrapped symmetric key for usage (transfer, storage) in unsecure environments. The wrapped buffer returned is in the format given in parameters, and contained the key wrapped by the give wrapping key with the given algorithm.

Syntax

var result = crypto.wrapKey(format, key, wrappingKey, wrapAlgo);

Parameters

  • format is an enumerated value describing the data format in which the key must be wrapped. It can be one of the following:
  • key is the CryptoKey to wrap.
  • wrappingkey is the CryptoKey used to perform the wrapping.
  • wrapAlgo is the DOMString} representing the algorithm used to perform the wrapping. It is one of the following: AES-CBC, AES-CTR, AES-GCM, RSA-OAEP, and AES-KW.

Return value

  • result is a Promise that returns the wrapped key in the requested format.

Exceptions

The promise is rejected when one of the following exceptions is encountered:

  • InvalidAccessError when the wrapping key is not a key for the requested wrap algorithm.
  • NotSupported when trying to use an algorithm that is either unknown or isn't suitable for encryption or wrapping.
  • TypeError when trying to use an invalid format.

Specifications

Specification Status Comment
Web Cryptography API
The definition of 'SubtleCrypto.wrapKey()' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 37 34 (34) Not supported ? Not supported
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) 37 34.0 (34) Not supported ? Not supported

See also

Document Tags and Contributors

 Contributors to this page: teoli
 Last updated by: teoli,