Skip to content

Commit

Permalink
Merge pull request travist#38 from markharding/master
Browse files Browse the repository at this point in the history
resolves issue with OpenSSL private keys travist#37
  • Loading branch information
zoloft committed Jan 26, 2015
2 parents 6c0ac57 + 9e43644 commit f583fc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions bin/jsencrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3866,6 +3866,11 @@ RSAKey.prototype.parseKey = function (pem) {
var reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/;
var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);
var asn1 = ASN1.decode(der);

//Fixes a bug with OpenSSL 1.0+ private keys
if(asn1.sub.length === 3){
asn1 = asn1.sub[2].sub[0];
}
if (asn1.sub.length === 9) {

// Parse the private key.
Expand Down
Loading

0 comments on commit f583fc6

Please sign in to comment.