crypto.getCipherInfo(nameOrNid[, options])
返回有关给定密码的信息。
一些密码接受可变长度的密钥和初始化向量。
默认情况下,crypto.getCipherInfo()
方法将返回这些密码的默认值。
要测试给定的密钥长度或 iv 长度对于给定的密码是否可接受,请使用 keyLength
和 ivLength
选项。
如果给定的值不可接受,则返回 undefined
。
nameOrNid
: <string> | <number> The name or nid of the cipher to query.options
: <Object>- Returns: <Object>
name
<string> The name of the ciphernid
<number> The nid of the cipherblockSize
<number> The block size of the cipher in bytes. This property is omitted whenmode
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
<string> The cipher mode. One of'cbc'
,'ccm'
,'cfb'
,'ctr'
,'ecb'
,'gcm'
,'ocb'
,'ofb'
,'stream'
,'wrap'
,'xts'
.
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.