05.06.2007 12:39:58Параметр функции CryptDecryptMessage() Ответов: 0
Никита
У функции CryptDecryptMessage() есть последний параметр ppXchgCert.

Как написано в MSDN:

ppXchgCert
[out, optional] Pointer to a CERT_CONTEXT structure of a certificate
that corresponds to the private exchange key needed to decrypt the
message. To indicate that the function should not return the
certificate context used to decrypt, set this parameter to NULL.

When NULL is passed for pbDecrypted, and pcbDecrypted is not NULL,
NULL is returned for the address passed in ppXchgCert; otherwise,
a pointer to a CERT_CONTEXT is returned. For a successfully decrypted
message, this pointer to a CERT_CONTEXT points to the certificate
context used to decrypt the message. It must be freed by calling
CertFreeCertificateContext. If the function fails, the value at
ppXchgCert is set to NULL.

Под Windows значение этого параметра корректное и я могу получить
имя отправителя, зашифровавшего сообщение. Но под Linux возвращается
какое-то некорректное значение этого параметра. Вывод значений этой
структуры выдает большие числа, явно некорректные. Я посмотрел
исходные тексты утилиты csptest (файлы cryptenc.c и cryptsf.c) и нашел,
что в этой утилите при вызове этой функции последний параметр NULL,
т. е. не используется. Конечно, это не очень критично, но хотелось бы
получать имя отправителя, зашифровавшего сообщение.

Это проблема в реализации функций CryptoAPI под Linux или еще
в чем-то? Что Вы мне посоветуете для решения этой проблемы?