MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/d6d7ff2e2f9c

SubtleCrypto.exportKey()

The SubtleCrypto.exportKey() method returns a Promise of the key encrypted in the requested format. If the key is not extractable, that is if CryptoKey.extractable returns false, the promise fails with an InvalidAccessError exception; it the format is unknown, the promive fails with a NotSupported exception.

Syntax

var result = crypto.subtle.exportKey(format, key);

Parameters

  • format is an enumerated value describing the data format in which the key has to be exported. It can be one of the following:
  • key is the CryptoKey to export.

Return value

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

Exceptions

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

Specifications

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

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 37 (Yes) 34 (34) No support ? No support
ECDH ? ? 41 (41) ? ? ?
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) 37 (Yes) 34.0 (34) No support ? No support
ECDH ? ? ? 41.0 (41) ? ? ?

See also

Document Tags and Contributors

 Contributors to this page: fozi, Dans24, abbycar, teoli
 Last updated by: fozi,