У меня были проблемы с подписями SMIME. Я правда не подружился с CAPICOM и использовал классы из System.Security.Cryptography.Pkcs и System.Security.Cryptography.X509Certificates. Для реализации стандарта AS2 мне вполне хватило.
Проблема появлялась в момент проверки цифровой подписи, "Hash value is not correct", что по сути и есть "The message has been tampered with". Причина — отсутствовал "CR/LF in the data to be hashed/signed"
(с известного уже сайта
http://www.jensign.com/JavaScience/verify/smimenote.html)
Однако есть более серьезные проблемы, когда речь заходит о взаимодействии .NET — CAPICOM. См. мою переписку с тем самым Mitch Gallant (тема Digital Signatures, третий сверху пост Mitch'a)
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?query=Digital+Signatures&dg=microsoft.public.security.crypto&cat=en_US_1cefdee4-477c-4f8e-af64-5e30b5862742&lang=en&cr=US&pt=&catlist=&dglist=&ptlist=&exp=&sloc=en-us
> The second question is. When I use .NET 2.0 utilities or CAPICOM to verify a
> signature that is (supposedly) produced by Crypt32.dll, I get an error "The
> hash value is not correct". Do you happen to know what the problem might be?
>
That is a common problem with .NET and com interop with CAPICOM. Has to
do with one of two problems:
(1) String marshalling from COM to .NET
(2) CAPICOM uses UNICODE representation of string-data signed, so if you
are verifying a detached signature file, make sure your verification programme compares
the CORRECT source data that was hashed.
A good way to troubleshoot this is check the signature verification using vbscripts in
CAPICOM first ... when you get that verification working properly, then tackle the
..NET COM interop beast!
Some starter info on sig verification in CAPICOM, UNICODE and all that stuff:
<i>http://www.jensign.com/JavaScience/verify</i>
данное сообщение получено с www.gotdotnet.ru
ссылка на оригинальное сообщение