Added readCertHex.
diff --git a/js/securityLib/x509-1.1.js b/js/securityLib/x509-1.1.js
index d8cb473..c34c015 100644
--- a/js/securityLib/x509-1.1.js
+++ b/js/securityLib/x509-1.1.js
@@ -232,6 +232,24 @@
this.hex = hCert;
}
+/**
+ * read hex formatted X.509 certificate from string.
+ * @name readCertHex
+ * @memberOf X509#
+ * @function
+ * @param {String} hCert string for hex formatted X.509 certificate
+ */
+function _x509_readCertHex(hCert) {
+ hCert = hCert.toLowerCase();
+ var a = _x509_getPublicKeyHexArrayFromCertHex(hCert);
+ var rsa = new RSAKey();
+ rsa.setPublic(a[0], a[1]);
+ this.subjectPublicKeyRSA = rsa;
+ this.subjectPublicKeyRSA_hN = a[0];
+ this.subjectPublicKeyRSA_hE = a[1];
+ this.hex = hCert;
+}
+
function _x509_readCertPEMWithoutRSAInit(sCertPEM) {
var hCert = _x509_pemToHex(sCertPEM);
var a = _x509_getPublicKeyHexArrayFromCertHex(hCert);
@@ -260,6 +278,7 @@
}
X509.prototype.readCertPEM = _x509_readCertPEM;
+X509.prototype.readCertHex = _x509_readCertHex;
X509.prototype.readCertPEMWithoutRSAInit = _x509_readCertPEMWithoutRSAInit;
X509.prototype.getSerialNumberHex = _x509_getSerialNumberHex;
X509.prototype.getIssuerHex = _x509_getIssuerHex;