diff options
Diffstat (limited to 'pipermail/pycrypto/2014q1/000785.html')
-rw-r--r-- | pipermail/pycrypto/2014q1/000785.html | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/pipermail/pycrypto/2014q1/000785.html b/pipermail/pycrypto/2014q1/000785.html new file mode 100644 index 0000000..73c1391 --- /dev/null +++ b/pipermail/pycrypto/2014q1/000785.html @@ -0,0 +1,108 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [pycrypto] Got different PKCS1_v1_5 signature result on the same message & same rsa key pair + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=Re%3A%20%5Bpycrypto%5D%20Got%20different%20PKCS1_v1_5%20signature%20result%20on%20the%0A%20same%20message%20%26%20same%20rsa%20key%20pair&In-Reply-To=%3CCAHAkNZ1T0AD9rdOO4Z-qNDtJW__D4yzAVb8zSSfLeGpLErCbwg%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000784.html"> + <LINK REL="Next" HREF="000786.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[pycrypto] Got different PKCS1_v1_5 signature result on the same message & same rsa key pair</H1> + <B>Philip Horger</B> + <A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=Re%3A%20%5Bpycrypto%5D%20Got%20different%20PKCS1_v1_5%20signature%20result%20on%20the%0A%20same%20message%20%26%20same%20rsa%20key%20pair&In-Reply-To=%3CCAHAkNZ1T0AD9rdOO4Z-qNDtJW__D4yzAVb8zSSfLeGpLErCbwg%40mail.gmail.com%3E" + TITLE="[pycrypto] Got different PKCS1_v1_5 signature result on the same message & same rsa key pair">campadrenalin at gmail.com + </A><BR> + <I>Tue Mar 11 22:55:16 PDT 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000784.html">[pycrypto] Got different PKCS1_v1_5 signature result on the same message & same rsa key pair +</A></li> + <LI>Next message: <A HREF="000786.html">[pycrypto] Got different PKCS1_v1_5 signature result on the same message & same rsa key pair +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#785">[ date ]</a> + <a href="thread.html#785">[ thread ]</a> + <a href="subject.html#785">[ subject ]</a> + <a href="author.html#785">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>I'm not the king of crypto, but if I recall correctly, some signature +standards (and I think PKCS1 is one of them) include a random salt in the +signature. This happens automatically, behind the scenes, on your behalf. +So two signatures can be of the same content, with the same key, and not be +equal - in fact, it's dramatically more likely than not! So you can't rely +on bit-for-bit equality of signatures. + + +On Tue, Mar 11, 2014 at 8:22 PM, wanggang +<<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">wanggang at goldenapptechnology.com</A>>wrote: + +><i> Hi pycrypto, +</I>><i> +</I>><i> This may be a simple problem since I am a newbiee to crypto. +</I>><i> I am not sure why I got different result from +</I>><i> PKCS1_v1_5.new(RSA.construct(lst)).sign(SHA.new(a2b(m))) , +</I>><i> I have mentioned the 'stateful' comment in API doc, but still can't fix +</I>><i> the code below. +</I>><i> besides I have used DES for a lot, & never got stuck in such situation. +</I>><i> +</I>><i> if __name__ == "__main__": +</I>><i> t = (modulus, publicExponent, privateExponent, prime1, prime2, +</I>><i> coefficient) +</I>><i> lst = [long(x,16) for x in t] +</I>><i> +</I>><i> k = '1234' +</I>><i> e1 = RSA.construct(lst).encrypt(m, k) +</I>><i> e2 = RSA.construct(lst).encrypt(m, k) +</I>><i> assert e1 == e2 # passed +</I>><i> +</I>><i> signature1 = PKCS1_v1_5.new(RSA.construct(lst)).sign(SHA.new(a2b(m))) +</I>><i> print binascii.b2a_hex(signature1) +</I>><i> signature2 = PKCS1_v1_5.new(RSA.construct(lst)).sign(SHA.new(a2b(m))) +</I>><i> print binascii.b2a_hex(signature2) +</I>><i> assert signature1==signature2 # why this assertion failed ? +</I>><i> +</I>><i> Thank you in advance! +</I>><i> -------------- +</I>><i> Wang Gang +</I>><i> _______________________________________________ +</I>><i> pycrypto mailing list +</I>><i> <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">pycrypto at lists.dlitz.net</A> +</I>><i> <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto</A> +</I>><i> +</I>-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.dlitz.net/pipermail/pycrypto/attachments/20140311/b842a24a/attachment.html">http://lists.dlitz.net/pipermail/pycrypto/attachments/20140311/b842a24a/attachment.html</A>> +</PRE> + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000784.html">[pycrypto] Got different PKCS1_v1_5 signature result on the same message & same rsa key pair +</A></li> + <LI>Next message: <A HREF="000786.html">[pycrypto] Got different PKCS1_v1_5 signature result on the same message & same rsa key pair +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#785">[ date ]</a> + <a href="thread.html#785">[ thread ]</a> + <a href="subject.html#785">[ subject ]</a> + <a href="author.html#785">[ 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> |