• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps AEADBadTagException Caused by KeyStoreException: Signature/MAC verification failed

I use AES key with this code to encrypt:

private EncryptionResult encrypt(SecretKey secretKey, String message) throws Throwable {
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] cipherText = cipher.doFinal(message.getBytes(StandardCharsets.UTF_8));

// save in an object encoded with iv
EncryptionResult result = new EncryptionResult(Base64.encodeToString(cipherText, Base64.NO_WRAP), cipher.getIV());
return result;
}


And I use this code to decrypt:

private String decrypt(SecretKey secretKey, EncryptionResult encryptionResult) throws Throwable {
byte[] salt = encryptionResult.getIV();
GCMParameterSpec gCMParameterSpec = new GCMParameterSpec(128, salt);

Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(Cipher.DECRYPT_MODE, secretKey, gCMParameterSpec);
byte[] decodeBase64 = Base64.decode(encryptionResult.getBase64EncryptedValue(), Base64.NO_WRAP);
byte[] decryptedValue = cipher.doFinal(decodeBase64);
return new String(decryptedValue);
}


The "message" that is being encrypted is a RSA key size 2048.
It works on MOST of the popular devices, but the decryption fails on some others like Meizu (M5, M3E), Huawei (P40, Nova 5T), Samsungs (J7, A10), etc... where it crashes do to "AEADBadTagException... Caused by KeyStoreException: Signature/MAC verification failed".
If I reduce the "message" to 1024, it also works fine (although as far as I know, AES key has no size limitation for encryption).
I also tried using CipherOutputStream/CipherInputStream, but got the same result.
All looks good with Base64 encoding/decoding, tags, iv, keyStore... any other components envolved in the process.

Does anyone can shed some light why some devices do the work, while others fail?

Post the latest Note 20 rumors here

Hi Greegom, welcome to the cool kids' club... it's great to have you here!

I've heard rumors of the new Fold (whatever they call it) having an S Pen. The screen is reported to be ultra-thin glass: regardless, the S Pen would reside beneath it anyway. That gorgeous, huge screen is begging for an S Pen - artists, business people, lots of folks would love that. Including me! I use that S Pen almost every hour of the day: the bluetooth control of the camera, music, etc. is so useful. Plus, the precision of the S Pen lets me work more efficiently with fewer mistakes.

Let's hope the new Fold has an S Pen and its features built in. If so, one must wonder if that's the next evolution of the Galaxy Note, 10 years later...

Help Unknown stream audio comming from phone, need hidden Process & app monitoring, & general security.

Thanks, those developer controlls look like just what i need. Now to wait and see if it pops back up again. That's the tricky one because it's not actually my phone.

I can say though it is definetly not an add form some app running. It's as i described in the post. It was weird because it sounded like we where the hackers listening in on someone who was unaware.
But i guessed it more sounded like somebody facebook livestreaming a party.

This news source that I use used to have an annoying feature.

I would click on a link, and as it was loading, a window would pop up with a video that would take forever to load.
So I would start to read the article, and once the video loaded everything scrolled back to the top to that pest of a window- where the story I was just reading is replayed word for word, slowly, with pictures, and an annoying soundtrack.

Needless to say, this was extremely aggrevating, as I was oten already half way through the article when this would happen.

Anyway, this stupid, annoying soundtrack was so low to almost go unnoticed.

And sometimes, it would just start playing out of nowhere, even if I was not on that news site. It must have been getting stored inside the cache of the browser. And since I use that browser all the time, it is almost always active.

After a few profane e-mails, they finally decided to ditch the whole video window, thank God.

Haven't had the issue since.

Help Endoscope support

i do not see that anywhere it says to install the software form the cd but it is in chinese and the pc is not translating it. i did try a few buttons in the program but nothing happens my pc see the camera in the devices but that is about it. i plugged it into the wifes pc and it said usb all set what do i want to do with it but then nothing. the instructions say works in win 2000-xp-vista-7 so you would think it would work in 10. at one time it did show up on my pc but for what i needed the endoscope for that day required the phone. now i want the pc and it fails. i went into settings and made sure all the require items were turn on but still will not work. so i have something turned off. in my research on site talked about turning on switches and then under the instruction a dozen people commented that those instruction did not work for them. nor for me. thanks

Problems with examples from the book "Android game programming"

Hello everyone,
i'm relatively new to android. i mastered the real basics and now want to go on to game programming that's why i bought this book. the problem is when i compile the project i get no errors, but when i try to start one of the activities that show simple opengl es 1.0 examples it crashes. now i have no idea how to debug this kind of error (or generally debug an android app, when i select debug nothing happens). i have the hole project saved with this thread. i don't know why he does not start the activities but crashes, i hope one of you guys can help me.

best regards,
alex fessler

Attachments

Low volume of my AirPods on my Xiaomi

Hi there,
I have AirPods2 but when Im connecting them to my Xiaomi redmi note 8, the volume turnes realy low.
I tried the "disable absoulte volume" on the develpoer options but it didnt work/
I saw on YouTube a video which says to turn on "sync audio on the bluetooth advanced settings" but I didnt have bluetooth advanced settings on my Xiaomi redmi note 8....
please someone can help me and may can solve this problem

Filter

Back
Top Bottom