Questions tagged [asn.1]

ASN.1 stands for Abstract Syntax Notation One. It is a data specification language and a set of encoding rules for serializing the data.

2
votes
0answers
80 views

Parsing ASN1 CMS Stream using Bouncy Castle

I am trying to parse a large ASN1 file (Cryptographic Message Syntax) using the Bouncy Castle library (1.60). I am able to retrieve the meta data and payload by loading the whole file into memory, ...
0
votes
1answer
26 views

Is it possible in ASN.1 to inherit?

I am writing on a MIB for SNMP using ASN.1. I have multiple revisions of a board. All boards have Common attributes but later revisions have additional attributes Is it possible for a new revision ...
1
vote
1answer
49 views

How to correctly use and free asn1c SEQUENCE_OF?

I'm using the asn1c lib for many projects, but I never found how to use the free member of a SEQUENCE_OF. I always set it to nullptr because of that, and when I use Valgrind, I see (of course) that my ...
1
vote
1answer
38 views

Unmarshal with x509.ParseCertificateRequest fails but openssl is ok?

When i try to load the CSR (from a PEM line) golang does not parse the ASN.1 data inside the CSR correctly. It spits out that the sequence is truncated. Openssl on the other hand is fine with the CSR ...
3
votes
1answer
54 views

RSA Public Key “BIT STRING” Format

30 81 9F ;SEQUENCE (0x9f bytes = 159 bytes) | 30 0D ;SEQUENCE (0x0d bytes = 13 bytes) | | 06 09 ;OBJECT_IDENTIFIER (0x09 = 9 bytes) | | 2A 86 48 86 ;Hex encoding ...
0
votes
1answer
28 views

python asn1 structure unable to set field values

