Skip to content

Commit f583fc6

Browse files
committed
Merge pull request #38 from markharding/master
resolves issue with OpenSSL private keys #37
2 parents 6c0ac57 + 9e43644 commit f583fc6

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

bin/jsencrypt.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,6 +3866,11 @@ RSAKey.prototype.parseKey = function (pem) {
38663866
var reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/;
38673867
var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);
38683868
var asn1 = ASN1.decode(der);
3869+
3870+
//Fixes a bug with OpenSSL 1.0+ private keys
3871+
if(asn1.sub.length === 3){
3872+
asn1 = asn1.sub[2].sub[0];
3873+
}
38693874
if (asn1.sub.length === 9) {
38703875

38713876
// Parse the private key.

0 commit comments

Comments
 (0)