From: "Rob Withers" <rwithers12@attbi.com>
Date: Tue, 19 Nov 2002 22:53:31 -0500
Subject: *****SPAM***** Re: [e-lang] [VatTP] MAC calculation

SPAM: -------------------- Start SpamAssassin results ----------------------
SPAM: This mail is probably spam.   The original message has been altered
SPAM: so you can recognise or block similar unwanted mail in future.
SPAM: See http://spamassassin.org/tag/ for more details.
SPAM: 
SPAM: Content analysis details:   (6.9 hits, 5 required)
SPAM: FROM_ENDS_IN_NUMS  (0.4 points)  From: ends in numbers
SPAM: DOUBLE_CAPSWORD    (1.1 points)  BODY: A word in all caps repeated on the line
SPAM: MAILTO_TO_SPAM_ADDR (0.5 points)  URI: Includes a link to a likely spammer email address
SPAM: SUPERLONG_LINE     (0.4 points)  BODY: Contains a line >=199 characters long
SPAM: MAILTO_LINK        (0.8 points)  BODY: Includes a URL link to send an email
SPAM: DATE_IN_FUTURE_24_48 (3.7 points)  Date: is 24 to 48 hours after Received: date
SPAM: 
SPAM: -------------------- End of SpamAssassin results ---------------------

This is a multi-part message in MIME format. 

------=_NextPart_000_0086_01C2901E.7B5E6E40
Content-Type: text/plain; 
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Let me add a few more details to this, because it was certainly rather =
abrupt. 

I am caught up in the code in RecvThread>>readAndProcessMessage and =
SendThread>>sendBytes and SendThread>>addMessage.   I have 3DES with CBC, =
SHA1 but no HMAC, I am not adding message sequences nor compressing =
length headers.  My length headers are all 4 bytes.

my code for computeMac is (for those who are multilingual): 

VatTP3DesStream>>computeMac: bytes
        | stream | 
        stream :=3D (ReadWriteStream on: (ByteArray new: 256))
            nextPutAll: encryptionSecrets macKey; yourself.
        stream nextPutAll: bytes.
        stream nextPutAll: encryptionSecrets macKey.
        ^ SHA1 new hashStream: stream reset.

My decryption code is: 

VatTP3DesUpcallStream>>value: aStream
        | plainStream msg encrypted padded | 
        mac :=3D aStream next: 20.
        encrypted :=3D aStream upToEnd.
        padded :=3D self padBytes: encrypted.
        plainStream :=3D self decryptStream: padded readStream.
        (mac =3D (self computeMac: plainStream contents))
            ifFalse: [self error: 'mac incorrect'].
        [plainStream atEnd]
            whileFalse: [
                msg :=3D plainStream next: (plainStream next: 4) =
asInteger.
                self streamProtocolAdapter basicUpcallStream: msg =
readStream].

and encryption code is: 

VatTP3DesDowncallStream>>value: aStream
        | padded encrypted plain | 
        plain :=3D aStream upToEnd.
        mac :=3D self computeMac: plain.
        padded :=3D self padBytes: plain.
        encrypted :=3D (self encryptStream: padded readStream) upToEnd.
        bytes :=3D mac asByteArray, encrypted.
        self streamProtocolAdapter basicDowncallStream: bytes =
readStream.


regards,
robert 
  ----- Original Message -----=20
  From: Rob Withers=20
  To: e-lang@eros-os.org=20
  Sent: Tuesday, November 19, 2002 9:55 PM
  Subject: [e-lang] [VatTP] MAC calculation


  Hi, 

  I have a few questions about VatTP, that I looking for answers to.   I =
am having difficulty decoding the vatTP code in RecvThread and =
SendThread regarding the constituent bytes used for MAC, when msg =
aggregating.  Given a aggregate array of a size and 3 e-msgs, where each =
is bytes composed of a payload, the token for E_MSG and the size, can I =
just MAC that, or do I need to include padding?  =20

  Another question I have is whether it is important to include size =
