Interface AesEncryption<I, G>

AES encryption algorithm.

interface AesEncryption<I, G> {
    cryptoGenerate: ((params: G, extractable: boolean) => Promise<GeneratedSecretKey<I>>);
    importSpki?: ((spki: Uint8Array, der: ElementBuffer) => Promise<CryptoAlgorithm.PublicKey<I>>);
    ivLength: number;
    keyUsages: Record<"secret", readonly KeyUsage[]>;
    makeAesKeyGenParams: ((genParams: G) => AesKeyGenParams);
    makeLLDecrypt: ((key: CryptoAlgorithm.SecretKey<I>) => LLDecrypt);
    makeLLEncrypt: ((key: CryptoAlgorithm.SecretKey<I>) => LLEncrypt);
    uuid: string;
}

Type Parameters

  • I
  • G extends AesGenParams

Hierarchy (view full)

Properties

cryptoGenerate: ((params: G, extractable: boolean) => Promise<GeneratedSecretKey<I>>)

Generate key pair (for asymmetric algorithm) or secret key (for symmetric algorithm).

Type declaration

    • (params, extractable): Promise<GeneratedSecretKey<I>>
    • Parameters

      • params: G

        Key generation parameters.

      • extractable: boolean

        Whether to generate as extractable WebCrypto key.

      Returns Promise<GeneratedSecretKey<I>>

      Generated key pair or secret key.

Some algorithms allow importing an existing key pair from a serialization format such as PKCS#8 or JWK. This could be supported by passing the serialized key as part of params, and then importing instead of generating in this method.

importSpki?: ((spki: Uint8Array, der: ElementBuffer) => Promise<CryptoAlgorithm.PublicKey<I>>)

Import public key from SubjectPublicKeyInfo.

This should only appear on asymmetric algorithm.

ivLength: number
keyUsages: Record<"secret", readonly KeyUsage[]>

WebCrypto KeyUsages for generated keys. These are specified separately for private/public/secret keys.

makeAesKeyGenParams: ((genParams: G) => AesKeyGenParams)
makeLLDecrypt: ((key: CryptoAlgorithm.SecretKey<I>) => LLDecrypt)

Create a low level decryption function from private key (in asymmetric algorithm) or secret key (in symmetric algorithm).

makeLLEncrypt: ((key: CryptoAlgorithm.SecretKey<I>) => LLEncrypt)

Create a low level encryption function from public key (in asymmetric algorithm) or secret key (in symmetric algorithm).

uuid: string

Identifies an algorithm in storage.

This should be changed when the serialization format changes.