-
-
Notifications
You must be signed in to change notification settings - Fork 648
/
qunit-do-asn1-oidhex.html
executable file
·49 lines (41 loc) · 1.71 KB
/
qunit-do-asn1-oidhex.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>QUnit for ASN1Util.oidHexToInt/IntToHex in 'asn1.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" />
<!-- getPEM -->
<script language="JavaScript" type="text/javascript" src="../ext/cryptojs-312-core-fix.js"></script>
<script src="../ext/jsbn.js"></script>
<script src="../ext/jsbn2.js"></script>
<script src="../ext/base64.js"></script>
<script src="../src/base64x-1.1.js"></script>
<script src="../src/asn1-1.0.js"></script>
<script src="../src/asn1x509-1.0.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
// ======= TEST ===============================================================
var oidHexToInt = KJUR.asn1.ASN1Util.oidHexToInt;
var oidIntToHex = KJUR.asn1.ASN1Util.oidIntToHex;
test("oidHexToInt ", function() {
equal(oidHexToInt("2b0e03021a"), "1.3.14.3.2.26", "oidHexToInt 1.3.14.3.2.26/sha1");
equal(oidHexToInt("2a864886f70d010702"), "1.2.840.113549.1.7.2", "oidHexToInt 1.2.840.113549.1.7.2/signedData");
equal(oidHexToInt("2a2283bb55"), "1.2.34.56789", "oidHexToInt 1.3.34.56789");
});
test("oidIntToHex", function() {
equal((new BigInteger(oidIntToHex("1.2.34.56789"), 16)).toString(2), "10101000100010100000111011101101010101", "oidIntToHex 1.2.34.56789 bin");
equal(oidIntToHex("1.2.34.56789"), "2a2283bb55", "oidIntToHex 1.2.34.56789 hex");
});
});
-->
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
</body>
</html>