diff --git a/asn1-parser.js b/asn1-parser.js index 82f7cd0..ef1ac6f 100644 --- a/asn1-parser.js +++ b/asn1-parser.js @@ -129,7 +129,7 @@ PEM.parseBlock = PEM.parseBlock || function (str) { }; Enc.base64ToBuf = function (b64) { - return Enc.binToBuf(atob(b64)); + return Enc.binToBuf('function' === typeof atob ? atob(b64) : Buffer.from(b64, 'base64').toString('binary')); }; Enc.binToBuf = function (bin) { var arr = bin.split('').map(function (ch) { diff --git a/package.json b/package.json index c1feaf0..0bcc06f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "asn1-parser", - "version": "1.1.8", + "version": "1.1.9", "description": "An ASN.1 parser in less than 100 lines of Vanilla JavaScript, part of the Bluecrypt suite.", "homepage": "https://git.coolaj86.com/coolaj86/asn1-parser.js", "main": "asn1-parser.js",