cipher.getAuthTag()
- 返回: <Buffer> 当使用认证的加密模式时(当前支持
GCM、CCM、OCB和chacha20-poly1305),则cipher.getAuthTag()方法返回Buffer,其中包含根据给定数据计算的认证标签。
只有在使用 cipher.final() 方法完成加密后才应调用 cipher.getAuthTag() 方法。
如果在创建 cipher 实例时设置了 authTagLength 选项,则此函数将准确返回 authTagLength 个字节。
- 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.
The cipher.getAuthTag() method should only be called after encryption has
been completed using the cipher.final() method.
If the authTagLength option was set during the cipher instance's creation,
this function will return exactly authTagLength bytes.