summaryrefslogtreecommitdiff
path: root/pipermail/pycrypto/2010q4/000337.html
blob: 89a1734c22f92d0ff715a304a1491ad06ceae481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [pycrypto] Create a Digital Signature (DER Encoded PKCS#1) -	SHA1withRSA
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Create%20a%20Digital%20Signature%20%28DER%20Encoded%20PKCS%231%29%20-%0A%09SHA1withRSA&In-Reply-To=4D1A4272.5080002%40gmx.li">
   <META NAME="robots" CONTENT="index,nofollow">
   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
   <LINK REL="Previous"  HREF="000335.html">
   <LINK REL="Next"  HREF="000340.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[pycrypto] Create a Digital Signature (DER Encoded PKCS#1) -	SHA1withRSA</H1>
    <B>Anurag Chourasia</B> 
    <A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Create%20a%20Digital%20Signature%20%28DER%20Encoded%20PKCS%231%29%20-%0A%09SHA1withRSA&In-Reply-To=4D1A4272.5080002%40gmx.li"
       TITLE="[pycrypto] Create a Digital Signature (DER Encoded PKCS#1) -	SHA1withRSA">anurag.chourasia at gmail.com
       </A><BR>
    <I>Tue Dec 28 14:14:18 CST 2010</I>
    <P><UL>
        <LI>Previous message: <A HREF="000335.html">[pycrypto] Create a Digital Signature (DER Encoded PKCS#1) - SHA1withRSA
</A></li>
        <LI>Next message: <A HREF="000340.html">[pycrypto] Create a Digital Signature (DER Encoded PKCS#1) - SHA1withRSA
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#337">[ date ]</a>
              <a href="thread.html#337">[ thread ]</a>
              <a href="subject.html#337">[ subject ]</a>
              <a href="author.html#337">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>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 &lt;<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">sbehrens at gmx.li</A>&gt; wrote:

&gt;<i> On 12/28/2010 2:44 PM, Anurag Chourasia wrote:
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; I have a Private key and Public Key which comes in an XML in the
</I>&gt;<i> &gt; following form.
</I>&gt;<i> [..]
</I>&gt;<i> &gt; Could you please let me know how I could use Crypto to meet this
</I>&gt;<i> &gt; requirement. Appreciate if you could help me with a simple code snippet.
</I>&gt;<i> &gt;
</I>&gt;<i>
</I>&gt;<i> Is this homework? :)
</I>&gt;<i>
</I>&gt;<i> If so, I'd give you a hint: Take a good look at the test routines in
</I>&gt;<i> Crypto/Selftest, they are examples of how to use the library.
</I>&gt;<i>
</I>&gt;<i> Thorsten
</I>&gt;<i>
</I>&gt;<i> _______________________________________________
</I>&gt;<i> pycrypto mailing list
</I>&gt;<i> <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">pycrypto at lists.dlitz.net</A>
</I>&gt;<i> <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto</A>
</I>&gt;<i>
</I>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <A HREF="http://lists.dlitz.net/pipermail/pycrypto/attachments/20101229/c9dade59/attachment.htm">http://lists.dlitz.net/pipermail/pycrypto/attachments/20101229/c9dade59/attachment.htm</A> 
</PRE>
















<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000335.html">[pycrypto] Create a Digital Signature (DER Encoded PKCS#1) - SHA1withRSA
</A></li>
	<LI>Next message: <A HREF="000340.html">[pycrypto] Create a Digital Signature (DER Encoded PKCS#1) - SHA1withRSA
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#337">[ date ]</a>
              <a href="thread.html#337">[ thread ]</a>
              <a href="subject.html#337">[ subject ]</a>
              <a href="author.html#337">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">More information about the pycrypto
mailing list</a><br>
</body></html>