Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

Fabio Petagna
Hi all,
I have a problem upgrading my code from openssl 1.0 to the last 1.1.1j. 
Using an older version, I exported the CMS code in order to extend and modify some calculations. I used i2d_CMS_bio_stream to convert the struct to DER.

Using OpenSSL 1.1.1j  i had to change all the DECLARE_STACK_OF in DEFINE_STACK_OF but now, i2d_CMS_bio_stream produces a broken DER. In particular when in the code i add a stack to the structure and push some struct into the stack,  i2d_CMS_bio_stream does not write correctly the SEQUENCE (instead i get some 0x06 0x82 0x30 0x82)...

What should i do to fix this?
Thanks.

FP
Reply | Threaded
Open this post in threaded view
|

Re: Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

Fabio Petagna
Hi, 
no one have some hints?

Il giorno gio 8 apr 2021 alle ore 10:53 Fabio <[hidden email]> ha scritto:
Hi all,
I have a problem upgrading my code from openssl 1.0 to the last 1.1.1j. 
Using an older version, I exported the CMS code in order to extend and modify some calculations. I used i2d_CMS_bio_stream to convert the struct to DER.

Using OpenSSL 1.1.1j  i had to change all the DECLARE_STACK_OF in DEFINE_STACK_OF but now, i2d_CMS_bio_stream produces a broken DER. In particular when in the code i add a stack to the structure and push some struct into the stack,  i2d_CMS_bio_stream does not write correctly the SEQUENCE (instead i get some 0x06 0x82 0x30 0x82)...

What should i do to fix this?
Thanks.

FP
Reply | Threaded
Open this post in threaded view
|

RE: Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

Floodeenjr, Thomas

Hello,

 

Are there any clues for you here? 

 

https://wiki.tizen.org/Security/Tizen_5.X_Migration_from_OpenSSL_1.0.2_to_OpenSSL_1.1.1_guide

 

-Tom

 

From: openssl-users <[hidden email]> On Behalf Of Fabio
Sent: Tuesday, April 13, 2021 12:59 AM
To: [hidden email]
Subject: Re: Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

 

Hi, 

no one have some hints?

 

Il giorno gio 8 apr 2021 alle ore 10:53 Fabio <[hidden email]> ha scritto:

Hi all,

I have a problem upgrading my code from openssl 1.0 to the last 1.1.1j. 

Using an older version, I exported the CMS code in order to extend and modify some calculations. I used i2d_CMS_bio_stream to convert the struct to DER.

 

Using OpenSSL 1.1.1j  i had to change all the DECLARE_STACK_OF in DEFINE_STACK_OF but now, i2d_CMS_bio_stream produces a broken DER. In particular when in the code i add a stack to the structure and push some struct into the stack,  i2d_CMS_bio_stream does not write correctly the SEQUENCE (instead i get some 0x06 0x82 0x30 0x82)...

 

What should i do to fix this?

Thanks.

 

FP

Reply | Threaded
Open this post in threaded view
|

Re: Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

Fabio Petagna
Thank you, 
It is a very useful resource but my problem is actually a wrong conversion of the stack of structures to ASN1 SEQUENCE in DER.
What actually changed between 1.0.2 and 1.1.1?
Thanks
F

Il giorno mar 13 apr 2021 alle ore 14:38 Floodeenjr, Thomas <[hidden email]> ha scritto:

Hello,

 

Are there any clues for you here? 

 

https://wiki.tizen.org/Security/Tizen_5.X_Migration_from_OpenSSL_1.0.2_to_OpenSSL_1.1.1_guide

 

-Tom

 

From: openssl-users <[hidden email]> On Behalf Of Fabio
Sent: Tuesday, April 13, 2021 12:59 AM
To: [hidden email]
Subject: Re: Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

 

Hi, 

no one have some hints?

 

Il giorno gio 8 apr 2021 alle ore 10:53 Fabio <[hidden email]> ha scritto:

Hi all,

I have a problem upgrading my code from openssl 1.0 to the last 1.1.1j. 

Using an older version, I exported the CMS code in order to extend and modify some calculations. I used i2d_CMS_bio_stream to convert the struct to DER.

 

Using OpenSSL 1.1.1j  i had to change all the DECLARE_STACK_OF in DEFINE_STACK_OF but now, i2d_CMS_bio_stream produces a broken DER. In particular when in the code i add a stack to the structure and push some struct into the stack,  i2d_CMS_bio_stream does not write correctly the SEQUENCE (instead i get some 0x06 0x82 0x30 0x82)...

 

What should i do to fix this?

Thanks.

 

FP

Reply | Threaded
Open this post in threaded view
|

Re: Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

Fabio Petagna
Hi all,
I apologize but I just figured out that the problem is not the stack as i supposed.
I tried a i2d_X509 and i2d_X509_bio and the output DER certificate i was pushing in is broken... How is it possible?
Clearly I read it from a file so it could be broken in the d2i version too...


Il giorno mer 14 apr 2021 alle ore 09:44 Fabio <[hidden email]> ha scritto:
Thank you, 
It is a very useful resource but my problem is actually a wrong conversion of the stack of structures to ASN1 SEQUENCE in DER.
What actually changed between 1.0.2 and 1.1.1?
Thanks
F

Il giorno mar 13 apr 2021 alle ore 14:38 Floodeenjr, Thomas <[hidden email]> ha scritto:

Hello,

 

Are there any clues for you here? 

 

https://wiki.tizen.org/Security/Tizen_5.X_Migration_from_OpenSSL_1.0.2_to_OpenSSL_1.1.1_guide

 

-Tom

 

From: openssl-users <[hidden email]> On Behalf Of Fabio
Sent: Tuesday, April 13, 2021 12:59 AM
To: [hidden email]
Subject: Re: Help with i2d_CMS_bio_stream from OpenSSL 1.0 to OpenSSL 1.1.1j

 

Hi, 

no one have some hints?

 

Il giorno gio 8 apr 2021 alle ore 10:53 Fabio <[hidden email]> ha scritto:

Hi all,

I have a problem upgrading my code from openssl 1.0 to the last 1.1.1j. 

Using an older version, I exported the CMS code in order to extend and modify some calculations. I used i2d_CMS_bio_stream to convert the struct to DER.

 

Using OpenSSL 1.1.1j  i had to change all the DECLARE_STACK_OF in DEFINE_STACK_OF but now, i2d_CMS_bio_stream produces a broken DER. In particular when in the code i add a stack to the structure and push some struct into the stack,  i2d_CMS_bio_stream does not write correctly the SEQUENCE (instead i get some 0x06 0x82 0x30 0x82)...

 

What should i do to fix this?

Thanks.

 

FP