RE: I am clearly missing something. General Questions

"Magnus Svensson" <[email protected]> Tue, 20 Mar 2001 09:26:02 +0100
Newsgroups gmane.ietf.smime-examples
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------=_NextPart_000_0019_01C0B11F.C8C32A70
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Glenn,

The Cryptographic Message Syntax (RFC 2630) is a must when working with
S/MIME ASN.1 structures since most of them are described there. This RFC and
related documents can be retrieved from
http://www.ietf.org/html.charters/smime-charter.html.

The id-RSAES-OAEP you describe should be encoded as: 2A 86 48 86 F7 0D 01 01
07

If you are unsure of how the ASN.1 coding works, check out "A Layman's Guide
to a Subset of ASN.1, BER, and DER" at
ftp://ftp.rsasecurity.com/pub/pkcs/ascii/layman.asc.

/Magnus

-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Glen Kleidon
Sent: Tuesday, March 20, 2001 4:47 AM
To: [email protected]
Subject: I am clearly missing something. General Questions


I  am trying to come to grips with the SMIME.   I am getting there I think
but I am just missing a couple of bits of info.  Perhaps there is a RFC I
haven't read which answers all these questions.

In the examples (draft-ietf-smime-examples-06.txt) I could not understand
how you get 9 bytes for the DES3/RSA oid but I have now been told that you
encode the
first two digits as a+40 + b but is that 43 (2B)  or $40 + $02 + $01 = $43
and the large number > 7f in multiple bytes.  Are these large numbers
encoded in Lowbyte/Highbyte format?

eg the new id-RSAES-OAEP   is iso(1) member-body(2) us(840) rsadsi(113549)
pkcs(1) pkcs-1(1) 7  again 10 bytes
  would that be
2B 03 48 01 BB 8D 01 01 07   or
43 03 48 01 BB 8D 01 01 07   or
2B 48 03 01 8D BB 01 01 07   or
43 48 03 01 8D BB 01 01 07   or
or something else?

Also, are the lengths low/high byte too
eg in example 6.1 should the sequence be  for

