800 questions
1
vote
1
answer
48
views
How to determine if a BER ASN.1 identifier uses one or multiple octets?
I'm implementing a parser for BER-encoded ASN.1 data, and I'm confused about how identifier octets work. According to the ASN.1 BER rules:
Each identifier octet encodes class, primitive/constructed, ...
1
vote
1
answer
33
views
ASN.1 Spec: selection types defined overly broad or not?
I'm working through writing an ASN.1 parser and of course the AST for a type can be very long. I'm looking for ways to simplify, but worry about overly simplifying things because there aren't many &...
0
votes
1
answer
126
views
Definition of a data structure of variable size depending on a flag in the middle
I have the following C++ structure:
enum PrefixFlags
{
A=1<<0,
B=1<<1,
PREFIX_IS_HUGE=1<<2
};
struct Prefix
{
uint32_t a;
uint32_t flags;
uint32_t b;
};
struct ...
-1
votes
1
answer
29
views
how to generate the asn auto generated files for custom methods
I have requirenemt to support prioprietary asn encoder and decoder functonality.
using asn tool have to genrated the UPER encoded auto generated files, usually naming like auto generated files like ...
0
votes
0
answers
45
views
pyasn1 optionalnamedtype missing from der encoded output
Im trying to code the following:
aa-keyAlgorithm ATTRIBUTE ::= {
TYPE KeyAlgorithm
IDENTIFIED BY id-kma-keyAlgorithm }
KeyAlgorithm ::= SEQUENCE {
keyAlg OBJECT ...
0
votes
0
answers
91
views
pyasn1 cant' decode ASN1 schema
I am trying to code a key package from RFC6031 using pyasn1.
The sequence encodes ok and I can parse this using openSSL. However, the decoder throws an error.
The top level in ASN1 is
...
0
votes
1
answer
53
views
Is there a standard way to DER encode an ASN.1 schema?
Given some type definition (or collection of type definitions) such as:
Foo ::= SEQUENCE {
field1 UTF8String,
field2 INTEGER
}
Is there a standard way to DER encode this? Obviously I can encode ...
0
votes
0
answers
26
views
'CMS_SignerInfo_it': undeclared identifier
I am using openssl to define an ASN.1 structure, but encountered an error during compilation: 'CMS_SignerInfo_it': undeclared identifier. Have I included the required header files and linked the ...
1
vote
2
answers
169
views
How to generate CSR manually in java
I am trying to generate a Certificate Signing Request (CSR) in Java without using third-party libraries like BouncyCastle. Below is the code I am using to generate the CSR:
public void createCSR(@...
2
votes
1
answer
316
views
In Java how can I write a PKCS#8 PBES2 Encrypted Key?
I am trying to create an encrypted PKCS#8 Key in Java but fail at the PBES2 algorithm parameters step. I want to use SUN/SunJCE and not have to use BouncyCastle/IAIK JCEs.
can convert ENCRYPTED ...
0
votes
2
answers
66
views
Effect of COMPONENT OF constraint on extensibility
Given the following schema, I contend that ConstrainedContentSequence is not extensible, does not allow values having more than 8 Content values, and that a value of type ConstrainedContentSequence ...
3
votes
1
answer
124
views
Single value constraints in PER encoding
My understanding is that the following statement in X.691 says that INTEGER types with single value constraints will not encode anything.
13.2.1 If PER-visible constraints restrict the integer value ...
0
votes
0
answers
289
views
pyasn1: Error while decoding DER sequence
I have a DER Sequence which I was able to parse using asn1 module from pycrypto. Now that pycrypto was deprecated, I want to move to pyasn1.
Below is my code snippet:
x = "...
0
votes
1
answer
89
views
There was an error compiling the asn.1 file, but I don't know where the error is
I have an ASN.1 Specification
ModuleName DEFINITIONS AUTOMATIC TAGS ::= BEGIN
SESeal ::= SEQUENCE {
eSealInfo SES_SealInfo,
cert OCTET STRING,
signAlgID OBJECT IDENTIFIER,
...
1
vote
0
answers
97
views
Error porting ASN1C source files from PC to STM32 (ARM)
I am trying to port the code I generated using ASN1C to encode a structure using UPER.
First, I wanted to test the code in my computer so I generated a CodeBlocks project, included those files and ...
0
votes
0
answers
516
views
Why does `openssl asnparse` not give an error but `openssl x509` does for a DER file?
I have a base64 encoded file (named bst) that after base 64 decoding (base64 -d bst > bst.der) becomes a DER encoded file (bst.der). Running the command openssl asn1parse -inform der -in bst.der ...
6
votes
2
answers
2k
views
How to decode PKCS#7/ASN.1 using Javascript?
Recently I started to work on Apple app store receipt validation and due to the deprecation of the legacy /verifyReceipt endpoint, I decided to go for on-device validation. The guideline described ...
1
vote
0
answers
73
views
Multiple PDU Types Possible in SNMP Packet?
I have been using SNMP for a couple of months now but am still relatively new to the intricacies of the specification.
Is it possible to put multiple types of PDU's in an SNMPv1/v2/v3 packet? For ...
1
vote
1
answer
161
views
Retrieve value stored against an OID from inside SAN in golang
I can access get subjectAltName using following code:
for _, ext := range certificate.Extensions {
if ext.Id.Equal(subjectAltNameOID) {
var extensionData asn1.RawValue
...
0
votes
1
answer
53
views
Can an ASN.1 DER SET have multiple entries of same key?
I have the following Definition:
PersonalName ::= SET {
surname [0] IMPLICIT PrintableString
(SIZE (1..ub-surname-length)),
given-name [1] IMPLICIT PrintableString
...
3
votes
2
answers
1k
views
Explanation of the UPER encoding of an extensible sequence
I have the following ASN.1 SEQENCE type, with the following value, and that produces the below encoding in UPER. I'm interested in why the encoding looks like it does, particularly the start as it's ...
1
vote
3
answers
234
views
Using asn1c compiler I get "long" instead of "int" for INTEGER data type
I am trying to compile a simple ASN to C++ format:
RectangleTest DEFINITIONS ::=
BEGIN
Rectangle ::= SEQUENCE {
height INTEGER,
width INTEGER
}
END
However, when I ...
1
vote
0
answers
614
views
How does "openssl rsa -des3" store informations in the private key?
I am doing some research on rsa key generation for a school project and when using the -des3 flag to encrypt my private key, I don't understand how the ASN.1 is formatted.
Lets say I have my private ...
1
vote
1
answer
111
views
Interpretation of Size Constraints " , ...))" for SEQUENCE OF types in ASN.1
I am working with ASN.1, I found a variable with definition:
A ::= SEQUENCE (SIZE(1..3, ...)) OF FOO
Do it means that A is a list from 1 to infinite of FOO variables?
1
vote
0
answers
652
views
after signing certificate with openssl ca, openssl asn1parse gives error
I have created ca.cnf and create a self-signed certificate,
$ openssl req -x509 -key private/cakey.pem -out cacert.pem -config ca.cnf
I sign a request,
$ openssl ca -config ca.cnf -in oats.csr
Now ...