R: Unable to verify a RSA SHA512 signature maded from CLI from a C source code.

2012-02-03 Thread francesco.petruzzi
Have you miss the OpenSSL_add_all_algorithms() initialization?

 

Da: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org]
Per conto di Roberto Martelloni
Inviato: venerdì 3 febbraio 2012 12:31
A: openssl-users@openssl.org
Oggetto: Unable to verify a RSA SHA512 signature maded from CLI from a C
source code.

 

Hello to all, 

I can't verify a signature from a C code but maded with openssl command line
.
Anyone can give me some hints ? 

I create my RSA key pair with this command: 
/usr/bin/openssl genrsa -out RSA-1024.key 1024
/usr/bin/openssl rsa -in RSA-1024.key -pubout  RSA-1024-public.key 

I made the signature with: 
/usr/bin/openssl dgst -binary -sha512 -sign RSA-1024.key -out
serial.SHA512.asc serial.SHA512

If I verify it from CLI all work 
/usr/bin/openssl dgst -sha512 -verify RSA-1024-public.key -signature
serial.txt.SHA512.asc serial.txt.SHA512
Verified OK

But when I try to check it from source code all get wrong. 

Here the code http://nopaste.info/da38ec303b.html

What is wrong ? 

thank you !

R.








-- 
Roberto Martelloni

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



Re: R: Unable to verify a RSA SHA512 signature maded from CLI from a C source code.

2012-02-03 Thread Dr. Stephen Henson
On Fri, Feb 03, 2012, francesco.petru...@innovery.it wrote:

 Have you miss the OpenSSL_add_all_algorithms() initialization?
 
  
 
 Da: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org]
 Per conto di Roberto Martelloni
 Inviato: venerdì 3 febbraio 2012 12:31
 A: openssl-users@openssl.org
 Oggetto: Unable to verify a RSA SHA512 signature maded from CLI from a C
 source code.
 
  
 
 Hello to all, 
 
 I can't verify a signature from a C code but maded with openssl command line
 .
 Anyone can give me some hints ? 
 
 I create my RSA key pair with this command: 
 /usr/bin/openssl genrsa -out RSA-1024.key 1024
 /usr/bin/openssl rsa -in RSA-1024.key -pubout  RSA-1024-public.key 
 
 I made the signature with: 
 /usr/bin/openssl dgst -binary -sha512 -sign RSA-1024.key -out
 serial.SHA512.asc serial.SHA512
 
 If I verify it from CLI all work 
 /usr/bin/openssl dgst -sha512 -verify RSA-1024-public.key -signature
 serial.txt.SHA512.asc serial.txt.SHA512
 Verified OK
 
 But when I try to check it from source code all get wrong. 
 
 Here the code http://nopaste.info/da38ec303b.html
 
 What is wrong ? 
 

The OP is doing two things wrong.. 1. Posting in HTML and 2. If you call
RSA_verify() it expects the digest of the data and not the data itself. You
can digest and verify using EVP_Verify*() functions, see manual pages and
examples.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: R: Unable to verify a RSA SHA512 signature maded from CLI from a C source code.

2012-02-03 Thread Roberto Martelloni
I've tried again to hash the already hashed data, but no way to verify
it, code here: http://pastie.org/3309525

I can't understand what is wrong now, where I can find some guide or
documentation ?

Thanks !




On 02/03/2012 03:26 PM, Dr. Stephen Henson wrote:
 On Fri, Feb 03, 2012, francesco.petru...@innovery.it wrote:
 
 Have you miss the OpenSSL_add_all_algorithms() initialization?

  

 Da: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org]
 Per conto di Roberto Martelloni
 Inviato: venerdì 3 febbraio 2012 12:31
 A: openssl-users@openssl.org
 Oggetto: Unable to verify a RSA SHA512 signature maded from CLI from a C
 source code.

  

 Hello to all, 

 I can't verify a signature from a C code but maded with openssl command line
 .
 Anyone can give me some hints ? 

 I create my RSA key pair with this command: 
 /usr/bin/openssl genrsa -out RSA-1024.key 1024
 /usr/bin/openssl rsa -in RSA-1024.key -pubout  RSA-1024-public.key 

 I made the signature with: 
 /usr/bin/openssl dgst -binary -sha512 -sign RSA-1024.key -out
 serial.SHA512.asc serial.SHA512

 If I verify it from CLI all work 
 /usr/bin/openssl dgst -sha512 -verify RSA-1024-public.key -signature
 serial.txt.SHA512.asc serial.txt.SHA512
 Verified OK

 But when I try to check it from source code all get wrong. 

 Here the code http://nopaste.info/da38ec303b.html

 What is wrong ? 

 
 The OP is doing two things wrong.. 1. Posting in HTML and 2. If you call
 RSA_verify() it expects the digest of the data and not the data itself. You
 can digest and verify using EVP_Verify*() functions, see manual pages and
 examples.
 
 Steve.
 --
 Dr Stephen N. Henson. OpenSSL project core developer.
 Commercial tech support now available see: http://www.openssl.org
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   majord...@openssl.org


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


Re: R: Unable to verify a RSA SHA512 signature maded from CLI from a C source code.

2012-02-03 Thread Roberto Martelloni

  
  
No, 

I've omitted all other calls, for safeness I call all
OpenSSL_add_all 

 OpenSSL_add_all_algorithms();
 OpenSSL_add_all_ciphers();
 OpenSSL_add_all_digests();

R.

On 02/03/2012 03:10 PM, francesco.petru...@innovery.it wrote:

  
  
  
  
Have you miss the OpenSSL_add_all_algorithms() initialization?


  
Da:
owner-openssl-us...@openssl.org
[mailto:owner-openssl-us...@openssl.org] Per conto
  di Roberto Martelloni
Inviato: venerd 3 febbraio 2012 12:31
A: openssl-users@openssl.org
Oggetto: Unable to verify a RSA SHA512 signature
maded from CLI from a C source code.
  


Hello to all, 
  
  I can't verify a signature from a C code but maded with
  openssl command line .
  Anyone can give me some hints ? 
  
  I create my RSA key pair with this command: 
  /usr/bin/openssl genrsa -out RSA-1024.key 1024
  /usr/bin/openssl rsa -in RSA-1024.key -pubout 
  RSA-1024-public.key 
  
  I made the signature with: 
  /usr/bin/openssl dgst -binary -sha512 -sign RSA-1024.key -out
  serial.SHA512.asc serial.SHA512
  
  If I verify it from CLI all work 
  /usr/bin/openssl dgst -sha512 -verify RSA-1024-public.key
  -signature serial.txt.SHA512.asc serial.txt.SHA512
  Verified OK
  
  But when I try to check it from source code all get wrong. 
  
  Here the code http://nopaste.info/da38ec303b.html
  
  What is wrong ? 
  
  thank you !
  
  R.
  
  
  
  
  
  
  
-- 
Roberto Martelloni
__
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majord...@openssl.org
  



-- 
Roberto Martelloni
  

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