瀏覽代碼

Merge branch 'bug-x509-sig'

n1474335 8 年之前
父節點
當前提交
d53da4cfb5
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      src/core/operations/PublicKey.js

+ 9 - 2
src/core/operations/PublicKey.js

@@ -124,10 +124,17 @@ const PublicKey = {
         }
         }
 
 
         // Signature fields
         // Signature fields
-        if (r.ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0) { // DSA or ECDSA
+        let breakoutSig = false;
+        try {
+            breakoutSig = r.ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0;
+        } catch (err) {
+            // Error processing signature, output without further breakout
+        }
+
+        if (breakoutSig) { // DSA or ECDSA
             sigStr = "  r:              " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [0]), 16, 18) + "\n" +
             sigStr = "  r:              " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [0]), 16, 18) + "\n" +
                 "  s:              " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [1]), 16, 18) + "\n";
                 "  s:              " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [1]), 16, 18) + "\n";
-        } else { // RSA
+        } else { // RSA or unknown
             sigStr = "  Signature:      " + PublicKey._formatByteStr(certSig, 16, 18) + "\n";
             sigStr = "  Signature:      " + PublicKey._formatByteStr(certSig, 16, 18) + "\n";
         }
         }