crypto.getCipherInfo(nameOrNid[, options])
-
nameOrNid
:<string> | <number> 要查询的密码的名称或 nid。¥
nameOrNid
: <string> | <number> The name or nid of the cipher to query. -
options
:<Object> -
返回:<Object>
¥Returns: <Object>
-
name
<string> 密码的名称¥
name
<string> The name of the cipher -
nid
<number> 密码的 nid¥
nid
<number> The nid of the cipher -
blockSize
<number> 密码的块大小(以字节为单位)。当mode
为'stream'
时,此属性被省略。¥
blockSize
<number> The block size of the cipher in bytes. This property is omitted whenmode
is'stream'
. -
ivLength
<number> 以字节为单位的预期或默认初始化向量长度。如果密码不使用初始化向量,则省略此属性。¥
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> 以字节为单位的预期或默认密钥长度。¥
keyLength
<number> The expected or default key length in bytes. -
mode
<string> 密码模式。'cbc'
、'ccm'
、'cfb'
、'ctr'
、'ecb'
、'gcm'
、'ocb'
、'ofb'
、'stream'
、'wrap'
、'xts'
之一。¥
mode
<string> The cipher mode. One of'cbc'
,'ccm'
,'cfb'
,'ctr'
,'ecb'
,'gcm'
,'ocb'
,'ofb'
,'stream'
,'wrap'
,'xts'
.
-
返回有关给定密码的信息。
¥Returns information about a given cipher.
一些密码接受可变长度的密钥和初始化向量。默认情况下,crypto.getCipherInfo()
方法将返回这些密码的默认值。要测试给定的密钥长度或 iv 长度对于给定的密码是否可接受,请使用 keyLength
和 ivLength
选项。如果给定的值不可接受,则返回 undefined
。
¥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.