Query with digital signatures

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Query with digital signatures

tarun mathur
Hi All,
I am facing a problem:
I have generated the public & Private keys using the
following commands at the server:
openssl genrsa -out private.pem 1024
openssl rsa -in private.pem -out public.pem -outform
PEM -pubout

After this I am finding hash of my document using
openssl md5 abc.txt|openssl rsautl -out ds.txt -sign
-inkey private.pem
and encrypting this text with my pvt key to get the
digital signatures.

On the client side I am getting the digital
signatures.
The client has the public key of server.

I am unable to get the hash from the digital
signatures using the public key ato decrypt it and
using RSA_public_decrypt().
Please Help

Regards
Tarun


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Query with digital signatures

Bhupendra K Joshi
Hi
 
Just make sure two things:-
 
1. to (buffer that has to hold the message digest),must point to a memory section large enough to hold the message digest (which is smaller than RSA_size(rsa) - 11)
2. padding is the padding mode that was used to sign the data
 
 
Regards,
Bhupendra K Joshi

tarun mathur <[hidden email]> wrote:
Hi All,
I am facing a problem:
I have generated the public & Private keys using the
following commands at the server:
openssl genrsa -out private.pem 1024
openssl rsa -in private.pem -out public.pem -outform
PEM -pubout

After this I am finding hash of my document using
openssl md5 abc.txt|openssl rsautl -out ds.txt -sign
-inkey private.pem
and encrypting this text with my pvt key to get the
digital signatures.

On the client side I am getting the digital
signatures.
The client has the public key of server.

I am unable to get the hash from the digital
signatures using the public key ato decrypt it and
using RSA_public_decrypt().
Please Help

Regards
Tarun


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [hidden email]
Automated List Manager [hidden email]


Start your day with Yahoo! - make it your home page
Reply | Threaded
Open this post in threaded view
|

Re: Query with digital signatures

tarun mathur
Hi,
---The buffer to hold the message digest is quiet big.
---No padding was used, by default it takes
RSA_PKCS1_PADDING
Can you please provide any inputs or the code that
does the same.

Regards
Tarun

--- Bhupendra K Joshi <[hidden email]> wrote:

> Hi
>  
> Just make sure two things:-
>  
> 1. to (buffer that has to hold the message
> digest),must point to a memory section large enough
> to hold the message digest (which is smaller than
> RSA_size(rsa) - 11)
> 2. padding is the padding mode that was used to sign
> the data
>  
>  
> Regards,
> Bhupendra K Joshi
>
> tarun mathur <[hidden email]> wrote:
> Hi All,
> I am facing a problem:
> I have generated the public & Private keys using the
>
> following commands at the server:
> openssl genrsa -out private.pem 1024
> openssl rsa -in private.pem -out public.pem -outform
> PEM -pubout
>
> After this I am finding hash of my document using
> openssl md5 abc.txt|openssl rsautl -out ds.txt -sign
> -inkey private.pem
> and encrypting this text with my pvt key to get the
> digital signatures.
>
> On the client side I am getting the digital
> signatures.
> The client has the public key of server.
>
> I am unable to get the hash from the digital
> signatures using the public key ato decrypt it and
> using RSA_public_decrypt().
> Please Help
>
> Regards
> Tarun
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com 
>
______________________________________________________________________
> OpenSSL Project http://www.openssl.org
> Development Mailing List [hidden email]
> Automated List Manager [hidden email]
>
>
> ---------------------------------
>  Start your day with Yahoo! - make it your home page




               
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs 
 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Query with digital signatures

tarun mathur
Hi,
I am using the following code:
unsigned char p_key[300];//contains public key
unsigned char sig_data[300];//contains digital sign
unsigned char dst_data[300];//will contain digest
after decryption

if (BIO* bio = BIO_new_mem_buf(p_key, sizeof(p_key)))
     {
        RSA* rsa_key = 0;
        if(PEM_read_bio_RSA_PUBKEY(bio, &rsa_key,
NULL, NULL))
        {
            int returnedRSASize = RSA_size(rsa_key);
            RSA_public_decrypt(data_size, sig_data,
dst_data, rsa_key, RSA_PKCS1_PADDING);
         }
       }
Is there anything wrong in implementation.

Regards,
Tarun

--- tarun mathur <[hidden email]> wrote:

> Hi,
> ---The buffer to hold the message digest is quiet
> big.
> ---No padding was used, by default it takes
> RSA_PKCS1_PADDING
> Can you please provide any inputs or the code that
> does the same.
>
> Regards
> Tarun
>
> --- Bhupendra K Joshi <[hidden email]>
> wrote:
>
> > Hi
> >  
> > Just make sure two things:-
> >  
> > 1. to (buffer that has to hold the message
> > digest),must point to a memory section large
> enough
> > to hold the message digest (which is smaller than
> > RSA_size(rsa) - 11)
> > 2. padding is the padding mode that was used to
> sign
> > the data
> >  
> >  
> > Regards,
> > Bhupendra K Joshi
> >
> > tarun mathur <[hidden email]> wrote:
> > Hi All,
> > I am facing a problem:
> > I have generated the public & Private keys using
> the
> >
> > following commands at the server:
> > openssl genrsa -out private.pem 1024
> > openssl rsa -in private.pem -out public.pem
> -outform
> > PEM -pubout
> >
> > After this I am finding hash of my document using
> > openssl md5 abc.txt|openssl rsautl -out ds.txt
> -sign
> > -inkey private.pem
> > and encrypting this text with my pvt key to get
> the
> > digital signatures.
> >
> > On the client side I am getting the digital
> > signatures.
> > The client has the public key of server.
> >
> > I am unable to get the hash from the digital
> > signatures using the public key ato decrypt it and
> > using RSA_public_decrypt().
> > Please Help
> >
> > Regards
> > Tarun
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> > protection around
> > http://mail.yahoo.com 
> >
>
______________________________________________________________________

> > OpenSSL Project http://www.openssl.org
> > Development Mailing List [hidden email]
> > Automated List Manager [hidden email]
> >
> >
> > ---------------------------------
> >  Start your day with Yahoo! - make it your home
> page
>
>
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs 
>  
>
______________________________________________________________________
> OpenSSL Project                                
> http://www.openssl.org
> Development Mailing List                      
> [hidden email]
> Automated List Manager                          
> [hidden email]
>



               
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs 
 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]