forked from kjur/jsrsasign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtool_asn1dumper.html
executable file
·132 lines (118 loc) · 8.15 KB
/
tool_asn1dumper.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="description" content="Online ASN.1 Dumper powered by jsrsasign" />
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<title>Online ASN.1 Dumper (powered by jsrsasign)</title>
<script language="JavaScript" type="text/javascript" src="./jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript">
// _test/github.com.cer
var certGithubPEM = (function() {/*
-----BEGIN CERTIFICATE-----
MIIF4DCCBMigAwIBAgIQDACTENIG2+M3VTWAEY3chzANBgkqhkiG9w0BAQsFADB1
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVk
IFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE0MDQwODAwMDAwMFoXDTE2MDQxMjEy
MDAwMFowgfAxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYB
BAGCNzwCAQMTAlVTMRkwFwYLKwYBBAGCNzwCAQITCERlbGF3YXJlMRAwDgYDVQQF
Ewc1MTU3NTUwMRcwFQYDVQQ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UFMwgYgGCCsGAQUFBwEBBHwwejAkBggrBgEF
BQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMFIGCCsGAQUFBzAChkZodHRw
Oi8vY2FjZXJ0cy5kaWdpY2VydC5jb20vRGlnaUNlcnRTSEEyRXh0ZW5kZWRWYWxp
ZGF0aW9uU2VydmVyQ0EuY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQELBQAD
ggEBAG/nbcuC8++QhwnXDxUiLIz+06scipbbXRJd0XjAMbD/RciJ9wiYUhcfTEsg
ZGpt21DXEL5+q/4vgNipSlhBaYFyGQiDm5IQTmIte0ZwQ26jUxMf4pOmI1v3kj43
FHU7uUskQS6lPUgND5nqHkKXxv6V2qtHmssrA9YNQMEK93ga2rWDpK21mUkgLviT
PB5sPdE7IzprOCp+Ynpf3RcFddAkXb6NqJoQRPrStMrv19C1dqUmJRwIQdhkkqev
ff6IQDlhC8BIMKmCNK33cEYDfDWROtW7JNgBvBTwww8jO1gyug8SbGZ6bZ3k8OV8
XX4C2NesiZcLYbc2n7B9O+63M2k=
-----END CERTIFICATE-----
*/}).toString().match(/\/\*([^]*)\*\//)[1];
var ocspResHEX = "308206370a0100a08206303082062c06092b06010505073001010482061d3082061930819ea216041469ce07ff9b3f295016bc46d193e53205ef7cb7c5180f32303135303632303139323133365a307330713049300906052b0e03021a0500041474241467069ff5e0983f5e3e1a6ba0652a54157504140159abe7dd3a0b59a66463d6cf200757d591e76a02106d8e5dbb7c167851f8a2d6cb6b5f30458000180f32303135303632303139323133365aa011180f32303135303632373139323133365a300d06092a864886f70d010105050003820101006cafe806658da1a7bcf13935896412cc07375afc74e9dda77451a36ec428c5c93d63fa736b7c867700d27900b65fdc208a61d771135af73efc00f60cb0ac2ca4991f938cf4fda20e90f49944376a1afeaf1efa0cfa633f2b0011c6a64bcc8fe294265c4ba94762763d0902281d5bfb5b5d8dd53f3a46a1f5e802e7333981cf0d4613394248da8828049f9b8d05473260686286883e0d8bb375c22e680e833f1084efe8db4c215e2891118d5607c392c8e5b12a0104d1a61d604fe9de246ff1ac22a456f7c4ef0c69b6414fb4524a7ace321610f98c0f5566088eeda5245c59123be7c14a1929bf9132a86505e492e059a03bdc8ded719f051b274f9abe064e03a08204603082045c3082045830820340a00302010202107060c24389f44bb5ff3cd9475de27769300d06092a864886f70d01010b05003077310b3009060355040613025553311d301b060355040a131453796d616e74656320436f72706f726174696f6e311f301d060355040b131653796d616e746563205472757374204e6574776f726b312830260603550403131f53796d616e74656320436c61737320332045562053534c204341202d204733301e170d3135303431323030303030305a170d3135303731313233353935395a3039313730350603550403132e53796d616e74656320436c61737320332045562053534c204341202d204733204f43535020526573706f6e64657230820122300d06092a864886f70d01010105000382010f003082010a0282010100d64ceb922d19bfa94f4729a537398b30ebf5c6631c62bbcb769f306e16ca4057b4b5224a150fccb73e82baa609d6877334b1df7103a2da909fc7e0bb3db2b3a9eb2673380f8ee9e3716d3cb2293c0cedc85ee3ccb5a3d3a0f5cf60000bef038e5681a52c8c7e7b739e38dad594025b3ce6270835a9cc2a67af884262db46c2a5d1c3c0e3f9df9e7e13bc15f92f4d0a281dbfa81c3871b77c61a1d9af62bd292ee9dbdfdfd00a38078e1439dd328edd04ac12fd5c7baf71a67653a0073e4c2b0592b5edf0b557cdbba33bac4ac1b3d763b4ee7bba7a8fa1f0b113f8972b6e67058f900fce2ffbc72e2f5dbbeff61cb1cd6627ffe15d2f8f62eb8709a734c9359f0203010001a382011c30820118300f06092b06010505073001050402050030220603551d11041b3019a4173015311330110603550403130a5447562d422d33353939301f0603551d230418301680140159abe7dd3a0b59a66463d6cf200757d591e76a301d0603551d0e0416041469ce07ff9b3f295016bc46d193e53205ef7cb7c5300c0603551d130101ff04023000306e0603551d20046730653063060b6086480186f845010717033054302606082b06010505070201161a687474703a2f2f7777772e73796d617574682e636f6d2f637073302a06082b06010505070202301e1a1c2020687474703a2f2f7777772e73796d617574682e636f6d2f72706130130603551d25040c300a06082b06010505070309300e0603551d0f0101ff040403020780300d06092a864886f70d01010b0500038201010048b21764459225136166708e24e597ac2fe680694cc95435e209d80cdd3c83de7d134619cb87482729f5ef8453dada52ca9be8065b819899b79675f3b4cf9cd25f2483b0d352aed1eb51e2b59e75d4bf39a0929d986681bfaeefc4b4998f5135d8a6c0d1ef0e8d30a04b3a736ae7858bc02471eb08e5cf789798ad35e46316d37892310e21a9045d5bad956aa1bd9b10692c54d4bd3fa1dcddb746baabdbfcfaad75ffdb51ba9019823d1180e41c57577325c35dbbedd705d77896a1d3d76242a36ace68681ba7d2f22e26324c04ff18272fa7a71d083991bc087b50c0e34105106cf1e382dbeddf7577a291386edec609283e4e3f6419717934a725f30c6530";
function _doDump() {
var f1 = document.form1;
try {
var s = f1.s_in.value;
if (s.indexOf("-----BEGIN") != -1) {
s = X509.pemToHex(s);
} else {
s = s.replace(/^\s+/, '');
s = s.replace(/\s+$/, '');
}
f1.s_out.value = ASN1HEX.dump(s);
} catch (ex) {
alert(ex);
}
}
function _setSample() {
var f1 = document.form1;
switch (f1.sample1.value) {
case "hexoid": f1.s_in.value = "0603550406"; _doDump(); break;
case "hexseq": f1.s_in.value = "3006020101020102"; _doDump(); break;
case "cert": f1.s_in.value = certGithubPEM; _doDump(); break;
case "ocsp": f1.s_in.value = ocspResHEX; _doDump(); break;
default: f1.s_in.value = ""; break;
}
}
</script>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
<h1 id="project_title">Online ASN.1 Dumper</h1>
<h2 id="project_tagline">Dump PEM or hexadecimal string of ASN.1 data by Pure JavaScript.</h2>
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<!-- now editing -->
<form name="form1">
<h4>(Step1) Fill any PEM or hexadecimal string of ASN.1 data to be decoded.</h4>
<textarea name="s_in" rows="10" cols="100"></textarea>
<select name="sample1" onChange="_setSample()">
<option value="none"> You can also choose sample input here...
<option value="hexoid"> sample hexadecimal string of ASN.1 Object Identifier
<option value="hexseq"> sample hexadecimal string of ASN.1 Sequence
<option value="cert"> sample PEM X.509 certificate
<option value="ocsp"> sample OCSP response of https://www.symantec.com
</select>
<br/>
<input type="button" value="Dump it" onClick="_doDump();"/><br/>
<hr>
<h2>ASN.1 dump result</h2>
<textarea name="s_out" cols="100" rows="80"></textarea>
</form>
<!-- now editing -->
</section>
</div>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner">
<p class="copyright">jsjws maintained by <a href="https://github.com/kjur">@kjur</a></p>
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
<div align="center" style="color: white">
Copyright © 2015 Kenji Urushima. All rights reserved.
</div>
</footer>
</div>
</body>
</html>