<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18943"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT size=2 face=Arial>Hi Denis,</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>I originally wrote the v15 signature methods in
April of 2007. I am currently trying to download the PKCS#11 V2.30 doc to
verify, but IIRC there are more than one signature algorithm defined for
RSA. I don't recall why I chose v15. Perhaps Java is using another
RSA signature function.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>There are no explicit tests for this
signature. There is a test inside of the CryptoX509Test
(#verifySHA1WithRSAEncryptionFromParentCertificate: ), but it isn't used as the
certificate that exposed it has expired and so is failing. I removed that
certificate test.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Let's talk bytes...the way this works in Squeak is
that the RSA pads the SHA1 hashed message and encrypts it.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>v15SignMessage: aMessage</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial> ^ self v15SignMessageHash: (SHA1 hashMessage:
aMessage).<BR></FONT></DIV>
<DIV><FONT size=2 face=Arial>and</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>v15SignMessageHash: encodedMsg</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial> | padded toBeSigned |<BR> padded :=
ByteArray new: (256 - encodedMsg size - 3) withAll: 255.<BR> toBeSigned :=
#(0) asByteArray, #(1) asByteArray, padded, #(0) asByteArray,
encodedMsg.<BR> ^ (self crypt: toBeSigned asInteger)
asByteArray.<BR></FONT></DIV>
<DIV><FONT size=2 face=Arial>Presumably the #crypt: function will be the same in
Java and Squeak given the same key. So if there are 2 different signature
functions in RSA, I would suspect that the padding would be
different.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Still trying to download the spec....</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>What do you think?</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Cheers,</FONT></DIV>
<DIV><FONT size=2 face=Arial>Rob</DIV></FONT>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A
title="mailto:dionisiydk@gmail.com CTRL + Click to follow link"
href="mailto:dionisiydk@gmail.com">Denis Kudriashov</A> </DIV>
<DIV><B>Sent:</B> Tuesday, September 21, 2010 11:21 AM</DIV>
<DIV><B>To:</B> <A
title="mailto:squeak-dev@lists.squeakfoundation.org CTRL + Click to follow link"
href="mailto:squeak-dev@lists.squeakfoundation.org">The general-purpose Squeak
developers list</A> </DIV>
<DIV><B>Subject:</B> [squeak-dev] Crypto RSAWithSHA1 sign</DIV></DIV></DIV>
<DIV><FONT size=2 face=Arial></FONT><BR></DIV>Hello <BR><BR>Is somebody use
Cryptography for RSA with SHA1 digital signature?<BR><BR>I try do same result as
I hava in java programm<BR>I have rsa private key as smalltalk object. It has
same values as java private key object.<BR><BR>But code<BR><BR>privateKey
v15SignMessage: message asByteArray .<BR><BR>returns me wrong result. Its
differ from java working test<BR>
<P>
<HR>
<P></P><BR></BODY></HTML>