[pycrypto] Create a Digital Signature (DER Encoded PKCS#1) - SHA1withRSA
Anurag Chourasia
anurag.chourasia at gmail.com
Tue Dec 28 14:14:18 CST 2010
Hi Thorsten,
Thanks for the response.
It wasn't for Home Work :-)
I went through some examples and I understand that to achieve my goal i have
to do two things.
1. Compute the Hash Value of my Data.
2. Sign the computed Hash Value with my Private Key.
To achieve 1 above, i believe that the following code will help me (assuming
that data is ABC).
from Crypto.Hash import SHA
m = SHA.new()
m.update('ABC')
What I am not sure is if I should use
m.digest()
or
m.hexdigest() as the computed hash value.
Following this, how can i use Crypto again to Sign the computed Hash Value
using the Private Key?
Appreciate your help on this.
Regards,
Anurag
On Wed, Dec 29, 2010 at 1:32 AM, Thorsten Behrens <sbehrens at gmx.li> wrote:
> On 12/28/2010 2:44 PM, Anurag Chourasia wrote:
> >
> > I have a Private key and Public Key which comes in an XML in the
> > following form.
> [..]
> > Could you please let me know how I could use Crypto to meet this
> > requirement. Appreciate if you could help me with a simple code snippet.
> >
>
> Is this homework? :)
>
> If so, I'd give you a hint: Take a good look at the test routines in
> Crypto/Selftest, they are examples of how to use the library.
>
> Thorsten
>
> _______________________________________________
> pycrypto mailing list
> pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dlitz.net/pipermail/pycrypto/attachments/20101229/c9dade59/attachment.htm
More information about the pycrypto
mailing list