[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MsgToDecrypt usage (how-to...)

Some informations concerning this little code snap-shot:

- pBufToDecrypt points to a CSM_Buffer constructed with a file that contain the
(binary (base64 decoded)) CMS part of an S/MIME E-Mail (the resulting binary
file was first successfully dumped using dumpasn utility and it's a
pkcs-7-envelopedData (1 2 840 113549 1 7 3).
- m_EngineLogin.GetCSMIME() returns a CSMIME* that was previously initialized
with SM_Free3D login using a X.509 Public Certificate, a PKCS#8
Encrypted-PrivateKey and the password (this login works and the corresponding
CSM_CSInst has been maked as USE-THIS and APPLICABLE.
- The CSMIME* mentionned above was initialised with the E-Mail recipient's
Key-Pair (so we have in hand the right private key to decrypt the CMS part).

Since we have everything in hand to decrypt the pkcs-7-envelopedData I wanted to
know WHY it don't works and what do I have to do in order to make this work.

CSM_Buffer* pBufToDecrypt = new

CSM_ContentInfoMsg* pContentToDecrypt = new CSM_ContentInfoMsg(pBufToDecrypt);

CSM_MsgToDecrypt msgToDecrypt(pContentToDecrypt);




it crash within the CSM_MsgToDecrypt::PreProc() method (I did trace the code to
figure out that you are trying to access memory that was not initialized (NULL

if ((m_SnaccEnvelopedData.encryptedContentInfo == NULL) ||
            contentEncryptionAlgorithm == NULL))

In fact, m_SnaccEnvelopedData is NULL.  But looking at msgToDecrypt class the
CSM_CommonData::m_pEncodedBlob part of it contain the right data to process...
What do I have to do to "inform" msgToEncrypt that it's data is there.  In other
words, what do I have to do to transform this m_pEncodedBlob to

What kind of preprocessing do I have to do before calling

What's wrong with my logic?  Do I miss something?

Thanks a lot (a quick (and complete) answer will be truelly welcomed)

| Simon Blanchet
| Software Designer
| Email: sblanche@xxxxxxxxxx