FgetCipherInfo
Bun

function

crypto.getCipherInfo

function getCipherInfo(
nameOrNid: string | number,
): undefined | CipherInfo;

Returns information about a given cipher.

Some ciphers accept variable length keys and initialization vectors. By default, the crypto.getCipherInfo() method will return the default values for these ciphers. To test if a given key length or iv length is acceptable for given cipher, use the keyLength and ivLength options. If the given values are unacceptable, undefined will be returned.

@param nameOrNid

The name or nid of the cipher to query.

Referenced types

interface CipherInfoOptions

interface CipherInfo

  • blockSize?: number

    The block size of the cipher in bytes. This property is omitted when mode is 'stream'.

  • ivLength?: number

    The expected or default initialization vector length in bytes. This property is omitted if the cipher does not use an initialization vector.

  • keyLength: number

    The expected or default key length in bytes.

  • mode: CipherMode

    The cipher mode.

  • name: string

    The name of the cipher.

  • nid: number

    The nid of the cipher.