cipher.getAuthTag()
只有在使用 cipher.final()
方法完成加密后才应调用 cipher.getAuthTag()
方法。
如果在创建 cipher
实例时设置了 authTagLength
选项,则此函数将准确返回 authTagLength
个字节。
- Returns: <Buffer> When using an authenticated encryption mode (
GCM
,CCM
, andOCB
are currently supported), thecipher.getAuthTag()
method returns aBuffer
containing 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.