RE: MsgToDecrypt usage (how-to...)
"Colestock, Robert" <[email protected]> Thu, 26 Jul 2001 12:51:52 -0400
| Newsgroups | gmane.ietf.sfl |
|---|---|
| Message-ID | <[email protected]> |
Simon: If the data is good, it looks like the logic should work fine. Please send the actual data input to the CSM_MsgToDecrypt constructor, I will investigate. At the very least we should indicate an error, not "crash". Bob Colestock VDA -----Original Message----- From: Simon Blanchet [mailto:[email protected]] Sent: Thursday, July 26, 2001 11:10 AM To: [email protected] Subject: 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. [ BEGIN CODE ] CSM_Buffer* pBufToDecrypt = new CSM_Buffer(const_cast<char*>(sContentFilename.c_str())); CSM_ContentInfoMsg* pContentToDecrypt = new CSM_ContentInfoMsg(pBufToDecrypt); CSM_MsgToDecrypt msgToDecrypt(pContentToDecrypt); msgToDecrypt.PreProc(m_EngineLogin.GetCSMIME()); msgToDecrypt.Decrypt(m_EngineLogin.GetCSMIME()); [ END CODE ] PROBLEM DESCRIPTION: 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 pointer): if ((m_SnaccEnvelopedData.encryptedContentInfo == NULL) || (m_SnaccEnvelopedData.encryptedContentInfo-> 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 m_SnaccEnvelopedData????? What kind of preprocessing do I have to do before calling MsgToDecrypt::PreProc()? 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: [email protected] |=========================================