Re: simple ASN1 sequence - not quite understanding what goes wrong

2020-08-28 Thread Dirk-Willem van Gulik
Answering my own question - I forgot the END of sequence in the marco. Functional code below. Dw. > On 28 Aug 2020, at 15:49, Dirk-Willem van Gulik wrote: > > I've got a very simple sequence of to integers that I am trying to convert to > DER. > > Bt I am getting an error or segfault in the

simple ASN1 sequence - not quite understanding what goes wrong

2020-08-28 Thread Dirk-Willem van Gulik
I've got a very simple sequence of to integers that I am trying to convert to DER. Bt I am getting an error or segfault in the final i2d step (lengt -1 for i2d_X9_62). Any advice on what is going wrong here ? With kind regards, Dw. #include #include #include #include #include #includ

[openssl-users] How to encode R and S of an ECDSA signature to ASN1 sequence

2018-08-20 Thread William Roberts
I can successfully deconstruct an an ECDSA Signature Sequence, but now I need to construct it, and I am getting lost. The format I need to build is: sECDSA-Sig-Value ::= SEQUENCE { r INTEGER, s INTEGER } I have r and s as buffers in the same format as returned from: d2i_ASN1_INTEGER() if one used

[openssl-users] X509_ATTRIBUTE_create_by_NID reversing ASN1 sequence

