Re: Extract content of DER-encoded package by OID

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

 



Okay, I've made some progress, but hit a wall now. Here's what I have so
far:

/************* start code *************/

char* encrypted;	// DER-encoded buffer */
char* encryptedSize; 	// size in bytes of encrypted buffer

CMS_ContentInfo* cms;

unsigned char* p;
p = encrypted;

CMS_ContentInfo** cmsPtr = &cms;
cms = d2i_CMS_ContentInfo( NULL, &p, encryptedSize );
if ( cms == NULL ) printf("CMS is null!\n");

const ASN1_OBJECT* asn = CMS_get0_eContentType( cms );
if ( asn == NULL ) printf("ASN is null!\n");

/************* end code *************/

None of the checks failed, so the functions passed. However, when I check
asn->data, it appears to be "garbage", or nothing interesting to me. The
flags is 9 (so I'm assuming flag 0x01 and 0x08 were set). Does it look like
I'm doing everything correctly? How would I continue on in parsing the asn1
object/stripping off layers of it? Thanks, and I hope to hear back soon.

- Justin 
 
-----Original Message-----
From: openssl-users [mailto:openssl-users-bounces@xxxxxxxxxxx] On Behalf Of
Dr. Stephen Henson
Sent: Thursday, July 20, 2017 4:07 PM
To: openssl-users@xxxxxxxxxxx
Subject: Re:  Extract content of DER-encoded package by OID

On Thu, Jul 20, 2017, Justin Mogannam wrote:

> Thanks for the tips thus far. One of the last issues I'm having is 
> actually declaring a CMS_ContentInfo structure. I just declare :
> 
> CMS_ContentInfo cms;
> 
> Amd gcc tells me "error: storage size of 'cms' isn't known". This goes 
> back to my question 1 of the previous email: is there a particular 
> function call to use to construct a CMS_ContentInfo structure? Thanks!
> 

In common with many structures CMS_ContentInfo is opaque so you can only
declare pointers to the structure not the structure itself.  The
d2i_CMS_ContentInfo() function will return a pointer to a CMS_ContentInfo
structure containing the contents of the parsed DER buffer. You can then use
that pointer in other CMS utility functions.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users



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

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux