Re: AES-GCM

2014-06-06 Thread Jens Hiller
Hi,

I only used the CCM example that contains the same comment at the
comparable point in its code.
If I remember correctly this comment means that no data will  be added
to outbuf. Hence, outlen should be 0. I have not stepped through the
code, but that seems to be meaningful as CCM and GCM use counter modes
and therefore do not require padding (reference:
http://openssl.6102.n7.nabble.com/AES-GCM-padding-td43598.html and
various GCM documentations). Hence, there is nothing to do for the
finalization except for computing the MAC (but I have not checked in the
code if the finalization really computes the MAC).
If this is correct, you _should_ check the return value, but as
mentioned above, outlen will be 0.

Note: Please take this as ideas/hints that I provide to you for further
testing as I am also not sure about this. Unfortunately, I do not have
time to check this on my own now.

Regards
Jens

On 06/06/2014 05:37 AM, Anant Rao wrote:
 Thanks for the info!
 I looked at the demos programs in the given link
 http://git.openssl.org/gitweb/?p=openssl.git;a=blob;f=demos/evp/aesgcm.c;h=324d8a55b1481c507c7754fa7f33c30a02bdb737;hb=HEAD
 .
 
 I have a question in encrypt:
 
 ...
  /* Finalise: note get no output for GCM */
 63
 http://git.openssl.org/gitweb/?p=openssl.git;a=blob;f=demos/evp/aesgcm.c;h=324d8a55b1481c507c7754fa7f33c30a02bdb737;hb=HEAD#l63
 EVP_EncryptFinal_ex(ctx, outbuf, outlen);
 ...
 
 What does this mean? That we shouldn't expect any output from this call
 and/or that we should ignore it?
 
 
 
 Thanks!
 
 
 On Tue, May 27, 2014 at 12:33 AM, Jens Hiller
 jens.hiller.c...@hotmail.de mailto:jens.hiller.c...@hotmail.de wrote:
 
 On 05/27/2014 09:00 AM, Anant Rao wrote:
  Hi,
 
  I have ciphertext encrypted in Java (using BouncyCastle - BC) with
  AES/GCM/NoPadding cipher.
 
  When I tried to decrypt it using OpenSSL in a 'c' program, the
 last call
  'EVP_DecryptFinal_ex' fails. Somehow, ERR_print_errors_fp is not
  printing anything either.
 
  I do have the IV that is used in the Java's encrypt. However, I don't
  know where BC stores the tag in the ciphertext. I tried it at the
  beginning and the end of the ciphertext, but it didn't help.
 
  That is, I tried both of the following in the decrypt:
 
  |IV|TAG|Ciphertext
 
  |IV|Ciphertext|TAG
  Both didn't work.
 
  I tried both of the following as well with the same failure:
  EVP_aes_256_gcm
  EVP_aes_128_gcm
 
  I have run out of ideas what else to try. Any help would be greatly
  appreciated.
  Thanks in advance!
 
 
 
 Have a look at
 https://www.openssl.org/docs/crypto/EVP_EncryptInit.html#GCM_Mode
 and at the example in 'openssl/demos/evp/aesgcm.c' of the current master
 branch (git://git.openssl.org/openssl.git
 http://git.openssl.org/openssl.git).
 
 Regards
 Jens
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing List  
  openssl-users@openssl.org mailto:openssl-users@openssl.org
 Automated List Manager  
 majord...@openssl.org mailto:majord...@openssl.org
 
 
 
 
 -- 
 
 *Anant** **Rao*
 Server Lead
 D  / a...@noknok.com mailto:a...@noknok.com
 
 *Nok Nok Labs Inc.*
 4151 Middlefield Road, Suite 200
 Palo Alto, CA 94303
 T +1 650 433 1300
 i...@noknok.com mailto:i...@noknok.com
 
 *www.noknok.com* http://www.noknok.com
 
   
 
  
 
  
 
 http://www.linkedin.com/company/nok-nok-labs
 http://www.twitter.com/noknoklabs
 https://plus.google.com/108217184383559859585
 http://www.facebook.com/NokNokLabs
 
 
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: AES-GCM

2014-05-27 Thread Jens Hiller
On 05/27/2014 09:00 AM, Anant Rao wrote:
 Hi,
 
 I have ciphertext encrypted in Java (using BouncyCastle - BC) with
 AES/GCM/NoPadding cipher.
 
 When I tried to decrypt it using OpenSSL in a 'c' program, the last call
 'EVP_DecryptFinal_ex' fails. Somehow, ERR_print_errors_fp is not
 printing anything either.
 
 I do have the IV that is used in the Java's encrypt. However, I don't
 know where BC stores the tag in the ciphertext. I tried it at the
 beginning and the end of the ciphertext, but it didn't help.
 
 That is, I tried both of the following in the decrypt:
 
 |IV|TAG|Ciphertext
 
 |IV|Ciphertext|TAG
 Both didn't work.
 
 I tried both of the following as well with the same failure:
 EVP_aes_256_gcm
 EVP_aes_128_gcm
 
 I have run out of ideas what else to try. Any help would be greatly
 appreciated.
 Thanks in advance!
 
 

Have a look at
https://www.openssl.org/docs/crypto/EVP_EncryptInit.html#GCM_Mode
and at the example in 'openssl/demos/evp/aesgcm.c' of the current master
branch (git://git.openssl.org/openssl.git).

Regards
Jens
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org