@hpke/core
    Preparing search index...

    Class CipherSuite

    The Hybrid Public Key Encryption (HPKE) ciphersuite, which is implemented using only Web Cryptography API.

    This class is the same as @hpke/core#CipherSuiteNative as follows: which supports only the ciphersuites that can be implemented on the native Web Cryptography API. Therefore, the following cryptographic algorithms are not supported for now:

    • DHKEM(X448, HKDF-SHA512)
    • ChaCha20Poly1305

    If you want to use the unsupported cryptographic algorithms above, please use hpke-js#CipherSuite.

    This class provides following functions:

    The calling of the constructor of this class is the starting point for HPKE operations for both senders and recipients.

    import {
    Aes128Gcm,
    DhkemP256HkdfSha256,
    HkdfSha256,
    CipherSuite,
    } from "@hpke/core";

    const suite = new CipherSuite({
    kem: new DhkemP256HkdfSha256(),
    kdf: new HkdfSha256(),
    aead: new Aes128Gcm(),
    });
    import {
    Aes128Gcm,
    CipherSuite,
    DhkemX25519HkdfSha256,
    HkdfSha256,
    } from "@hpke/core";
    const suite = new CipherSuite({
    kem: new DhkemX25519HkdfSha256(),
    kdf: new HkdfSha256(),
    aead: new Aes128Gcm(),
    });

    Hierarchy

    • CipherSuiteNative
      • CipherSuite
    Index
    _api: SubtleCrypto = undefined
    • Decrypts a message from a sender.

      If the error occurred, throws DecapError | DeserializeError | OpenError | ValidationError.

      Parameters

      • params: RecipientContextParams

        A set of parameters for building a recipient encryption context.

      • ct: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An encrypted text as bytes to be decrypted.

      • aad: ArrayBufferLike | ArrayBufferView<ArrayBufferLike> = ...

        Additional authenticated data as bytes fed by an application.

      Returns Promise<ArrayBuffer>

      A decrypted plain text as bytes.