On Wed, Apr 14, 2010, Benjamin Amling wrote: > Hello, > > is it possible to extract the DER blob from the RecipientInfos-part of a > S/MIME message? I tried the following steps already but couldn't manage > to get what I want: > > ********************************************************************* > BIO *bin = BIO_new(BIO_s_mem()); > BIO_write(bin, mimeMessage.c_str(), mimeMessage.size()); // no errors > > CMS_ContentInfo *cms = SMIME_read_CMS(bin, NULL); // no errors > > STACK_OF(CMS_RecipientInfo) * ris = CMS_get0_RecipientInfos(cms); // no > errors > > CMS_RecipientInfo *ri; > for (int i = 0; i < sk_CMS_RecipientInfo_num(ris); ++i) { > ri = sk_CMS_RecipientInfo_value(ris, i); > // sk_CMS_RecipientInfo_num(ris) returns 1, so it shouldn't be empty > // CMS_RecipientInfo_type(ri) returns 0 > } > ********************************************************************** > > This is as far as I got. I have no idea on how to proceed and what I can > do with the CMS_RecipientInfos I managed to extract so far. > > I'm still quite new to using the OpenSSL API in C/C++ so I'd appreciate > any kind of help. :-) > >
The return value of CMS_RecipientInfo_type() is a constant indictaing tha type and will almost always be CMS_RECIPINFO_TRANS (see cms.h). Once you have the type you can use the appropriate function to retrieve its contents. For example CMS_RecipientInfo_ktri_get0_signer_id(). Steve. -- Dr Stephen N. Henson. OpenSSL project core developer. Commercial tech support now available see: http://www.openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org