2017-11-21 Thread Andrew Felsher
Hi, (Apologies if this was sent multiple times; I'm experiencing some technical difficulties.) I'm working on a CSR-generating API using OpenSSL 1.0.2m. My question is: does OpenSSL do any sort of reordering of the entries in an ASN1 sequence? Specifically, when encoding a post

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Chang Lee
f length encoding) but I figure there must be an > > > easier way. > > > > You can use the macros in asn1t.h for parsing DER encoded data. Have a > > look at the comment starting at line 132 (I'm using OpenSSL 1.0.0e) of > > this header file. It explains how to dec

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Frank Morgner
d data. Have a > look at the comment starting at line 132 (I'm using OpenSSL 1.0.0e) of > this header file. It explains how to declare an ASN1 SEQUENCE. You can > find plenty of examples using these macros within the OpenSSL source > (for example crypto/pkcs7/p7_asn1.c). An othe

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Chang Lee
ASN1_get_object() got the job done. Thanks. On Thu, Sep 22, 2011 at 1:34 PM, Dr. Stephen Henson wrote: > On Thu, Sep 22, 2011, Chang Lee wrote: > > > Thanks for the info. I'll try to get it to work using ASN1_get_object(). > > Just for my edification, was my approach using the templates and mac

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Dr. Stephen Henson
On Thu, Sep 22, 2011, Chang Lee wrote: > Thanks for the info. I'll try to get it to work using ASN1_get_object(). > Just for my edification, was my approach using the templates and macros not > a viable option? > Well it would work but you'd have to parse the whole structure which isn't necessar

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Chang Lee
Thanks for the info. I'll try to get it to work using ASN1_get_object(). Just for my edification, was my approach using the templates and macros not a viable option? On Thu, Sep 22, 2011 at 12:22 PM, Dr. Stephen Henson wrote: > On Thu, Sep 22, 2011, Chang Lee wrote: > > > I'm trying to parse the

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Dr. Stephen Henson
On Thu, Sep 22, 2011, Chang Lee wrote: > I'm trying to parse the content of an ASN1_OCTET_STRING, which I know/expect > to be a DER encoded SEQUENCE, into an object. I need to do this because I'm > trying to verify an Authenticode signature. I need to generate a digest of > the contents of the s

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Chang Lee
I'm trying to parse the content of an ASN1_OCTET_STRING, which I know/expect to be a DER encoded SEQUENCE, into an object. I need to do this because I'm trying to verify an Authenticode signature. I need to generate a digest of the contents of the signedData sans the type & length bytes. Now gene

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Michael S. Zick
could manually parse the Sequence (and deal with > > > the different types of length encoding) but I figure there must be an > > > easier way. > > > > You can use the macros in asn1t.h for parsing DER encoded data. Have a > > look at the comment starting at line 132 (I

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Dr. Stephen Henson
On Thu, Sep 22, 2011, Chang Lee wrote: > Thanks Dominik for the tip. Actually, I have been poring over the OpenSSL > code, though we're using the 0.9.8 branch, hoping to find a built-in > primitive SEQUENCE to use but to no avail. As you say, there are templates > for primitives and I looked at

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Dr. Stephen Henson
On Thu, Sep 22, 2011, Dominik Oepen wrote: > > However, I'm not exactly sure whether or not the ASN1 subsystem is meant > to be used outside of OpenSSL. I couldn't find a lot of documentation > about it and learned how to use it by reading the source. Maybe one of > the OpenSSL developers could c

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-22 Thread Chang Lee
t; look at the comment starting at line 132 (I'm using OpenSSL 1.0.0e) of > this header file. It explains how to declare an ASN1 SEQUENCE. You can > find plenty of examples using these macros within the OpenSSL source > (for example crypto/pkcs7/p7_asn1.c). > > However, I'm

Re: Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-21 Thread Dominik Oepen
ile. It explains how to declare an ASN1 SEQUENCE. You can find plenty of examples using these macros within the OpenSSL source (for example crypto/pkcs7/p7_asn1.c). However, I'm not exactly sure whether or not the ASN1 subsystem is meant to be used outside of OpenSSL. I couldn't find a lot of d

Convert ASN1_OCTET_STRING contents to ASN1 Sequence

2011-09-21 Thread Chang Lee
Does anyone know of a way to take an ASN1_OCTET_STRING that contains a DER encoded Sequence and extract the contents of the Sequence as an ASN1_STRING. Essentially, I want to construct an ASN1 object of the Sequence. I guess I could manually parse the Sequence (and deal with the different types o

add asn1 set to asn1 sequence

2007-08-06 Thread Christian Wiesbauer
I'm trying to add an ASN1 set to an ASN1 sequence with following code: unsigned char *p, *p_; ASN1_STRING *seq, *set; ASN1_OBJECT *oid_1, *oid_2; unsigned char *data, *data_; int i, j, k, total; // SET oid_1 = OBJ_nid2obj(NID_pkcs7

Re: ASN1 Sequence unpack problem

2006-02-03 Thread Enis Arif
Hello, Thank you for your response. I'll try to clear up a few things: I don't want to rewrite the ASN1 parser, but I want to be able to decode each value separately. I already have classes that, using the openssl parser, decode the basic types (integer, enum, octet string, bit string etc). So, I

Re: ASN1 Sequence unpack problem

2006-02-02 Thread Dr. Stephen Henson
On Thu, Feb 02, 2006, Enis Arif wrote: > Please, if someone can give me an answer to my > problem, because I have to take a decision to use > openssl for the project or not. Is it feasible to > modify the d2i_ASN1_SET/ASN1_item_d2i/ASN1_item_ex_d2i > behavior or is it an easier way to do it? > I

ASN1 Sequence unpack problem

2006-02-02 Thread Enis Arif
Please, if someone can give me an answer to my problem, because I have to take a decision to use openssl for the project or not. Is it feasible to modify the d2i_ASN1_SET/ASN1_item_d2i/ASN1_item_ex_d2i behavior or is it an easier way to do it? __ Do

ASN1 Sequence unpack problem

2006-02-02 Thread Enis Arif
Hello, I have a problem with sequence unpacking. Given the following code ASN1_TYPE *at = NULL; STACK_OF(ASN1_TYPE) *st = NULL; st = ASN1_seq_unpack_ASN1_TYPE(asn1->get_data(), asn1->get_len(), d2i_ASN1_TYPE, ASN1_TYPE_free); if I call at = sk_ASN1_TYPE_value (st, 0) I get the sequence members

Can't start Apache server / expecting an asn1 sequence

2002-01-23 Thread Jeff Slonaker
:asn1 encoding routines:d2i_X509:expecting an asn1 sequence. FWIW, everything works, if I don't use mod_perl. Thanks. Jeff Slonaker __ OpenSSL Project http://www.openssl.org User Support Ma

Re: ASN1 SEQUENCE

2001-10-19 Thread Dr S N Henson
[EMAIL PROTECTED] wrote: > > Hi all, > I want to wrap data into the SEQUENCE (PKCS#1) > > DigestInfo ::= SEQUENCE { > digestAlgorithm DigestAlgorithmIdentifier, > digest Digest > } > > and then DER encode it. > > Using OpenSSL 0.9.6b (EVP and ASN1 routines) I'm able to obtain the > d

ASN1 SEQUENCE

2001-10-19 Thread blu-_-king
Hi all, I want to wrap data into the SEQUENCE (PKCS#1) DigestInfo ::= SEQUENCE { digestAlgorithm DigestAlgorithmIdentifier, digest Digest } and then DER encode it. Using OpenSSL 0.9.6b (EVP and ASN1 routines) I'm able to obtain the digested data as OCTET STRING, but how can I build a

OpenSSL Error: expecting an asn1 sequence

2001-01-29 Thread Wenzel, Markus
error follows) [29/Jan/2001 10:30:46 05379] [error] OpenSSL: error:0D09F007:asn1 encoding routines:d2i_X509:expecting an asn1 sequence Used packages are: Apache 1.3.12 OpenSSL 0.9.5a mod_ssl 2.6.6.-1.3.12 Operating System is Linux RH6.1 Thank you for your help in advance best regards, Markus

"expecting an asn1 sequence" error - SOLVED :)

2000-02-17 Thread Sergio Salvi
Thanks to Dr Stephen, the solution was convert the certificate file to PEM format (it was in PCKS#7): First change the "BEGIN CERTIFICATE" and "END CERTIFICATE" lines to "BEGIN PKCS7"/"END PKCS7" and then run "openssl pkcs7 -in server.gid -out certs.pem -print_certs". []s, Sergio Salvi.

Re: "expecting an asn1 sequence" error - HELP!

2000-02-17 Thread Jim Warren
eply-To: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED], [EMAIL PROTECTED] > Subject: "expecting an asn1 sequence" error - HELP! > > Hi guys! > > I'm having the following problem when trying to start apache 1.3.11 with > mod_ssl 2.5.0 and op

"expecting an asn1 sequence" error - HELP!

2000-02-16 Thread Sergio Salvi
oding routines:d2i_X509:expecting an asn1 sequence In my apache conf file: --- SSLEnable SSLCertificateFile /usr/local/ssl/certs/server.gid SSLCertificateKeyFile /usr/local/ssl/private/server.key SSLCertificateChainFile /usr/local/ssl/certs/verisign.chain SSLLogLevel trace --- Where server.gid is a base6