Module aes/aes_kw
source · [−]Expand description
Code related to AES_KW mode
Functions
sourceexportKey
exportKey
source(format: KeyFormat, key: AesKwCryptoKey): Promise<ArrayBuffer | JsonWebKey>
(format: KeyFormat, key: AesKwCryptoKey): Promise<ArrayBuffer | JsonWebKey>
Export an AES_KW key into the specified format
example
const jwk = await AES_KW.exportKey("jwk", key.self);
example
const jwk = await key.exportKey("jwk");
sourcegenerateKey
generateKey
source(algorithm?: Omit<EnforcedAesKeyGenParams, "name">, extractable?: boolean, keyUsages?: KeyUsage[]): Promise<AesKwProxiedCryptoKey>
(algorithm?: Omit<EnforcedAesKeyGenParams, "name">, extractable?: boolean, keyUsages?: KeyUsage[]): Promise<AesKwProxiedCryptoKey>
Generate a new AES_KW key
example
const key = await AES_KW.generateKey();
sourceimportKey
importKey
source(format: KeyFormat, key: BufferSource | JsonWebKey, extractable?: boolean, keyUsages?: KeyUsage[]): Promise<AesKwProxiedCryptoKey>
(format: KeyFormat, key: BufferSource | JsonWebKey, extractable?: boolean, keyUsages?: KeyUsage[]): Promise<AesKwProxiedCryptoKey>
Import an AES_KW key from the specified format
example
const key = await AES_KW.importKey("jwk", jwk);
sourceunwrapKey
unwrapKey
source(format: KeyFormat, wrappedKey: BufferSource, wrappedKeyAlgorithm: EnforcedImportParams, unwrappingKey: AesKwCryptoKey, extractable?: boolean, keyUsages?: KeyUsage[]): Promise<CryptoKey>
(format: KeyFormat, wrappedKey: BufferSource, wrappedKeyAlgorithm: EnforcedImportParams, unwrappingKey: AesKwCryptoKey, extractable?: boolean, keyUsages?: KeyUsage[]): Promise<CryptoKey>
Unwrap a wrapped key using the key encryption key
example
const dek = await AES_KW.unwrapKey("raw", wrappedKey, {name: "AES_GCM"}, kek.self);
example
const dek = await kek.unwrapKey("raw", wrappedKey, {name: "AES_GCM"});
sourcewrapKey
wrapKey
source(format: KeyFormat, key: CryptoKey, wrappingkey: AesKwCryptoKey): Promise<ArrayBuffer>
(format: KeyFormat, key: CryptoKey, wrappingkey: AesKwCryptoKey): Promise<ArrayBuffer>
Wrap another key with an AES_KW key
example
const kek = await AES_KW.generateKey({length: 256}, true, ['wrapKey', 'unwrapKey']);
const dek = await AES_GCM.generateKey();
const wrappedKey = await AES_KW.wrapKey("raw", dek.self, kek.self);
example
const kek = await AES_KW.generateKey({length: 256}, true, ['wrapKey', 'unwrapKey']);
const dek = await AES_GCM.generateKey();
const wrappedKey = await kek.wrapKey("raw", dek.self);