Re: ASN1 <-> DER encoding with application tag

2021-11-04 Thread Max Larsson
Hi Russ, I have the 126 bytes, but as described I omitted them, because they are in my opinion not helpful for my problem, and would only clutter the email. I should probably have written some ellipses to indicate it better. best regards Max Larsson From: Russ Housley Date: Thursday, 4. Nove

Re: ASN1 <-> DER encoding with application tag

2021-11-04 Thread Max Larsson
Hi Matt, Your suggestion helped a lot for the initial application tag. I must confess I haven’t jet googled the method ANS1_item_ex yet what exactly it does and how it behave and can be used. But now I’m wondering how I can “cascade” using this method to influence the encoding to avoid the wri

Re: ASN1 <-> DER encoding with application tag

2021-11-04 Thread Russ Housley
The data is not correct if it supposed to match RFC 2743. The first byte is [APPLICATION 0]. That seems fine. The second byte provides a length for the full SEQUENCE. It says there are 126 bytes, but you do not have that many. Russ > On Nov 4, 2021, at 10:18 AM, Max Larsson wrote: > > Hi

Re: ASN1 <-> DER encoding with application tag

2021-11-04 Thread Matt Caswell
On 04/11/2021 13:58, Max Larsson wrote:     i2d_GSSAPI_CONTEXTTOKEN( negToken,&p ); You can tell i2d to encode using "application" tagging like this: ASN1_item_ex_i2d((const ASN1_VALUE **)&negToken, &p, ASN1_ITEM_rptr(GSSAPI_CONTEXTTOKEN), 0,

Re: ASN1 <-> DER encoding with application tag

2021-11-04 Thread Max Larsson
Hi Russ, do you mean that the DER data 0x60 0x7e 0x06 0x06 0x2b 0x06 0x01 0x05 0x05 0x02 0xa0 0x74 is wrong? If so, that DER data have I captured with wireshark from an smb2 session setup request. and that’s even I try to decode with help of openssl. If the case is that that data is wrongly,

Re: ASN1 <-> DER encoding with application tag

2021-11-04 Thread Russ Housley
RFC 2743 shows this structure: MechType ::= OBJECT IDENTIFIER -- data structure definitions -- callers must be able to distinguish among -- InitialContextToken, SubsequentContextToken, -- PerMsgToken, and SealedMessage data elements -- based on the usage in which

ASN1 <-> DER encoding with application tag

2021-11-04 Thread Max Larsson
Hi everyone, I’m trying to decode and encode Der structure. In my case that are DER encoded GSSAPI structure. My DER encoded data looks like this (stripped the pending bytes): 0x60 0x7e 0x06 0x06 0x2b 0x06 0x01 0x05 0x05 0x02 0xa0 0x74 My ANS1 definition in my source look like this: typedef s

Re: X509_get_pubkey() in OpenSSL 3.0?

2021-11-04 Thread Matt Caswell
Going back to the original email in this thread: On 02/11/2021 19:42, Jason Schultz wrote:     mycert = PEM_read_X509(fp, NULL, 0, NULL);     pkey = X509_get_pubkey(mycert); All functions return good statuses or non-NULL pointers until the last one, X509_get_pubkey() returns NULL. The PEM

Re: X509_get_pubkey() in OpenSSL 3.0?

2021-11-04 Thread Tomas Mraz
On Wed, 2021-11-03 at 20:32 +, Jason Schultz wrote: > 00B741558E7F:error:0308010C:digital envelope routines:(unknown > function):unsupported:crypto/evp/evp_fetch.c:346:Global default > library > context, Algorithm (SHA1 : 96), Properties () The "Global default library context" hints at wha