cipher.getAuthTag()
-
返回:<Buffer> 当使用经过身份验证的加密模式(目前支持
GCM、CCM、OCB和chacha20-poly1305)时,cipher.getAuthTag()方法返回一个Buffer,其中包含根据给定数据计算出的身份验证标记。¥Returns: <Buffer> When using an authenticated encryption mode (
GCM,CCM,OCB, andchacha20-poly1305are currently supported), thecipher.getAuthTag()method returns aBuffercontaining the authentication tag that has been computed from the given data.
只有在使用 cipher.final() 方法完成加密后才应调用 cipher.getAuthTag() 方法。
¥The cipher.getAuthTag() method should only be called after encryption has
been completed using the cipher.final() method.
如果在创建 cipher 实例时设置了 authTagLength 选项,则此函数将准确返回 authTagLength 个字节。
¥If the authTagLength option was set during the cipher instance's creation,
this function will return exactly authTagLength bytes.