aes-gcm

How to decrypt data from the result of an IE 11 encrypt operation using AES-GCM

自作多情 提交于 2019-12-04 08:12:36
I've managed to encrypt some data with AES-GCM using IE 11 on Windows 10 but I can't get decryption to work. Example encryption JS code: let plainText = new Uint8Array([1]); let key; let keyBuf = window.msCrypto.getRandomValues(new Uint8Array(32)); let iv = window.msCrypto.getRandomValues(new Uint8Array(12)); let additionalData = window.msCrypto.getRandomValues(new Uint8Array(16)); let encResult; let importOp = window.msCrypto.subtle.importKey('raw', keyBuf, { name: 'AES-GCM' }, false, ['encrypt', 'decrypt']); importOp.oncomplete = function(e) { key = e.target.result; let encryptOp = window

Cannot decrypt long AES-256 GCM message with Java

坚强是说给别人听的谎言 提交于 2019-12-03 23:12:37
Related to this question: Cannot decrypt AES-256 GCM with Java The Java decrypt issue seems to only be fixed if the encrypted message is short, i.e. two words or so. I've tried with the words, "hello" and "short string", and both of these words were decrypted fine. When I tried something like, Alphanumeric string test1 with more numbers such as 5, 4, 3, 2, 1 AEADBadTagException came up again. EDIT: This issue is directly related to how long the encrypted message is. Two words is a bit of an exaggeration, but as long as the encrypted message is about as long as this or longer then Java will run

Random access of encrypted data AES GCM mode

人走茶凉 提交于 2019-12-03 21:02:06
There is a very good example for random access AES CTR mode and it works: Random access InputStream using AES CTR mode in android private static final int AES_BLOCK_SIZE = 16; private static IvParameterSpec calculateIVForOffset(final IvParameterSpec iv, final long blockOffset) { final BigInteger ivBI = new BigInteger(1, iv.getIV()); final BigInteger ivForOffsetBI = ivBI.add(BigInteger.valueOf(blockOffset / AES_BLOCK_SIZE)); final byte[] ivForOffsetBA = ivForOffsetBI.toByteArray(); final IvParameterSpec ivForOffset; if (ivForOffsetBA.length >= AES_BLOCK_SIZE) { ivForOffset = new IvParameterSpec

OpenSSL C example of AES-GCM using EVP interfaces

柔情痞子 提交于 2019-12-03 09:10:53
问题 For AES-GCM encryption/decryption, I tried this, but it has a problem. ctx = EVP_CIPHER_CTX_new(); //Get the cipher. cipher = EVP_aes_128_gcm (); #define GCM_IV "000000000000" #define GCM_ADD "0000" #define TAG_SIZE 16 #define ENC_SIZE 64 //Encrypt the data first. //Set the cipher and context only. retv = EVP_EncryptInit (ctx, cipher, NULL, NULL); //Set the nonce and tag sizes. //Set IV length. [Optional for GCM]. retv = EVP_CIPHER_CTX_ctrl (ctx, EVP_CTRL_GCM_SET_IVLEN, strlen((const char *

Support of AES 256 with GCM not possible in iOS? [duplicate]

ε祈祈猫儿з 提交于 2019-12-02 10:38:51
This question already has an answer here: Is it possible to use AES128 with GCM mode on iOS? 3 answers Currently the encryption mode supported with AES 256 is CBC . But I want to use AES 256 encryption with GCM mode along with PKCS5Padding / PKCS7Padding . Do let me know how it can be done ? zaph Common Crypto does not support GCM. But there is an implementation of AES GCM in the Security.framework, and you can add your own header file to use it. However associated data (AEAD) does not work. From SO Answer by soyer: CCCryptorStatus CCCryptorGCM( CCOperation op, // kCCEncrypt, kCCDecrypt

Is it possible to encrypt data with AES (256 bit) GCM mode in .net framework 4.7?

不打扰是莪最后的温柔 提交于 2019-12-01 04:22:57
The MSDN link provides references to concrete AES classes: System.Security.Cryptography.AesCng System.Security.Cryptography.AesCryptoServiceProvider System.Security.Cryptography.AesManaged However AesCryptoServiceProvider is for older machines and AesManaged is not certified for FIPS. So the only option is AesCng. The AesCng has a property called Mode, which will only take: CBC, ECB, OFB, CFB, CTS but no GCM . Is AES GCM supported on this framework? If yes, is there an example? If no, then what are my options? This answer reflects the comments from Luke Park, bartonjs, Timo, aand Maarten

Is it possible to encrypt data with AES (256 bit) GCM mode in .net framework 4.7?

点点圈 提交于 2019-12-01 01:47:40
问题 The MSDN link provides references to concrete AES classes: System.Security.Cryptography.AesCng System.Security.Cryptography.AesCryptoServiceProvider System.Security.Cryptography.AesManaged However AesCryptoServiceProvider is for older machines and AesManaged is not certified for FIPS. So the only option is AesCng. The AesCng has a property called Mode, which will only take: CBC, ECB, OFB, CFB, CTS but no GCM . Is AES GCM supported on this framework? If yes, is there an example? If no, then

How to chain BCryptEncrypt and BCryptDecrypt calls using AES in GCM mode?

我们两清 提交于 2019-11-30 17:58:04
Using the Windows CNG API, I am able to encrypt and decrypt individual blocks of data with authentication, using AES in GCM mode. I now want to encrypt and decrypt multiple buffers in a row. According to documentation for CNG , the following scenario is supported: If the input to encryption or decryption is scattered across multiple buffers, then you must chain calls to the BCryptEncrypt and BCryptDecrypt functions. Chaining is indicated by setting the BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG flag in the dwFlags member. If I understand it correctly, this means that I can invoke BCryptEncrypt

AES GCM implementation with authentication Tag in Java

半腔热情 提交于 2019-11-30 10:24:29
I'm using AES GCM authentication in my android project and it works fine. But getting some issues with authentication tag when it compare with openssl API generate tag. Please find the java code below: SecretKeySpec skeySpec = new SecretKeySpec(key, "AES"); byte[] iv = generateRandomIV(); IvParameterSpec ivspec = new IvParameterSpec(iv); Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivspec); int outputLength = cipher.getOutputSize(data.length); // Prepare output buffer byte[] output = new byte[outputLength]; int outputOffset = cipher.update

How to chain BCryptEncrypt and BCryptDecrypt calls using AES in GCM mode?

瘦欲@ 提交于 2019-11-30 01:48:03
问题 Using the Windows CNG API, I am able to encrypt and decrypt individual blocks of data with authentication, using AES in GCM mode. I now want to encrypt and decrypt multiple buffers in a row. According to documentation for CNG, the following scenario is supported: If the input to encryption or decryption is scattered across multiple buffers, then you must chain calls to the BCryptEncrypt and BCryptDecrypt functions. Chaining is indicated by setting the BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG flag in