Skip to main content

Questions tagged [asn.1]

Abstract Syntax Notation One (ASN.1) is a language that defines the way data is sent across dissimilar communication systems.

Filter by
Sorted by
Tagged with
2 votes
0 answers
328 views

How to recognize DER nested OCTET SEQUENCEs?

I asked OpenSSL to generate a dummy Ed25519 private key for me and got this output: https://lapo.it/asn1js/#MC4CAQAwBQYDK2VwBCIEIJCO9eKZEUOmL9CGfecuKqvYU_hLTAFXwl0Ipd8xNXbP It decodes to the following:...
Myria's user avatar
  • 2,615
0 votes
1 answer
268 views

Verify message digest of time stamp token

I'm trying to verify a time stamp token embedded into a PDF using the PDF 2.0 feature of the "Document Time-stamp Dictionary". The embedded time stamp token is exactly the token of a time ...
gettalong's user avatar
  • 101
2 votes
1 answer
287 views

ASN.1 integer question for DSA

I'm trying to implement own DSA signature check as per guide at this site page 20 in python. ...
Denis Muzhzhukhin's user avatar
1 vote
1 answer
166 views

Do RSA powers of two modulus always have MSB set to one and so when DER encoded have 0x00 prefix?

Looking at https://crypto.stackexchange.com/a/30616/16548 and all the ways I generate RSA keys (code, SSL) the MSB is always 1 and so when DER encoded has 0x00 ...
Veksi's user avatar
  • 147
2 votes
0 answers
79 views

Is CMS for data still relevant

I have an application where I need to store small to moderate amounts of data in a symmetrically encrypted form. For various reasons, CMS with an AuthEnvelopedData seems to tick all the requirements. ...
mikb's user avatar
  • 121
1 vote
0 answers
30 views

For most applications of CMS, does the size of the payloads ever exceed that of a 32-bit integer?

For my hobby cryptography project, I'm planning to implement some helper functions that parses a subset of ASN.1 BER encoding without using a ASN.1 compiler. For this purpose, I'd like to use 32-bit ...
DannyNiu's user avatar
  • 9,662
2 votes
1 answer
1k views

Encode ASN.1 PKCS#8 Private Key with Public Key and attributes

I'm trying to encode an Ed25519 private key as a PEM file based on this document https://www.rfc-editor.org/rfc/rfc8410#page-7 . I'm using an ASN.1 encoder written in Dart, and I can encode the ...
Pedro Girardi's user avatar
3 votes
1 answer
2k views

PKCS#7 CMS - Message digest calculation process

i'm studying RFC 5652 in order to know exactly how to encode/decode PKCS#7 ASN.1 data. I don't understand how one can create a signature when the field "signedAttrs" is present: The result ...
Lazarus's user avatar
  • 33
0 votes
1 answer
57 views

Where can I read about DER certificate structure - fields and its registered values?

Where is an official documentation for ASN1 structure and values of x509 certs? Using OpenSSL command like openssl asn1parse -in server.der -inform DER I can see ...
Iceman's user avatar
  • 137
2 votes
2 answers
1k views

openSSL created CSR signature size of 73 bytes but should't it be 70 bytes

after creating CSR using openSSL with secp256r1 curve inspecting the file using openssl asn1parse -i -in ecTest.csr the size of ...
porente's user avatar
  • 143
0 votes
1 answer
560 views

Why is an RSA public key BITWRAP-ed in ASN.1 DER encoding?

While playing around with creating an RSA public key, and decoding it using a home brew ASN.1 decoder, I ran into the fact that the public key is BITWRAP-ed. BITWRAP seems to be an OpenSSL modifier, ...
Otto's user avatar
  • 125
5 votes
1 answer
6k views

Converting raw ECC private key into ASN.1 DER encoded key

I created a random integer array of 32 bytes to use as my private key for secp256k1 curve. ...
Dogus Ural's user avatar
1 vote
1 answer
606 views

X.509 ECDSA signature field in DER format includes '00' between bit string and sequence of r and s

I created a X.509 certificate with ECDSAwithSHA256(OID=1.2.840.10045.4.3.2) by openssl. ECC parameter is secp256r1. Following is the signatureAlgorithm and signatureValue. ...
rary21's user avatar
  • 13
1 vote
1 answer
746 views

Are EdDSA algorithms encoded by ASN.1 DER standards?

Is it required, or widely practiced to encode a EdDSA signature as a ASN.1 Sequence? Why or why not? How should you encode a EdDSA signature? I cannot find mention of DER or ASN in the EdDSA RFC. ...
user1222324562's user avatar
1 vote
1 answer
1k views

PKCS#7 non-detached Signature - Help understand the message structure

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 ...
user1178376's user avatar
1 vote
2 answers
2k views

Why is the signature field in X.509 a BIT STRING, despite there being ASN.1 (DER) data inside?

As can be seen from the following ASN.1 definition of an X.509 certificate, the Signature field is a BIT STRING. ...
Mark's user avatar
  • 835
4 votes
2 answers
1k views

Why is the signatureAlgorithm field in X.509 certificates redundant?

See the ASN.1 description of an X.509 certificate below: ...
Mark's user avatar
  • 835
2 votes
1 answer
3k views

Length of message in RSA and splitting of long messages

If I understand correctly in (unpadded) RSA the length of message M must be shorter than modulus n. Encryption gives ciphertext that is also shorter than n. Let's say I want to send a message of 2....
croraf's user avatar
  • 289
