cipher.getAuthTag()


  • 返回:<Buffer> 在使用认证加密模式(目前支持 GCM、CCM、OCB、SIV、GCM-SIV 和 chacha20-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.