cipher.getAuthTag()


  • 返回值:<Buffer> 当使用认证加密模式(当前支持 GCMCCMOCBchacha20-poly1305)时,cipher.getAuthTag() 方法返回一个 Buffer,其中包含从给定数据计算出的_认证标签_。

cipher.getAuthTag() 方法应该只在使用 cipher.final() 方法完成加密后调用。

【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.】