Exports the given key material of the Key object as specified by the key parameter.
Syntaxvar retVal = SubtleCrypto.exportKey(format, key);
- format [in]
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]
The key to export.
A Promise object that will return the exported key material.
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.