Open CMCDragonkai opened 2 years ago
I have found that it's possible to do this:
import * as asn1js from 'asn1js';
const stringPrimitive = new asn1js.IA5String({
value: 'abc',
idBlock: {
tagClass: 0x56,
tagNumber: 22
}
});
const stringPrimitiveEncoded = stringPrimitive.toBER();
This ends up creating the IA5String value I'm looking for.
One thing I noticed is that using the @AsnProp
decorators, I end up with a sequence all the time.
If I use AsnTypeTypes.Choice
I get what I want, but I just want a primitive structure here.
How does one use asn1-schema to set the APPLICATION
class?
I'm coming from using node-forge, where it was relatively easy to create custom extensions.
I'm looking for a way to create a custom extension with this library.
I found that most of the extensions classes extend the
Extension
class.However they all seem to take values that are already encoded ASN1 objects as buffer sources.
The
@peculiar/asn1-schema
doesn't have a lot of documentation. The only example isKeyUsage
which ends up using@peculiar/asn1-x509
https://github.com/PeculiarVentures/asn1-schema/blob/master/packages/x509/src/extensions/key_usage.ts. But it's not clear ifBitString
is supposed to be a raw byte string that is already encoded.Is there an ASN1 builder available to be used here that can do the above?