PointyCastle / pointycastle

Moved into the Bouncy Castle project: https://github.com/bcgit/pc-dart
MIT License
270 stars 76 forks source link

How can i use AES-CCM with Nonce, SecretKey and ADD #234

Open mjl0602 opened 4 years ago

mjl0602 commented 4 years ago

There is Java code like this:

            GCMParameterSpec parameterSpec = new GCMParameterSpec(32, ivBuffer);
            SecretKeySpec skSpec = new SecretKeySpec(key, "AES");
            Cipher cipher = Cipher.getInstance("AES/CCM/NoPadding");
            cipher.init(Cipher.ENCRYPT_MODE, skSpec, parameterSpec);
            cipher.updateAAD(macKey);
            outBuffer = cipher.doFinal(plainBuffer);

but i cannot find this in mode Mac("AES/CBC_CMAC"), there is only one KeyParameter.

I am not sure that i found right mode, is AES-CCM same as AES/CBC_CMAC ?