Closed faliqulamin closed 6 years ago
Our implementation wasn't really designed to omit the tag completely. For encryption of course you can just throw away the tag, but for decryption there will be problems.
GCMBlockCipher should work like you want if the macSize (AeadParameters.MacSize) were set to 0, but GCMBlockCipher.Init would throw an exception. I suggest you copy the GCMBlockCipher class and modify the Init method to allow this value to be 0, then use new AeadParameters(..., 0, IV).
If that works for you, we could consider how to make it possible to do this with a subclass instead of needing to copy GCMBlockCipher.
hai @peterdettman , thanks for your suggest. its work.
Another way to deal with this would be to use Counter (CTR) mode instead of GCM in this case. The two are equal if you ignore all of the authentication code. The only code you would need to play with would be the IV setup.
I use Bouncy Castle to implement DLMS (Protocol for energy metering) and use AES-GCM for the comunication security,
and this is the example of AES-GCM From the documentaion (The example is on red block) :
so, when i try to encrypt the example with this code :
the cipher is : 41-13-12-FF-93-5A-47-56-68-27-C4-67-BC-03-87-BA-79-BD-B9-DF-0E-13-49-AE-2A not like the cipher in the example above (blue box) : 41-13-12-FF-93-5A-47-56-68-27-C4-67- BC
in the output of my code, there are additions byte (TAG)
So, please help me to encrypt or decrypt without the tag?
thanks for help before and sorry with my english. :)