Skip to content

12 byte MAC throwing ArgumentError exception when using AES-GCM #229

@jingramwright

Description

@jingramwright

I'm currently rewriting an existing Kotlin encryption/decryption implementation in Dart for a project uplift and I'm running into an issue with the following code:

final aesGcmCipher = GCMBlockCipher(AESEngine())..init(false, AEADParameters(KeyParameter(kmAndIv.km), (tagSize * bitsInAByte), kmAndIv.iv, Uint8List.fromList([])));

Where tagSize is 12, throws the exception:

ArgumentError (Invalid argument(s): macSize should be equal to 16 for GCM)

I've found this article, and I'm assuming this library also only supports 16-byte MAC's due to Apple's CryptoKit on macOS.

Is this the case? If so, is there anyway the MAC size can be enforced only on macOS?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions