fullstack.web/swa/asn1/index.html
2024-03-07 11:32:45 +08:00

83 lines
2.9 KiB
HTML

<!DOCTYPE html>
<html lang="en-US,zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ASN.1 JavaScript decoder</title>
<link rel="stylesheet" href="index.css" type="text/css">
</head>
<body style="padding: 3rem">
<h1>ASN.1 JavaScript decoder</h1>
<div style="position: relative; padding-bottom: 1em;">
<div id="dump" style="position: absolute; right: 0px;"></div>
<div id="tree"></div>
</div>
<form>
<textarea id="area" style="width: 100%;" rows="8"></textarea>
<br>
<label title="can be slow with big files"><input type="checkbox" id="wantHex" checked="checked">显示 HEX DUMP</label>
<input id="butDecode" type="button" value="解码">
<input id="butClear" type="button" value="清空">
<input type="file" id="file">
<div>
示例:
<select id="examples">
<option value="sig-p256-der.p7m">PKCS#7/CMS attached signature (DER)</option>
<option value="sig-p256-ber.p7m">PKCS#7/CMS attached signature (BER)</option>
<option value="sig-rsa1024-sha1.p7s">PKCS#7/CMS detached signature (old)</option>
<option value="letsencrypt-x3.cer">X.509 certificate: Let's Encrypt X3</option>
<option value="ed25519.cer">X.509 certificate: ed25519 (RFC 8410)</option>
</select>
<input id="butExample" type="button" value="载入示例">
</div>
</form>
<script type="text/javascript" src="hex.js"></script>
<script type="text/javascript" src="base64.js"></script>
<script type="text/javascript" src="oids.js"></script>
<script type="text/javascript" src="int10.js"></script>
<script type="text/javascript" src="asn1.js"></script>
<script type="text/javascript" src="dom.js"></script>
<script type="text/javascript" src="index.js"></script>
<script type="application/javascript" src="./jquery-1.8.0.min.js"></script>
<script type="application/javascript">
$(function (){
$(document).keydown(function(event) {
if (event.ctrlKey && event.which == 67) {
console.log("Ctrl + C 被按下");
event.preventDefault(); // 阻止默认的复制操作
// 寻找激活的 node
$(".node:hover").each(function() {
var $this = $(this)
if ( $this.hasClass("node") && $this.hasClass("collapsed") ) {
console.log("当前 hover 的标签:", this);
let $b = $this.find("b")[0]
if ( $b ) {
var v = $($b).text()
console.log("v=" , v)
navigator.clipboard.writeText(v)
.then(function() {
console.log('内容已复制到剪贴板');
// 可选:清除输入框内容
tempInput.remove();
})
.catch(function(err) {
console.error('无法写入剪贴板:', err);
// 可选:清除输入框内容
tempInput.remove();
});
}
}
});
}
});
})
</script>
</body>
</html>