1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

268 lines
12 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>QUnit for X509.getInfo() test in 'x509.js' </title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="qunit.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/core-min.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/sha1.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/jsbn.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/jsbn2.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/rsa.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/rsa2.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/sha1.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/base64.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/yahoo.js"></script>
<script language="JavaScript" type="text/javascript" src="../base64x-1.1.js"></script>
<script language="JavaScript" type="text/javascript" src="../crypto-1.1.js"></script>
<script language="JavaScript" type="text/javascript" src="../asn1hex-1.1.js"></script>
<script language="JavaScript" type="text/javascript" src="../rsapem-1.1.js"></script>
<script language="JavaScript" type="text/javascript" src="../rsasign-1.2.js"></script>
<script language="JavaScript" type="text/javascript" src="../x509-1.1.js"></script>
<script language="JavaScript" type="text/javascript" src="../asn1-1.0.js"></script>
<script language="JavaScript" type="text/javascript" src="../asn1x509-1.0.js"></script>
<script language="JavaScript" type="text/javascript" src="../keyutil-1.0.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// _test/0cert/github.com.cer
var certGithubPEM = (function() {/*
-----BEGIN CERTIFICATE-----
MIIF4DCCBMigAwIBAgIQDACTENIG2+M3VTWAEY3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inH75i4
-----END CERTIFICATE-----
*/}).toString().match(/\/\*([^]*)\*\//)[1];
// _test/0cert/digicertevroot.cer
var certDigicertOUT = (function() {/*Basic Fields
serial number: 02ac5c266a0b409b8f0b79f2ae462577
signature algorithm: SHA1withRSA
issuer: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
notBefore: 061110000000Z
notAfter: 311110000000Z
subject: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
subject public key info:
key algorithm: RSA
n=c6cce573e6fbd4bb...
e=10001
X509v3 Extensions:
keyUsage CRITICAL:
digitalSignature,keyCertSign,cRLSign
basicConstraints CRITICAL:
cA=true
subjectKeyIdentifier :
b13ec36903f8bf4701d498261a0802ef63642bc3
authorityKeyIdentifier :
kid=b13ec36903f8bf4701d498261a0802ef63642bc3
signature algorithm: SHA1withRSA
signature: 1c1a0697dcd79c9f...
*/}).toString().match(/\/\*([^]*)\*\//)[1];
// _test/0cert/pulse.cio.gov.cer
var certCioGovOUT = (function() {/*Basic Fields
serial number: 03e03a5d78e2a8e129eb0b3144f48c8a1b3d
signature algorithm: SHA256withRSA
issuer: /C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
notBefore: 160403023700Z
notAfter: 160702023700Z
subject: /CN=pulse.cio.gov
subject public key info:
key algorithm: RSA
n=cabe2d702f0a180c...
e=10001
X509v3 Extensions:
keyUsage CRITICAL:
digitalSignature,keyEncipherment
extKeyUsage :
serverAuth, clientAuth
basicConstraints CRITICAL:
{}
subjectKeyIdentifier :
f2eba920f40ce881494b5040e8db05286074a806
authorityKeyIdentifier :
kid=a84a6a63047dddbae6d139b7a64565eff3a8eca1
authorityInfoAccess :
ocsp: http://ocsp.int-x3.letsencrypt.org/
caissuer: http://cert.int-x3.letsencrypt.org/
subjectAltName :
https.cio.gov, pulse.cio.gov, staging.pulse.cio.gov
certificatePolicies :
signature algorithm: SHA256withRSA
signature: 0b76f2c64e9cf6fd...
*/}).toString().match(/\/\*([^]*)\*\//)[1];
// _test/0cert/github.com.cer
var certGithubOUT = (function() {/*Basic Fields
serial number: 0c009310d206dbe337553580118ddc87
signature algorithm: SHA256withRSA
issuer: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
notBefore: 140408000000Z
notAfter: 160412120000Z
subject: /businessCategory=Private Organization/jurisdictionOfIncorporationC=US/jurisdictionOfIncorporationSP=Delaware/SN=5157550/streetAddress=548 4th Street/postalCode=94107/C=US/ST=California/L=San Francisco/O=GitHub, Inc./CN=github.com
subject public key info:
key algorithm: RSA
n=b1d4dc3caffdf34e...
e=10001
X509v3 Extensions:
authorityKeyIdentifier :
kid=3dd350a5d6a0adeef34a600a65d321d4f8f8d60f
subjectKeyIdentifier :
6a43907d3b98147252953aaa280a43f8517ed3a6
subjectAltName :
github.com, www.github.com
keyUsage CRITICAL:
digitalSignature,keyEncipherment
extKeyUsage :
serverAuth, clientAuth
cRLDistributionPoints :
http://crl3.digicert.com/sha2-ev-server-g1.crl,http://crl4.digicert.com/sha2-ev-server-g1.crl
certificatePolicies :
authorityInfoAccess :
ocsp: http://ocsp.digicert.com
caissuer: http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt
basicConstraints CRITICAL:
{}
signature algorithm: SHA256withRSA
signature: 6fe76dcb82f3ef90...
*/}).toString().match(/\/\*([^]*)\*\//)[1];
test("X509.getInfo() DigiCert EV Root", function() {
var c = new X509();
c.readCertPEM(certDigicertPEM);
//c.readCertPEM(certGithubPEM);
equal(c.getInfo(), certDigicertOUT, certDigicertOUT);
});
test("X509.getInfo() pulse.cio.gov SSL cert", function() {
var c = new X509();
c.readCertPEM(certCioGovPEM);
equal(c.getInfo(), certCioGovOUT, certCioGovOUT);
});
test("X509.getInfo() github.com SSL cert", function() {
var c = new X509();
c.readCertPEM(certGithubPEM);
equal(c.getInfo(), certGithubOUT, certGithubOUT);
});
});
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
<p>
<a href="../">TOP</a> |
<a href="index.html">TEST INDEX</a> |
<a href="qunit-do-x509.html">x509</a> |
<a href="qunit-do-x509-ext.html">x509-ext</a> |
<a href="qunit-do-x509-key.html">x509-key</a> |
<a href="qunit-do-x509-kid.html">x509-kid</a> |
<a href="qunit-do-x509-getinfo.html">x509-getinfo</a> |
</p>
</body>
<center><p>&copy; 2016 Kenji Urushima</p></center>
</html>