I am trying to build an asn1 structure in python 3.7 using pyasn1 to serialize ECDSA signatures. I have defined the following structure: (From an example found here http://snmplabs.com/pyasn1/) ...
1
vote
3answers
54 views

Ideas on how to convert a JSON message to ASN.1

I am trying to convert a JSON message to ASN.1. My goal is to convert JSON (captured from wire-shark) to ASN.1 and then, convert asn1 to 802.11p. Any ideas or resources I should look into? I am using ...
0
votes
1answer
26 views

How to store an OpenSSL signature to a file in ASN.1 format

I'm implementing the "sign" step of an already hashed input input_hash. This can be done directly with openssl pkeyutl -sign -in input_hash -inkey private.key -out signature however I'm using an ...
0
votes
1answer
26 views

Is there an interface for unmarshalling a TLS certificate in ASN.1 format

I'm parsing TLS records, taken from a PCAP file. I have the bytes of a TLS certificate in ASN.1 format (in a []byte). I want to unmarshall this byte slice into a useful structure (avoiding having to ...
1
vote
1answer
45 views

How to convert hex public key to ASN.1 SubjectPublicKeyInfo structure for Diffie-Hellman key exchange?

I am trying to implement Diffie-Hellman key exchange to generate the symmetric key for encryption/decryption using JAVA cryptography packages. This requires a public key exchange between the two ...
2
votes
1answer
92 views

ASN.1 / DER Encoding of Integers

I'm currently starting to work with DER (Distinguished Encoding Rules) encoding and have problems understanding the encoding of integers. In the reference document https://www.itu.int/ITU-T/...
0
votes
1answer
32 views

Validate signature from public key, automatically detect algorithm in BouncyCastle

My question is: how can I write my signature validation function to be agnostic of the public key algorithm? I'm working with .Net's BouncyCastle library (v1.8.4). I'm trying to validate a signature ...
0
votes
0answers
35 views

Control Transfer failing Android Unity

I am trying to configure a neonode sensor by doing a controlTransfer over USB. My transfer keeps failing even though I have given my android device(a hikey 960 board) permisssion to the USB and the ...
1
vote
1answer
20 views

Is this double constraint syntax from PKCS#9 legal?

In the PKCS#9 standard they have the following assignment. The first line defines a type PrintableString, that can only two characters long, and must be one of the two letter country acronyms defined ...
0
votes
0answers
62 views

How to encode byte[] to DER Encoding in java?

I need to encode a byte[] to ASN.1 DER encoding format. Is there a code sample to do it in java?
0
votes
1answer
37 views

Digital Signature in Python Without ASN.1 Encoding?

We need to generate a digital signature without ASN.1 encodings for verification by a downstream application. We can do this with openssl on the command line via: openssl pkeyutl -sign -inkey keyfile ...
1
vote
2answers
154 views

Verify a signature file (PKCS7) with WinCrypt or CNG

I need to verify a signed JAR file using Windows crypto API methods. I have only a basic understanding of encryption and signing matters. I'm also new to those crypto APIs (WinCrypt, Bcrypt, Ncrypt). ...
2
votes
1answer
68 views

What is the double brace syntax in ASN.1?

I'm reading the PKCS #7 ASN.1 definition, and came across this type. I can't seem to find out what {{Authenticated}} is doing in this code, or what production this would be called. I've also seen as {{...
1
vote
1answer
40 views

Is decoding of PKCS8 key from Base64 encoded ASN1 structure fault tolerant?

I'm using Spongy Castle library to encode my users private key (PKCS8) into an ASN1 entity and afterwards as Base64 encoded string into a QR code. One of my colleagues found out that it's possible to ...
2
votes
1answer
89 views

Building an ASN1 set using the openssl C API

I'm trying to build a set of sequences using the openssl C API. As was noted in various places, the documentation is VERY sparse on this and code samples seem to be non-existent. I've found various ...
1
vote
2answers
77 views

Print human readable values for LDAP protocol fields in asn1c

I use asn1c to parse the LDAP messages. For this purpose, after compiling the ASN.1 Definition defined in rfc4511, I use the ber_decode and xer_fprint functions for decoding and printing content in ...
1
vote
1answer
68 views

How add a message optional parts in the ASN.1 generated C codes

I have used the C code from libosmo-asn1-map to obtain an implementation of the GSM_MAP protocol. Then I try to encode a "Send authentication Info" message. As mentioned in the 3GPP TS 29.002, this ...
2
votes
0answers
88 views

File name conflict in C codes generated by osmocom asn1c for GSM_MAP/TCAP protocols

I have used the osmocom asn1c compiler (the aper-prefix branch), to obtain an implementation of the GSM_MAP and TCAP protocols. Each protocol has been successfully compiled. But during the use of both ...
2
votes
1answer
83 views

Problem in compiling C code generated by osmocom asn1c

I have installed the osmocom asn1c compiler, the aper-prefix branch, to obtain an implementation of the TCAP protocol. I have used the respective script to compile the ".asn" files. The C files are ...
1
vote
0answers
54 views

Opensource TCAP/MAP C/C++ implementation

I am looking for C/C++ implementation for encoding and decoding of TCAP/MAP layers. I am already aware of osmocom. I would like to know whether there exists any other reliable opensource tool for this ...
0
votes
1answer
86 views

Error in generating C code from GSM-TCAP asn1 files

I am trying to generate C code for the GSM-TCAP asn1 files obtained from libosmo-asn1-TCAP. I have installed the osmocom libasnc1 compiler (tried both master and aper-prefix branches) and run this ...
0
votes
0answers
31 views

Is there a ASN.1 reparser / compound ASN.1 display tool?

I'm writing a standard / reference implementation of (certain aspects of) CMS (Cryptographic Message Syntax, RFC 5652), described across several tens of RFC's, where some of the ASN.1 goes back for ...
0
votes
0answers
29 views

How to check the starting point of ASN.1 messages in a long hex with PYASN1

I have a very long hex stream in input containing several ASN.1 messages, but they are not at fixed position, can start anywhere and have any length, also the stuff that is in between them is random ...
0
votes
1answer
103 views

How to prettyprint as hex a pyasn1 octect string that is printed as ascii

I have some pyasn1 octect string objects defined like this: LInfo.componentType = namedtype.NamedTypes(namedtype.NamedType('XXX', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(...
4
votes
1answer
174 views

Why is unmarshalling of a DER ASN.1 large integer limited to SEQUENCE in Golang?

I would like to be able to unmarshal a large integer from a DER file using the encoding/asn1 package, but it looks like it only works for a SEQUENCE of integers. For example, this does not work, ...
0
votes
0answers
182 views

C++ How to Convert Pem to ASN.1

My main goal is extract ocsp response in cms signed data. But, c++ openssl doesn't provide it. So, I'd like to do it step by step. Convert CMS signed Data(Base64) to asn.1 Find OCSP Response(OID: 1....
0
votes
0answers
82 views

ASN.1 with Python: How to navigate ASN.1 file using Python (keeping the position of data in the binary file)

I have to find values of some specific field tags in ASN.1 files that I receive (say in HEX format). What I need to do is to go field by field, and what I find the ones that need to be rehashed ...
0
votes
2answers
274 views

parsing ASN files using bouncy castle

am trying to parse binary CDRs using JASN1 I have successfully generated Java classes using grammer file not I have a CDR which I need to decode, but I can't get it to work, I don't understand what ...
0
votes
3answers
149 views

ASN.1 BER Encode Integer 0x‭10000000FFFFFFFC Indefinite Length Encoded

I am implementing BER according to spec and I am asking myself the question: How would I encode an Integer 0x‭10000000FFFFFFFC as BER Integer (Tag 0x02) when I use the indefinite length encoding? I ...
0
votes
0answers
32 views

Bouncycastle asn.1 [duplicate]

How to compile asn.1 files to java using bouncycastle ? PrivateKeyInfo ::= SEQUENCE { version Version, privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, privateKey PrivateKey, attributes [0] ...
0
votes
0answers
54 views

bouncycastle compile asn to create CSR: Certificate Signing Request

How can i compile asn file with bouncycastle to create a csr ?? ASN.1 files are a security specification for message signing. https://forge.etsi.org/gitlab/ITS/ITS_ASN1/tree/...
0
votes
1answer
73 views

Antlr4 compile ASN.1

Antlr4 gives me an error by compiling the following file: IEEE1609dot2 {iso(1) identified-organization(3) ieee(111) standards-association-numbered-series-standards(2) wave-stds(1609) dot2(2) base (...
1
vote
1answer
152 views

Decoding timestamp encoded in ASN.1 (javascript)

I am trying to decode the timestamp which I am receiving from my HTTP post request, but this is a really complex task, I do not even have any proper insight into ASN.1/RFC 3161 so if anyone out there ...
0
votes
0answers
137 views

Asn1 Schema parsing

My requirement is to create a dictionary based on the asn file and then fill its value using an excel sheet and then later encode/decode, Now here for the below schema, Is the Parsed output and ...
0
votes
1answer
195 views

ASN.1 type 0x80

My ASN.1 decoder was working fine up until I faced an interesting type: 0x80 which was decoded by online tools as a simple type with name [0]. I found some sources mentioning this to be "indefinite ...
-1
votes
1answer
52 views

How to implement ASN1 decoding in Java Spring?

I need to decode ASN1 strings from a complex sequence but I just cannot figure out how this whole thing works. I'd like to do something like decoder = ASN1Library.initWithSequence(sequenceString); ...
1
vote
1answer
94 views

CAdES signature with win32 low level message apis

I am trying to use the low level message functions to create a CAdES-BES compliant signature. The signature has to be in proper PKCS#7 format along with four signed attributes present. The first two,...
1
vote
1answer
92 views

ASN.1 object identifier values greater than 128

So I understand the way the values are encoded when their values are less than 127. However, after reading https://docs.microsoft.com/en-us/windows/desktop/seccertenroll/about-object-identifier, i ...
-1
votes
1answer
93 views

Parsing and editing ASN1 binary blob in C

I have a valid encoded ASN1 binary blob, which I want to modify. Moreover, I don't have the encoded ASN1's definitions file, but I know it's structure (e.g. let's say it's a sequence that contains few ...
1
vote
1answer
379 views

Why is an error thrown in Python cryptography RSA decryption of encrypted AES key?

I am trying to decrypt an AES key from a DER-encoded file that has been encrypted in RSA format. With the following code: for key, value in configfile['File Extensions'].items(): ...
0
votes
0answers
51 views

How do I get access to RSA-encrypted AES key data from EncryptedKey object? Python

I am trying to access key data bytes from an EncryptedKey object. I am unclear on whether this is a PyAsn1 object or a Python object or a Python cryptography object. How do I access the key data? I ...
0
votes
2answers
151 views

Encoding SNMP Message and Reading Response From Agent

I am trying to send a very basic SNMP Get request to a client using Go. I have an SNMP message for getting the OID 1.3.6.1.2.1.1 that I manually encoded into a byte slice according to this post as ...
0
votes
3answers
65 views

Can ASN.1 support putting field lengths in a different place?

I have a protocol whose on-the-wire format is already defined and I'd like to use ASN.1 to encode/decode it, but it seems to break the defined BER/DER/PER options. For whatever reason, the protocol ...
2
votes
1answer
260 views

Decode ASN.1 - PKCS#7 non-detached signature

I am pretty new to ASN.1 format. I have a PKCS#7 signature which after doing an ASNdump looks like the one below. Can someone help me understand what each element below signifies? I could only ...
0
votes
1answer
261 views

Go invalid ASN.1 Object Identifier encoding error

I am trying to create a DER file using encoding/asn1, and I keep getting an invalid Object Identifier runtime error. asn1.ObjectIdentifier is just an []int, so I'm not sure what's invalid. package ...

http://mssss.yulina-kosm.ru