We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm coming from using node-forge, where it was relatively easy to create custom extensions.
extensions.push({ name: 'nodeSignature', id: config.oids.extensions.nodeSignature, critical: true, value: asn1.create( asn1.Class.APPLICATION, asn1.Type.OCTETSTRING, // or asn1.type.IA5STRING false, nodeSignature, ), });
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.
Extension
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 is KeyUsage 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 if BitString is supposed to be a raw byte string that is already encoded.
@peculiar/asn1-schema
KeyUsage
@peculiar/asn1-x509
BitString
Is there an ASN1 builder available to be used here that can do the above?
The text was updated successfully, but these errors were encountered:
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.
@AsnProp
If I use AsnTypeTypes.Choice I get what I want, but I just want a primitive structure here.
AsnTypeTypes.Choice
How does one use asn1-schema to set the APPLICATION class?
APPLICATION
Sorry, something went wrong.
No branches or pull requests
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?
The text was updated successfully, but these errors were encountered: