crypto.getCipherInfo(nameOrNid[, options])
nameOrNid<string> | <number> 要查询的密码算法的名称或 nid。options<Object>- 返回值: <Object>
name<string> 密码算法名称nid<number> 密码算法的 nidblockSize<number> 密码算法的块大小(以字节为单位)。当mode为'stream'时,此属性会被省略。ivLength<number> 预期或默认的初始化向量长度(以字节为单位)。如果密码算法不使用初始化向量,则此属性会被省略。keyLength<number> 预期或默认的密钥长度(以字节为单位)。mode<string> 密码算法模式。可选值有'cbc'、'ccm'、'cfb'、'ctr'、'ecb'、'gcm'、'ocb'、'ofb'、'stream'、'wrap'、'xts'。
返回有关给定密码的信息。
【Returns information about a given cipher.】
某些加密算法接受可变长度的密钥和初始化向量。默认情况下,crypto.getCipherInfo() 方法将返回这些加密算法的默认值。要测试给定的密钥长度或初始化向量长度是否适用于指定的加密算法,请使用 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.】