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
Hello,
I am trying generate a PKCS10 with a SubjectAlternativeName containing a UPN.
package.json
{ "pkijs": "^3.0.15", "asn1js": "^3.0.5", }
try { const altNames = new pkijs.GeneralNames({ names: [ new pkijs.GeneralName({ type: 0, // otherName value: new asn1js.Sequence({ value: [ new asn1js.ObjectIdentifier({ value: '1.3.6.1.4.1.311.20.2.3' }), // UPN oid new asn1js.Constructed({ idBlock: { tagClass: 3, tagNumber: 0 // [0] }, value: [new asn1js.Utf8String({ value: 'test2' })], }), ] }), }), ] }) const extensions = new pkijs.Extension({ extnID: pkijs.id_SubjectAltName, critical: false, extnValue: altNames.toSchema().toBER(), }) console.log(extensions.toString('base64')) } catch (err) { console.error(err) }
SEQUENCE (2 elem) OBJECT IDENTIFIER 2.5.29.17 subjectAltName (X.509 extension) OCTET STRING (27 byte) 3019A0173015060A2B060104018237140203A0070C057465737432 SEQUENCE (1 elem) [0] (1 elem) SEQUENCE (2 elem) OBJECT IDENTIFIER 1.3.6.1.4.1.311.20.2.3 userPrincipalName (Microsoft UPN) [0] (1 elem) UTF8String test2
It appears that the code is generating an extra Sequence. Causing tools like https://redkestrel.co.uk/tools/decoder to fail to decode the value:
SEQUENCE (2 elem) OBJECT IDENTIFIER 2.5.29.17 subjectAltName (X.509 extension) OCTET STRING (52 byte) 3032A030060A2B060104018237140203A0220C206672616E636573636F2E676F72696E… SEQUENCE (1 elem) [0] (2 elem) OBJECT IDENTIFIER 1.3.6.1.4.1.311.20.2.3 userPrincipalName (Microsoft UPN) [0] (1 elem) UTF8String test2
The CSR generated using another tool gives the following:
What am I doing wrong in the code snippet above?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I am trying generate a PKCS10 with a SubjectAlternativeName containing a UPN.
package.json
Code
Result
ASN1
Decoding tool
It appears that the code is generating an extra Sequence. Causing tools like https://redkestrel.co.uk/tools/decoder to fail to decode the value:
What I am trying to generate
ASN1
Decoding tool
The CSR generated using another tool gives the following:
What am I doing wrong in the code snippet above?
The text was updated successfully, but these errors were encountered: