Skip to content

Commit

Permalink
Add type support for PKCS#10 certification requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lapo-luchini committed Aug 29, 2023
1 parent 3a2ce63 commit c9324b2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require([
ISC license
-----------

ASN.1 JavaScript decoder Copyright (c) 2008-2022 Lapo Luchini <[email protected]>
ASN.1 JavaScript decoder Copyright (c) 2008-2023 Lapo Luchini <[email protected]>

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

Expand Down
1 change: 1 addition & 0 deletions defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Defs.commonTypes = [
[ 'X.509 certificate', '1.3.6.1.5.5.7.0.18', 'Certificate' ],
[ 'CMS / PKCS#7 envelope', '1.2.840.113549.1.9.16.0.14', 'ContentInfo' ],
[ 'PKCS#8 encrypted private key', '1.2.840.113549.1.8.1.1', 'EncryptedPrivateKeyInfo' ],
[ 'PKCS#10 certification request', '1.2.840.113549.1.10.1.1', 'CertificationRequest' ],
].map(arr => ({ description: arr[0], ...Defs.moduleAndType(rfc[arr[1]], arr[2]) }));

return Defs;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lapo/asn1js",
"version": "1.2.4",
"version": "1.3.0",
"description": "Generic ASN.1 parser/decoder that can decode any valid ASN.1 DER or BER structures.",
"main": "asn1.js",
"repository": {
Expand Down
13 changes: 13 additions & 0 deletions parseRFC.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ const
[ /SIGNED \{ (SEQUENCE \{[^}]+\})\s*\}/g, 'SEQUENCE { toBeSigned $1, algorithm AlgorithmIdentifier, signature BIT STRING }' ],
[ /EXTENSION\.&[^,]+/g, 'OBJECT IDENTIFIER'],
],
2986: [ // currently unsupported
[ /FROM (InformationFramework|AuthenticationFramework) [a-zA-Z]+/g, 'FROM $1 {joint-iso-itu-t(2) ds(5) module(1) usefulDefinitions(0) 3}' ],
[ /[(]v1,[^)]+[)]/g, '' ],
[ /[{][{][^}]+[}][}]/g, '' ],
[ 'SubjectPublicKeyInfo {ALGORITHM: IOSet}', 'SubjectPublicKeyInfo' ],
[ /PKInfoAlgorithms ALGORITHM ::=[^}]+[}]/g, '' ],
[ /(Attributes?) [{] ATTRIBUTE:IOSet [}]/g, '$1' ],
[ /CRIAttributes +ATTRIBUTE +::=[^}]+[}]/g, '' ],
[ /[A-Z]+[.]&id[(][{]IOSet[}][)]/g, 'OBJECT IDENTIFIER' ],
[ /[A-Z]+[.]&Type[(][{]IOSet[}][{]@[a-z]+[}][)]/g, 'ANY' ],
[ /(AlgorithmIdentifier) [{]ALGORITHM:IOSet [}]/g, '$1' ],
[ /SignatureAlgorithms ALGORITHM ::=[^}]+[}]/g, '' ],
],
3161: [ // actual syntax errors
[ /--.*}/g, '}' ],
[ /^( +)--.*\n(?:\1 .*\n)+/mg, '' ],
Expand Down
2 changes: 1 addition & 1 deletion updateRFC.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/sh
RFCs="5280 5208 3369 3161"
RFCs="5280 5208 3369 3161 2986"
downloadRFC() {
URL="https://www.ietf.org/rfc/rfc$1.txt"
if [ -x /usr/bin/fetch ]; then
Expand Down

0 comments on commit c9324b2

Please sign in to comment.