Galois/Counter mode of the Advanced Encryption Standard: A mode of operation of the AES block cipher which both encrypts and authenticates its input data.
Questions tagged [aes-gcm]
393 questions
4
votes
1 answer
BouncyCastle GCM/CCM ArrayIndexOutOfBoundsException
can anyone give me an example for using GCM and/or CCM modes with AES in BouncyCastle?
My code is this:
SecretKeySpec key = new SecretKeySpec(keyBytes, "AES");
IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
Cipher cipher =…

Ariyan
- 14,760
- 31
- 112
- 175
3
votes
0 answers
Is it possible to encrypt a message outside of AWS KMS using a "key material" and decrypt using KMS?
I have created a custom managed symmetric key (for encryption / decryption purposes) in AWS KMS and imported my own key material from an external source.
For symmetric keys, AWS KMS uses the AES-256-GCM algorithm spec.
What I am trying to understand…

marley89
- 411
- 4
- 8
3
votes
2 answers
How can I decrypt using BouncyCastle, a string using a GCM Tag , IV string and Key string, all of them in HEX?
I amn trying to replicate the AES-Decrypt function from CyberChef, using GCM mode and HEX input.
Screenshot of the operation:
So far, I've written the following code:
package decryption;
import javax.crypto.Cipher;
import…

Codreanu George
- 55
- 6
3
votes
3 answers
AES_GCM in .net with streams
In my previous question (RAM not being freed in c# after working with files) I asked about a way to clear RAM. someone suggested using streams instead of reading it into a variable.
I found Encrypting/Decrypting large files (.NET) which uses streams…

macie
- 33
- 5
3
votes
1 answer
Trouble with getting correct tag for 256-bit AES GCM encryption in Node.js
I need to write the reverse (encryption) of the following decryption function:
const crypto = require('crypto');
let AESDecrypt = (data, key) => {
const decoded = Buffer.from(data, 'binary');
const nonce = decoded.slice(0, 16);
const…

Gilgamesh Skytrooper
- 562
- 1
- 3
- 18
3
votes
2 answers
Is this AES GCM file encryption good practice?
I'm using this to encrypt a file, and then to decrypt a file, using AES-GCM:
(do pip install pycryptodome first if not installed yet)
import Crypto.Random, Crypto.Protocol.KDF, Crypto.Cipher.AES
def cipherAES_GCM(pwd, nonce):
key =…

Basj
- 41,386
- 99
- 383
- 673
3
votes
1 answer
Different generated Ciphertext from AES-CTR & AES-GCM
To verify my understanding on AES-GCM & AES-CTR modes, I'm creating a simple example using python Crpyto.Cipher library. I'm expecting the same ciphertext is generated from both modes where both are using CTR method.
Since my intention is just to…

Pi-Turn
- 137
- 4
- 17
3
votes
0 answers
Java large file AES Encryption is very slow
I'm trying to encrypt a 512 Mb file with AES/CBC algorithm. It is taking around 7 sec which is too much. How to reduce the encryption time and make it faster.
I'm using a fixed key and tried using CipherOutStream as well as cipher.update() instead…
3
votes
1 answer
AES-GCM 256 decryption fails even with correct data
I have a given encrypted message (decrypted, it is "encrypted secret message") and I'm trying to retrieve this original string from the AES-GCM 256 encrypted one. I use the aes-gcm crate to do this:
use aes_gcm::Aes256Gcm;
use aead::{Aead, NewAead,…

Elf
- 153
- 2
- 12
3
votes
0 answers
Unable to decrypt node js Text i Java AES-256-GCM getting Tag mismatch
Am able to encrypt and decrypt node and java code individually but when trying to decrypt the node text in java getting Tag mismatch! Am trying to encrypt and decrypt a simple Hello World text here
node js code i have :
const buffer =…

Intact Abode
- 382
- 5
- 20
3
votes
1 answer
Encrypting large byte array
I am using a Cipher for encryption/decryption. It has always been fine, but now I am having problem when dealing with large array bytes.
This is my implementation:
val cipher = Cipher.getInstance("AES/GCM/NoPadding")
cipher.init(Cipher.ENCRYPT_MODE,…

GVillani82
- 17,196
- 30
- 105
- 172
3
votes
1 answer
Galois/Counter Mode (GCM/NoPadding) not used
I have implemented AES/CBC/PKCS5Padding and want to move on to AES/GCM/NoPadding in Java 1.8 but keep getting an error of javax.crypto.AEADBadTagException: Tag mismatch!
The current implementation of AES/CBC/PKCS5Padding is perfectly fine and in the…

ghost
- 425
- 4
- 17
3
votes
1 answer
How do I use AES-GMAC with a secret in BCrypt?
I am trying to use AES-GMAC with BCrypt (Microsoft CNG if that helps) but the documentation seems contradictory to what I would expect.
RFC 4543 states that AES-GMAC requires a secret key (which I was expecting), but BCryptCreateHash function states…

Chris Williams
- 81
- 4
3
votes
2 answers
Java Cipher.update does not write to buffer when using AES/GCM (Android 9)
I'm trying to use javax.crypto.Cipher on Android to encrypt a stream of data in chunks using AES-GCM. As I understand, one can use Cipher.update multiple times for a multi-part encryption operation, and finalize with Cipher.doFinal. However when…

Will
- 135
- 2
- 9
3
votes
1 answer
Encrypt/Decrypt using Secure Enclave iOS AES-GCM
I am using SecureEnclave on iOS to encrypt/decrypt my confidential key and save it in UserPreferences. It has been setup and encrypting the data successfully. But whenever I try to decrypt the data, it gives me the following error:
Error…

Waqas Ahmed Ansari
- 1,683
- 15
- 30