The encryptedContent field in EncryptedContentInfo is "implicit" according to the rfc (https://www.rfc-editor.org/rfc/rfc5652). EncryptedContentInfo ::= SEQUENCE { contentType ContentType, contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL } However, marshalEncryptedContent() is emitting encryptedContent as EXPLICIT and it can't be parsed by strict parsers.