Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

exportKey method

Exports the given key material of the Key object as specified by the key parameter.

Important  As of Microsoft Edge, this method returns a Promise object. See Web Cryptography API updates for more info.
IE11

 

Syntax

var retVal = SubtleCrypto.exportKey(format, key);

Parameters

format [in]

Type: DOMString

A DOM string specifying the format of the exported key material, such as raw, pkcs8, spki, or jwk. For details, see the below remarks section.

key [in]

Type: Key

The key to export.

Return value

Type: Promise

A Promise object that will return the exported key material.

Remarks

With respect to supported cryptographic algorithms, any key which can be generated can be imported and exported.

The supported formats for both importKey and exportKey are as follows:

  • raw - An unformatted sequence of bytes. Intended for secret keys.
  • pkcs8 - The DER encoding of the PrivateKeyInfo structure from RFC 5208.
  • spki - The DER encoding of the SubjectPublicKeyInfo structure from RFC 5280.
  • jwk - The key is represented as JSON according to the JSON Web Key format.
Note  This method exports the key material in unencrypted form (in the clear). Exported key material must be handled in accordance with good security practices.

See also

SubtleCrypto

 

 

Show:
© 2015 Microsoft