bytes when computing the size.  Is the size inclusive to itself? 

  tia,=20
  robert 

------=_NextPart_000_0086_01C2901E.7B5E6E40
Content-Type: text/html; 
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD> 
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Let me add a few more details to this, =
because it=20
was certainly rather abrupt.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am caught up in the code in=20
RecvThread&gt;&gt;readAndProcessMessage and SendThread&gt;&gt;sendBytes =
and=20
SendThread&gt;&gt;addMessage.&nbsp; I have 3DES with CBC, SHA1 but no =
HMAC, I am=20
not adding message sequences nor compressing length headers.&nbsp; My =
length=20
headers are all 4 bytes.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>my code for computeMac is (for those =
who are=20
multilingual):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>VatTP3DesStream&gt;&gt;computeMac:=20
bytes</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; | =
stream=20
|<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; stream :=3D (ReadWriteStream =
on:=20
(ByteArray new: 256))<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; nextPutAll: encryptionSecrets macKey;=20
yourself.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; stream nextPutAll:=20
bytes.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; stream nextPutAll:=20
encryptionSecrets macKey.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ^ =
SHA1 new=20
hashStream: stream reset.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My decryption code is:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>VatTP3DesUpcallStream&gt;&gt;value:=20
aStream</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; | =
plainStream=20
msg encrypted padded |<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mac :=3D =
aStream=20
next: 20.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; encrypted :=3D =
aStream=20
upToEnd.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; padded :=3D self =
padBytes:=20
encrypted.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; plainStream :=3D =
self=20
decryptStream: padded readStream.<BR>&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; (mac=20
=3D (self computeMac: plainStream contents))<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse: [self error: 'mac=20
incorrect'].<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [plainStream=20
atEnd]<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
whileFalse:=20
[<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
msg :=3D plainStream next: (plainStream next: 4) =
asInteger.<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self=20
streamProtocolAdapter basicUpcallStream: msg =
readStream].<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>and encryption code=20
is:</FONT></DIV></FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2>
<DIV>&nbsp;</DIV>
<DIV>VatTP3DesDowncallStream&gt;&gt;value: =
aStream</FONT></DIV></DIV></FONT>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; | =
padded=20
encrypted plain |<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; plain :=3D =
aStream=20
upToEnd.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mac :=3D self =
computeMac:=20
plain.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; padded :=3D self =
padBytes:=20
plain.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; encrypted :=3D (self=20
encryptStream: padded readStream) upToEnd.<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; bytes :=3D mac asByteArray, =
encrypted.<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; self streamProtocolAdapter basicDowncallStream: bytes =

readStream.<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV> 
<DIV><FONT face=3DArial size=3D2>regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>robert</DIV></FONT>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Drwithers12@attbi.com =
href=3D"mailto:rwithers12@attbi.com">Rob=20
  Withers</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3De-lang@eros-os.org=20
  href=3D"mailto:e-lang@eros-os.org">e-lang@eros-os.org</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, November 19, =
2002 9:55=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [e-lang] [VatTP] MAC=20
  calculation</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>I have a few questions about VatTP, =
that I=20
  looking for answers to.&nbsp; I am having difficulty decoding the =
vatTP code=20
  in RecvThread and SendThread regarding the constituent bytes used for =
MAC,=20
  when msg aggregating.&nbsp; Given a aggregate&nbsp;array of a size =
and&nbsp;3=20
  e-msgs, where each is bytes composed of a payload, the token for E_MSG =
and the=20
  size, can I just MAC that, or do I need to include =
padding?&nbsp;&nbsp;=20
  </FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Another question I have is whether it =
is=20
  important to include size bytes when computing the size.&nbsp; Is the =
size=20
  inclusive to itself?</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>tia, </FONT></DIV>
  <DIV><FONT face=3DArial =
size=3D2>robert</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0086_01C2901E.7B5E6E40--

_______________________________________________
e-lang mailing list
e-lang@mail.eros-os.org
http://www.eros-os.org/mailman/listinfo/e-lang