Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-09 Thread Martin Boßlet
OK, I guess this is the only way to go then. Thanks for the help! Regards, Martin 2010/11/9 David Schwartz : > On 11/6/2010 7:44 AM, Martin Boßlet wrote: > >> I just tested, whether the BER-encoding is preserved if I do not alter >> any of the contents. Unfortunately, it seems as if the encoding

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-08 Thread David Schwartz
On 11/6/2010 7:44 AM, Martin Boßlet wrote: I just tested, whether the BER-encoding is preserved if I do not alter any of the contents. Unfortunately, it seems as if the encoding is not preserved. I did the following: d2i_PKCS7_bio(file,&p7); and then directly i2d_PKCS7_bio(file2, p7); again.

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-06 Thread Martin Boßlet
It's actually even worse. It's not just specific parts of the SignedData such as the encapsulated content info that are BER-encoded, it seems as if any set or sequence is encoded using "constructed" and infinite length. Thanks for the information, I'll try using the CMS functions and see how far I

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-06 Thread Dr. Stephen Henson
On Sat, Nov 06, 2010, Martin Bolet wrote: > I just tested, whether the BER-encoding is preserved if I do not alter > any of the contents. Unfortunately, it seems as if the encoding is not > preserved. I did the following: > > d2i_PKCS7_bio(file, &p7); > > and then directly > > i2d_PKCS7_bio(fil

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-06 Thread Martin Boßlet
I just tested, whether the BER-encoding is preserved if I do not alter any of the contents. Unfortunately, it seems as if the encoding is not preserved. I did the following: d2i_PKCS7_bio(file, &p7); and then directly i2d_PKCS7_bio(file2, p7); again. "file" was BER-encoded using e.g. an Octet S

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-06 Thread Martin Boßlet
Thanks for this, I'll have a look at the streaming features then! Best regards, Martin 2010/11/6 Dr. Stephen Henson : > On Fri, Nov 05, 2010, Martin Bolet wrote: > >> I'm sorry, I was not precise here. Actually I think (have to verify it >> again though) the encoding is preserved if I parse the >

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-06 Thread Dr. Stephen Henson
On Fri, Nov 05, 2010, Martin Bolet wrote: > I'm sorry, I was not precise here. Actually I think (have to verify it > again though) the encoding is preserved if I parse the > EncapContentInfo and reencode it later on without changing the > content. > > My problem was more the other way round: When

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-05 Thread Martin Boßlet
I'm sorry, I was not precise here. Actually I think (have to verify it again though) the encoding is preserved if I parse the EncapContentInfo and reencode it later on without changing the content. My problem was more the other way round: When creating an EncapContentInfo from scratch, can I force

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-05 Thread Martin Boßlet
OK, great, one thing less to worry about! But I still face a problem with the explicit [0] tagged content of EncapContentInfo. In this particular case it has an indefinite length tag. When I i2d it again , the element is DER-encoded using definite length and content. Can I force the use of the exi

Re: Force ASN.1 encoding routines to keep existing encoding

2010-11-05 Thread Dr. Stephen Henson
On Fri, Nov 05, 2010, Martin Bolet wrote: > > A more general problem is that many signatures pretend to be DER-encoded but > they actually apply the wrong order in DER sets. Thus, computing the message > digest also fails because the set elements are put out in a different order > than the origin