0 30  286: SEQUENCE {
4 06    9:   OBJECT IDENTIFIER envelopedData (1 2 840 113549 1 7 3)
         :     (PKCS #7)
15 A0  271:   [0] {             --- I can't get this line either?
19 30  267:     SEQUENCE {
23 02    1:       INTEGER 0

30 1E 01 06 09 2B 03 48 01 BB 8D 01 07 03 0A 0F 01 00 30 0B 01 02 01 00
     ??   ??         ??
??         ??  ??

And should the lengths for integer data have 4 bytes ? and what about the
octec strings?

Second, when I base64 decode your examples it is in what appears to be
UNICODE.  It isn't though.  I can't see how you go from the sequence above
to the data I get after base 64 decoding the example.  If there is a RFC or
other document which explains these things could you tell me what it is?

------=_NextPart_000_0019_01C0B11F.C8C32A70
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=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D610271408-20032001><FONT face=3DArial color=3D#0000ff =

size=3D2>Glenn,</FONT></SPAN></DIV>
<DIV><SPAN class=3D610271408-20032001><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D610271408-20032001><FONT face=3DArial color=3D#0000ff =
size=3D2>The=20
Cryptographic Message Syntax (RFC 2630) is a must when working with =
S/MIME ASN.1=20
structures since most of them are described there. This RFC and related=20
documents can be retrieved from <A=20
href=3D"http://www.ietf.org/html.charters/smime-charter.html">http://www.=
ietf.org/html.charters/smime-charter.html</A>.</FONT></SPAN></DIV>
<DIV><SPAN class=3D610271408-20032001><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D610271408-20032001><FONT face=3DArial color=3D#0000ff =
size=3D2>If you=20
are unsure of how the ASN.1 coding works, check out "<FONT =
color=3D#000000>A=20
Layman's Guide to a Subset of ASN.1, BER, and DER" at =
</FONT></FONT></SPAN><SPAN=20
class=3D610271408-20032001><FONT face=3DArial color=3D#0000ff =
size=3D2><A=20
href=3D"ftp://ftp.rsasecurity.com/pub/pkcs/ascii/layman.asc">ftp://ftp.rs=
asecurity.com/pub/pkcs/ascii/layman.asc</A><FONT=20
color=3D#000000>.</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D610271408-20032001><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D610271408-20032001><FONT face=3DArial size=3D2>The =
example with=20
RS</FONT></SPAN></DIV>
<DIV><SPAN class=3D610271408-20032001></SPAN><FONT face=3D"Times New =
Roman"=20
size=3D2>-----Original Message-----<BR><B>From:</B>=20
[email protected]=20
[mailto:[email protected]]<B>On Behalf Of</B> Glen=20
Kleidon<BR><B>Sent:</B> Tuesday, March 20, 2001 4:47 AM<BR><B>To:</B>=20
[email protected]<BR><B>Subject:</B> I am clearly missing =
something.=20
General Questions<BR><BR></DIV></FONT>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV><FONT face=3DArial size=3D2>
  <DIV><FONT face=3DArial size=3D2>I&nbsp; am trying to come to grips =
with the=20
  SMIME.&nbsp;&nbsp; I am getting there I think but I am just missing a =
couple=20
  of bits of info.&nbsp; Perhaps there is a RFC I haven't read which =
answers all=20
  these questions.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>In&nbsp;the examples=20
  (draft-ietf-smime-examples-06.txt) I could not understand how you get =
9 bytes=20
  for the DES3/RSA oid but I have now been told that you encode =
the</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>first two digits as a+40 + b but is =
that=20
  43&nbsp;(2B)&nbsp; or $40 + $02&nbsp;+ $01 =3D $43 and the large =
number &gt; 7f=20
  in multiple bytes.&nbsp; Are these large numbers encoded in =
Lowbyte/Highbyte=20
  format?</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>eg&nbsp;the new =
id-RSAES-OAEP&nbsp;&nbsp; is=20
  <FONT face=3DCourier size=3D2><FONT face=3DArial><FONT face=3DArial =
size=3D2>iso(1)=20
  member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 7&nbsp; again =
10=20
  bytes</FONT></FONT></FONT></FONT></DIV><FONT face=3DArial size=3D2>
  <DIV><FONT face=3DCourier size=3D2><FONT =
face=3DArial></FONT></FONT>&nbsp; would=20
  that be &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </DIV>
  <DIV><FONT face=3D"Courier New">2B 03 48 01 BB 8D 01 01 07&nbsp;&nbsp; =

  or</FONT></DIV>
  <DIV><FONT face=3D"Courier New">43&nbsp;03 48 01 BB 8D 01 01 =
07&nbsp;&nbsp;=20
  or</FONT></DIV>
  <DIV><FONT face=3D"Courier New"><FONT face=3DArial>
  <DIV><FONT face=3D"Courier New">2B 48 03 01 8D BB 01 01 07&nbsp;&nbsp; =

  or</FONT></DIV></FONT>
  <DIV><FONT face=3D"Courier New">43&nbsp;48 03 01 8D BB 01 01 =
07&nbsp;&nbsp;=20
  or</FONT></DIV>
  <DIV>or something else?</DIV>&nbsp; </FONT><FONT =
size=3D2></FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Also, are the lengths low/high byte=20
  too</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>eg in example 6.1 should the sequence =
be&nbsp;=20
  for</FONT></DIV>
  <DIV><FONT size=3D2><FONT face=3DArial></FONT><BR><FONT =
face=3D"Courier New">0=20
  30&nbsp; 286: SEQUENCE=20
  =
{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></FON=
T>=20
  <DIV><FONT face=3D"Courier New" size=3D2>4 06&nbsp;&nbsp;&nbsp; =
9:&nbsp;&nbsp;=20
  OBJECT IDENTIFIER envelopedData (1 2 840 113549 1 7=20
  3)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  :&nbsp;&nbsp;&nbsp;&nbsp; (PKCS #7)<BR>15 A0&nbsp; 271:&nbsp;&nbsp; =
[0]=20
  =
{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;---=20
  I can't get this line either?<BR>19 30&nbsp; =
267:&nbsp;&nbsp;&nbsp;&nbsp;=20
  SEQUENCE {<BR>23 02&nbsp;&nbsp;&nbsp; =
1:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  INTEGER 0</FONT></DIV>
  <DIV><FONT size=3D2><FONT face=3D"Courier =
New"></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT size=3D2><FONT face=3D"Courier New">30 1E 01 06 09 2B 03 48 =
01 BB 8D 01=20
  07 03 0A 0F 01&nbsp;00 30 0B 01&nbsp;02 01 00</FONT></FONT></DIV>
  <DIV><FONT size=3D2><FONT face=3D"Courier New">&nbsp;</FONT><FONT=20
  face=3DArial>&nbsp;&nbsp;&nbsp; ??&nbsp;&nbsp;=20
  =
??&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;??&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  ??&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;??&nbsp; =
??&nbsp;=20
  </FONT></FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>And&nbsp;should&nbsp;the lengths for =
integer data=20
  have 4 bytes&nbsp;? and what about the octec strings? </FONT></DIV>
  <DIV>&nbsp;</DIV></DIV>
  <DIV><FONT face=3DArial size=3D2>Second, when I base64 =
decode&nbsp;your examples=20
  it is in what appears to be UNICODE.&nbsp; It isn't though.&nbsp; I =
can't see=20
  how you go from the sequence&nbsp;above to the data I get after base =
64=20
  decoding the example.&nbsp; If there is&nbsp;a RFC or other document =
which=20
  explains these things could you tell me what it is?</FONT></DIV>
  <DIV>&nbsp;</DIV></FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0019_01C0B11F.C8C32A70--