Closed paulreimer closed 5 years ago
This PR requires #175 (ISO7816-4 padding) to be merged first.
I don't know why there is a separate macs/CBCBlockCipherMac
and macs/CMac
class in BouncyCastle, with very similar (but slightly different) implementations. I'm porting the other one as well, and I will add it to this PR in the same manner that BouncyCastle has it (that is, two nearly identical algorithms in the same macs/
folder).
I'll note that that my goal is to get AES-CCM working (by porting BouncyCastle's CCMBlockCipher.java
), and that one uses the CBCBlockCipherMac
. Other than that, I'm not sure which one is best, or just to ship them both?
Sorry for the late review. I was hoping someone who actually uses this library could perhaps review this..
It looks quite good, even though I didn't verify the validity of the test vectors.
I found one nit, once addressed, I can merge this.
Thanks for the contribution!
Based on BouncyCastle sources, using the test vectors from the AES-CMAC RFC: https://tools.ietf.org/html/rfc4493
Those test vectors are binary plaintext, so I refactored
_runMacTest
to use acceptUInt8List
.I'm not strong in Java, Dart, or crypto, please review accordingly.