5 votes
1 answer
3k views

What are these fields in ASN.1 encoding of RSA

Nice resource for ASN.1 structured RSA keys https://etherhack.co.uk/asymmetric/docs/rsa_key_breakdown.html in private key section shows following RSA private key related fields: modulus public exp ...
croraf's user avatar
  • 289
2 votes
1 answer
1k views

Converting a "raw" non-ASN.1 EC private key to a public key?

I have this ECDSA private key that isn't very important, but I do not have it in any other format. 008AF2DA031B2DC39FBE418A238EFDA3B10ABC7C77FE12A750BFE899 I ...
user avatar
3 votes
0 answers
233 views

Prime extension field encoding ASN.1

ASN.1 encoding for elliptic curve cryptography is recommended by Certicom, as explained at a related question, covering curves over prime fields and binary extension fields. I'm looking for known ...
Vadym Fedyukovych's user avatar
4 votes
1 answer
276 views

representing binary finite fields in ASN.1

In SEC 2: Recommended Elliptic Curve Domain Parameters two types of finite fields are utilized - $\mathbb{F}_p$ and $\mathbb{F}_{2^m}$. In the case of sect193r1, $\mathbb{F}_{2^m}$ is the finite field,...
neubert's user avatar
  • 2,959
1 vote
1 answer
1k views

Correcting Improperly Formatted EC Private Keys [closed]

We are currently generating a secp521r1 key as follows using cryptography for Python: ...
Dimitri Bouniol's user avatar
3 votes
1 answer
1k views

What's the ASN.1 structure of ECIES encryption result? [closed]

I got a ECIES encryption result and a publickey,the publickey after decoding to ASN.1, I obtained the following: ...
Jswq's user avatar
  • 155
3 votes
1 answer
198 views

X509 certificates: Two Algorithm Identifiers?

I'm wondering why there are two Algorithm Identifiers in a X509 certificate. One is in the "to be signed" part and the other one is at the end right before the actual signature. Are they used for the ...
Nocta's user avatar
  • 33
3 votes
1 answer
325 views

converting finite field elements to octet strings

I need to convert elements of the finite field $GF(p^k)$, where $p$ is an odd prime, to octet strings. To be more precise, I want to include elliptic curve points over $GF(p^2)$ in a Subject Public ...
user avatar
1 vote
1 answer
210 views

Are there any existing ASN.1 structures for transferring symmetric keys?

Is there any reasonable ASN.1 standard to encode symmetric keys? I found PSKC, but it seems extremely heavy, and I can't quite find any library (e.g. bouncycastle) that would simplify using it. If all ...
Pawel Veselov's user avatar
8 votes
1 answer
4k views

How is OID 2a 86 48 86 f7 0d parsed as 1.2.840.113549?

I saw that an RSA key, created by OpenSSL, contains the following HEX string: 2a 86 48 86 f7 0d 01 01 01 that HEX string gets interpreted as Object ID: 1.2.840.113549.1.1.1 It is obvious 01 01 ...
Matt Elson's user avatar
8 votes
2 answers
3k views

BER or DER X9.62 for ECDSA signature

The signature format for ECDSA signatures can be encoded using ASN.1 integers according to X9.62 or it can comprise of two integers with the same size as the key size. In case the X9.62 format is ...
Maarten Bodewes's user avatar
  • 93.9k
3 votes
2 answers
2k views

ASN.1 encoding off RSASSA-PSS default parameters

I am not totally sure the question belongs to crypto and not stackoverflow but nevertheless... The problem is the encoding of the RSASSA-PSS default algorithm identifier parameters in an X509 ...
MatK's user avatar
  • 33
4 votes
3 answers
929 views

Verifying DER encoded DSA/ECDSA signature with extra content?

Having a DSA/ECDSA signature which is supposed to be DER encoded as an ASN.1 sequence of $r$ and $s$ (as described in the RFC), and being given some bytes which are ...
Alex Gaynor's user avatar
2 votes
2 answers
299 views

What does OIW stand for

There seem to be many OID's that have been put in the ASN.1 tree that have the following ISO identified organization: OIW. One example is SHA-1 (ElGamal seems to be another): ...
Maarten Bodewes's user avatar
  • 93.9k
5 votes
2 answers
5k views

How to specify a NIST SP 800-108 KBKDF

Strange question maybe, but say I want to specify a protocol that complies with NIST SP 800-108. This lists a whole set of key based key derivation functions, with a very loose set of parameters. How ...
Maarten Bodewes's user avatar
  • 93.9k
4 votes
1 answer
254 views

ASN.1 OID of bcrypt

What is the ASN.1 OID associated to bcrypt (the key derivation scheme)? For instance, PBKDF2 has 1.2.840.113549.1.5.12 and it is therefore possible to store a ...
SquareRootOfTwentyThree's user avatar
7 votes
2 answers
4k views

How do I unpack the x and y values from the BITSTRING in a DER ECDSA public key?

In ASN.1, the X and Y values for a 256-bit elliptic curve key are stored as a single 66-byte ASN.1 BITSTRING. Are the values just the first and second half of this bitstring? The private key is an ...
joeforker's user avatar
  • 561
13 votes
2 answers
35k views

How can I convert a DER ECDSA signature to ASN.1?

I having trouble verifying an ECDSA signature signed using client side javascript with Java/BouncyCastle. The javascript signing function source: ...
Ben's user avatar
  • 241