Skip to content

the argument to define auth tag length in crypto.createDecipheriv cannot work #40272

Closed
@duomaomao27

Description

@duomaomao27
  • Node.js Version: 14.8.0
  • OS: MacOS 10.15.7
  • Scope (install, code, runtime, meta, other?): Typescript
  • Module (and version) (if relevant):

For 'aes-256-gcm', I've tried to use:

let decipher = crypto.createDecipheriv('aes-256-gcm', serverKeyArr, iv, {authTagLength: 12});

to define auth tag to 12 bytes, however, when I execute decipher.final(), inside that function, the tag it calculated is still 16 bytes, then when it do xor test for the tag function calculated and the auth Tag I've received (which already cut off by server side from 16 bytes to 12 bytes), it will results in error because the length is different.

I wonder why the argument {authTagLength: 12} do not work?

Besides, is there any way I can use shorter auth tag length to pass decipher.final() function, because in my program, I only can get the first 12 bytes auth tag.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions