i have some troubles obtaining the right result with sfl.. pls help..

Mihai Badea <[email protected]> Tue, 26 Oct 2004 11:40:35 +0300
Newsgroups gmane.ietf.sfl
Message-ID <[email protected]>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
hello everybody,<br>
i am trying to do simple s/mime operations with e-mail:<br>
sign, verify, encrypt, decrypt - using a valid thawte certificate
stored on disc and a password<br>
i am testing the result in mozilla 1.7.3 on a gentoo system<br>
i have compiled latest versions of smp, esnacc and crypto++<br>
it seems that i am having some trouble, as mozilla doesn't read
properly the cms&nbsp; content in s/mime entities.<br>
please help me with one thing:<br>
<br>
i am trying to sign a message:<br>
<br>
<font color="#000099"><big><tt><small>&nbsp;&nbsp;&nbsp; const char *msg =
"Content-Type: text/plain; charset=us-ascii;
format=flowed\r\nContent-Transfer-Encoding: 7bit\r\n\r\nbau\r\n";<br>
&nbsp;&nbsp;&nbsp; const int len = strlen(msg);<br>
&nbsp;&nbsp;&nbsp; const CSM_Buffer encapcontent(msg, len);<br>
&nbsp;&nbsp;&nbsp; CSM_MsgToSign msgtosign;<br>
&nbsp;&nbsp;&nbsp; msgtosign.SetEncapContentClear((const CSM_Buffer
&amp;)encapcontent);<br>
&nbsp;&nbsp;&nbsp; msgtosign.SetIncludeContentFlag(false);<br>
&nbsp;&nbsp;&nbsp; msgtosign.SetIncludeOrigCertsFlag(true);<br>
&nbsp;&nbsp;&nbsp; CSM_AppLogin *papplogin = new CSM_AppLogin;<br>
&nbsp;&nbsp;&nbsp; papplogin-&gt;AddLogin("libsm_free3DLL", "sm_free3DLL \"cert.p12\"
password");<br>
&nbsp;&nbsp;&nbsp; if (msgtosign.Sign(papplogin) == SM_NO_ERROR) printf("Signed
succesfully.\n");<br>
&nbsp;&nbsp;&nbsp; CSM_Buffer *hau = msgtosign.GetEncodedContentInfo();<br>
&nbsp;&nbsp;&nbsp; delete hau;<br>
&nbsp;&nbsp;&nbsp; ((CSM_Buffer
*)msgtosign.AccessEncapContentClear())-&gt;ConvertMemoryToFile("_SIGNED.tmp");<br>
</small></tt></big></font>
<br>
the code works ok.. i get the binary output in a file<br>
then i convert the file "_SIGNED.tmp" to base64:<br>
<font color="#663366"><tt>&nbsp;&nbsp;&nbsp; uuenview -b -o _SIGNED.tmp<br>
</tt></font>then i copy the base64 data to an mime entity in an eml
file which i edit by hand<br>
and i insert the whole message into a mozilla local folder (storage
file)<br>
<br>
if i use:<br>
<font color="#663366"><tt>&nbsp;&nbsp;&nbsp; msgtosign.SetIncludeContentFlag(true)<br>
</tt></font>then i use application/pcks7-mime signed-data type for the
encapsulating mime entity<br>
<br>
if i use:<br>
<font color="#663366"><tt>&nbsp;&nbsp;&nbsp; msgtosign.SetIncludeContentFlag(false)<br>
</tt></font>then i use application/pkcs7-signature in a multipart/signed<br>
<br>
i even tried to base64 encode and insert into an email the outputs from
the smp test program:<br>
<font color="#663366"><tt>&nbsp;&nbsp;&nbsp; /SMP_Check/SMP_Check<br>
</tt></font>which is for example:<br>
<font color="#663366"><tt>&nbsp;&nbsp;&nbsp; TMPFirstSignedDataBinary.dat<br>
</tt></font><br>
again mozilla gave me errors like (signed, but invalid signature,
encrypted with unknown method, etc).<br>
though, the messages encrypted with mozilla work even if i edit eml
files, decode them, encode again, change mime entities and insert back
emails to local folder storage files. in worst cases i get an
(signature does not match message error) because the checksum does't
match anymore, but i can still view certificate infos etc.<br>
<br>
i once decoded a signature from mozilla<br>
and in the same time buid a signature for the same content and
certificate<br>
the binary files resulting were diffrent<br>
maybe it would help me if i could compare both of them in asn.1 output
to see the differences, but i didn't manage to do this yet<br>
<br>
<u>please</u> some one tell me why the way i sign messages is not
compatible with mozilla (which i think is the most representative
secure mail for linux) or at least some how can i be sure that i am
creating the correct cms data.<br>
<br>
as a documentation i used the sfl 2.4 api pdf, which isn't quite a
practical guide, and the sources in examples. somebody wrote perhaps a
tutorial or something? (i would be glad to if i knew better the sfl :)<br>
<br>
thank you!!<br>
RumburaK<br>
<br>
</body>
</html>