pkcs7: Allow for missing optional content field
The content field of type OCTET STRING of a ContentInfo object
with ContentType Data
ContentInfo ::= SEQUENCE {
contentType ContentType,
content
[0] EXPLICIT OCTET STRING OPTIONAL
is optional and can be missing if no data is available
This commit is contained in:
@@ -60,6 +60,13 @@ METHOD(container_t, get_data, bool,
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = this->content;
|
||||
|
||||
/* The content field is optional */
|
||||
if (chunk.len == 0)
|
||||
{
|
||||
*data = chunk_empty;
|
||||
return TRUE;
|
||||
}
|
||||
if (asn1_unwrap(&chunk, &chunk) == ASN1_OCTET_STRING)
|
||||
{
|
||||
*data = chunk_clone(chunk);
|
||||
|
||||
Reference in New Issue
Block a user