From: "Rob Withers" <rwithers12@attbi.com>
Date: Wed, 20 Nov 2002 01:44:30 -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_00C0_01C29036.5E6E0EE0
Content-Type: text/plain; 
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Never mind these questions, folks, I managed to find the issue.  CBC was =
broken and so I disabled it.   I am feeding the padded plaintext, on the =
Receive side, to the computeMac: method.  I see that I need to go ahead =
and unmarshall the aggregated msgs, to remove the pad.  The part that =
makes me shudder is recalculating each msg header for feeding the SHA1 =
hash function.  Other than this it is working.   :) frantz

rob
  ----- Original Message -----=20 
  From: Rob Withers=20
  To: e-lang@eros-os.org=20
  Sent: Tuesday, November 19, 2002 10:53 PM
  Subject: Re: [e-lang] [VatTP] MAC calculation


  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_00C0_01C29036.5E6E0EE0
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>Never mind these questions, folks, I =
managed to=20
find the issue.&nbsp; CBC was broken and so I disabled it.&nbsp; I am =
feeding=20
the padded plaintext, on the Receive side, to the computeMac: =
method.&nbsp; I=20
see that I need to go ahead and unmarshall the aggregated msgs, to =
remove the=20
pad.&nbsp; The part that makes me shudder is recalculating each msg =
header for=20
feeding the SHA1 hash function.&nbsp; Other than this it is =
working.&nbsp;&nbsp;=20
:)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>rob</FONT></DIV>
<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 10:53=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [e-lang] [VatTP] =
MAC=20
  calculation</DIV>
  <DIV><BR></DIV>
  <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=20
  am not adding message sequences nor compressing length headers.&nbsp; =
My=20
  length 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; =
|=20
  plainStream msg encrypted padded |<BR>&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
  mac :=3D aStream next: 20.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
encrypted :=3D=20
  aStream upToEnd.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; padded :=3D =
self=20
  padBytes: encrypted.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
plainStream :=3D=20
  self decryptStream: padded readStream.<BR>&nbsp;&nbsp;&nbsp;=20
  &nbsp;&nbsp;&nbsp; (mac =3D (self computeMac: plainStream=20
  contents))<BR>&nbsp;&nbsp;&nbsp; &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;=20
  &nbsp;&nbsp;&nbsp; msg :=3D plainStream next: (plainStream next: 4)=20
  asInteger.<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =

  &nbsp;&nbsp;&nbsp; self streamProtocolAdapter basicUpcallStream: msg=20
  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=20
  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 =

    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=20
    and&nbsp;3 e-msgs, where each is bytes composed of a payload, the =
token for=20
    E_MSG and the size, can I just MAC that, or do I need to include=20
    padding?&nbsp;&nbsp; </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=20
size=3D2>robert</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_00C0_01C29036.5E6E0EE0--

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