-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
118 lines (110 loc) · 5.85 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>UONET+ Request Signer by Wulkanowy</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/forge/0.7.6/forge.min.js" integrity="sha256-buw1I7+E0zKU1A6C+nlpXPJIEuA59qCBHeX4Ktd3cLI=" crossorigin="anonymous"></script>
<script src="js/signer.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.min.js" integrity="sha256-uRIJ6Wfou5cTtmcCvQNA9lvsYl8sUbZXxnfG+P79ssY=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/mode/javascript/javascript.min.js" integrity="sha256-soPk2bgFhLwixxuyUzaWVadUMcVwWNE5JZwYdQhL4Xk=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsonlint/1.6.0/jsonlint.min.js" integrity="sha256-yWZBgNxWVjnXu4Tut5/J0MAvczYc2U3SuK0svKSMaW4=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/addon/lint/lint.js" integrity="sha256-2Juixn3iQDBB1tHwXcjJ+X6d4ihPItrLbEXcPU+3Xjw=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/addon/lint/json-lint.min.js" integrity="sha256-mWRA+eRb2A3v8WLC4QSEVKYYgWuy1jYrLoi4+tbWrnU=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css" integrity="sha256-oSrCnRYXvHG31SBifqP2PM1uje7SJUyX0nTwO2RJV54=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.min.css" integrity="sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/theme/monokai.min.css" integrity="sha256-jAukb65gp2gG6t4FtxpHgB3eFwM/rDUwrE2OaAp6+o8=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/addon/lint/lint.css" integrity="sha256-dDBnEiZOZC2E52rfFN3yqILyvNpxc1Q4Z0cI23L+wgQ=" crossorigin="anonymous" />
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header class="header">
<h1>UONET+ Request Signer by Wulkanowy</h1>
</header>
<main class="main">
<form class="form">
<p class="form__password">
<label>Password:
<input id="password" type="text" size="39" required>
</label>
</p>
<p class="form__certificate">
<label>Certificate (CertyfikatPfx):
<textarea id="cert" spellcheck="false" required></textarea>
</label>
</p>
<p class="form__body">
<label>Body to sign (json):
<textarea id="body">{}</textarea>
</label>
</p>
<p class="form__button">
<button id="sign-button" class="button">Sign</button>
</p>
<p class="form__result">
<label>Result (RequestSignatureValue):
<textarea id="result" spellcheck="false" readonly></textarea>
</label>
</p>
<p class="form__log">
<label>Log:
<textarea id="log" readonly></textarea>
</label>
</p>
</form>
</main>
<footer class="footer">
© 2018 by <a href="https://wulkanowy.github.io">Wulkanowy</a> |
<a href="https://github.com/wulkanowy/uonet-request-signer">GitHub</a> |
<a href="https://github.com/wulkanowy/uonet-request-signer/tree/master/php">PHP implementation</a> |
<a href="https://github.com/wulkanowy/uonet-request-signer/tree/master/js">JS implementation</a> |
<a href="https://github.com/VLO-GDA/uonet-sdk/blob/master/src/main/java/net/maciekmm/uonet/EncryptionUtils.java">Java implementation</a>
</footer>
<script>
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
return uuid.toUpperCase();
}
document.querySelector("#body").value = JSON.stringify({
"RemoteMobileTimeKey": Math.floor(Date.now() / 1000) + 1,
"TimeKey": Math.floor(Date.now() / 1000),
"RequestId": uuid(),
"RemoteMobileAppVersion": "18.4.1.388",
"RemoteMobileAppName": "VULCAN-Android-ModulUcznia"
}, null, 4) + "\n";
window.addEventListener("error", function(evt) {
logToArea(evt.message || evt.type);
}, true);
function logToArea(text) {
document.querySelector("#log").value = new Date().toLocaleTimeString()
+ " " + text + "\n"
+ document.querySelector("#log").value;
}
const editor = CodeMirror.fromTextArea(document.querySelector("#body"), {
lineNumbers: true,
theme: "monokai",
mode: "application/json",
gutters: ["CodeMirror-lint-markers"],
lint: true
});
document.querySelector("#sign-button").addEventListener('click', function (e) {
e.preventDefault();
signer.signContent(
document.querySelector("#password").value,
document.querySelector("#cert").value,
editor.getValue()
).then(function(result) {
document.querySelector("#result").value = result;
logToArea("Signed successfully");
});
});
</script>
</body>
</html>