Hi all,
I'm trying to sign and verify signature in S/MIME e-mails. I use Synapse for
parsing e-mails and CAPICOM / CryptoAPI for creating/verifying signature.
I had no problem implementing work with attached signatures, but I got stuck
with detached signatures and inability to create correct hash value.
As far as I know there may be two possible problems with my code:
 - I either can't transform native Delphi6 string into CAPICOM-aware unicode
string (fixed-width type widestring in delphi) or
 - I'm not extracting all the necessary parts of message to verify.
I tried using both CAPICOM and CryptoAPI with no luck. Messages created in
my application can't be verified by outlook ("Message content was modified"
aka wrong hash value), and e-mails from outlook can't be verified from my
app. Anyway I can verify whatever I sign in my application...
I tried three ways for converting strings:
 - based on IUtilities.ByteArrayToBinaryString
 - based on Windows.MultiByteToWideChar
 - touching the head of widestring value and changing its length so as to
make it even.
When extracting message part to be verified I basically just take the first
part of Multipart/Signed data, convert it into what I suppose to be
CAPICOM-aware unicode encoded string and set it into SignedData.Content
property. Then I call SignedData.Verify method, giving it base64-encoded
signature from second part and boolean value indicating detached signature.
I always end up with "Wrong hash value" OLEException ("Hodnota hash není
správná" in czech language).
Is there anything wrong with my procedure of verifying the signature? Once
again, I have problem only with detached signatures (attached are ok), no
matter whether using CAPICOM or directly CryptoApi. In case of interest I
can post some source code, I just didn't want to make this post any
longer...
Thanks in advance for any reply!
Petr Cerny
czerni...@gmail.com
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to