diff --git a/README.md b/README.md index 34a6c44..de091f8 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ require([ ISC license ----------- -ASN.1 JavaScript decoder Copyright (c) 2008-2022 Lapo Luchini +ASN.1 JavaScript decoder Copyright (c) 2008-2023 Lapo Luchini 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. diff --git a/defs.js b/defs.js index 07f8500..bc5d5d6 100644 --- a/defs.js +++ b/defs.js @@ -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; diff --git a/package.json b/package.json index 1e8db15..4a0bb0a 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/parseRFC.js b/parseRFC.js index 686458c..e39e392 100755 --- a/parseRFC.js +++ b/parseRFC.js @@ -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, '' ], diff --git a/updateRFC.sh b/updateRFC.sh index cb9f812..bf3f8f7 100755 --- a/updateRFC.sh +++ b/updateRFC.sh @@ -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