-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsign.html
150 lines (143 loc) · 5.12 KB
/
sign.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>Web Crypto Samples</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="polycrypt/common/util.js"></script>
<script src="polycrypt/front/polycrypt.js"></script>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
.signature-valid {
background-color: #dff0d8;
color: #468847;
}
.signature-invalid {
background-color: #f0dfd8;
color: #884647;
}
</style>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> <span
class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Crypto samples</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse"
id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="hash.html">Hash</a></li>
<li class="active"><a href="#">Sign</a></li>
<li><a href="encrypt.html">Encrypt & Decrypt</a></li>
</ul>
<ul class="nav navbar-nav pull-right">
<li><a href="debug.html"><span class="glyphicon glyphicon-link"></span></a></li>
</ul>
</div>
</nav>
<section class="container lead">
<div id="unsupported-browser" class="alert alert-danger fade in" style="display:none">
<h4>Unsupported browser!</h4>
<p>This browser doesn't supports importing and exporting of jwk keys.</p>
</div>
This example demonstrates the usage of the <code>sign()</code>, <code>verify()</code>, <code>exportKey()</code> and <code>importKey()</code> functions using <code>RSASSA-PKCS1-v1_5</code>.
</section>
<section class="container">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#keysBody">Keys</a>
</h3>
</div>
<div id="keysBody" class="panel-collapse collapse in">
<div class="panel-body">
<form role="form">
<div class="form-group">
<button id="generatekeyPair" type="button" class="btn btn-default">Generate Key Pair</button>
<img id="loading" alt="loading" src="images/loading.gif" style="display:none; padding-left:18px"/>
</div>
<div class="form-group">
<label for="publicKey">My Public Key (JKW)</label>
<textarea class="form-control" rows="6" id="publicKey"></textarea>
</div>
<div class="form-group">
<label for="publicKeyOtherParty">Public Key Other party(JKW)</label>
<textarea class="form-control" rows="6" id="publicKeyOtherParty"></textarea>
</div>
</form>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#encryptBody">Sign</a>
</h3>
</div>
<div id="encryptBody" class="panel-collapse collapse">
<div class="panel-body">
<form role="form">
<div class="form-group">
<label for="message">Message</label>
<textarea class="form-control" rows="4" id="message"></textarea>
</div>
<div class="form-group">
<label for="signature">Signature</label>
<textarea class="form-control" rows="4" id="signature"></textarea>
</div>
</form>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#decryptBody">Verify</a>
</h3>
</div>
<div id="decryptBody" class="panel-collapse collapse">
<div class="panel-body">
<form role="form">
<div class="form-group">
<label for="messageOther">Message</label>
<textarea class="form-control" rows="4" id="messageOther"></textarea>
</div>
<div class="form-group">
<label for="signatureOther">Signature</label>
<textarea class="form-control" rows="4" id="signatureOther"></textarea>
</div>
<div id="result"></div>
</form>
</div>
</div>
</div>
</div>
</section>
<section class="container" style="margin-top:20px;">
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">Log</h3>
</div>
<div id="logContainer" class="panel-body pre-scrollable" style="height:200px">
</div>
</div>
</section>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/lib/jquery-2.0.3.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/lib/bootstrap.min.js"></script>
<script src="js/lib/base64.js"></script>
<script src="js/utils.js"></script>
<script src="js/sign.js"></script>
</body>
</html>