-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
741c78d
commit 17b89af
Showing
1 changed file
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<!DOCTYPE html> | ||
<html lang="zh"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" | ||
crossorigin="anonymous"></script> | ||
<title>SHA256 with RSA</title> | ||
</head> | ||
<body class="container-md"> | ||
<div class="row my-4"> | ||
<div class="col-md-12"> | ||
<h1>SHA256 with RSA</h1> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-3"> | ||
<ul class="navbar-nav flex-grow-1 my-4" style="position: fixed;"> | ||
<li style="margin-bottom: 0.5rem;">滚动到</li> | ||
<li style="margin-bottom: 0.5rem;"><a href="#generate" style="text-decoration: none;">生成</a></li> | ||
<li style="margin-bottom: 0.5rem;"><a href="#sign" style="text-decoration: none;">签名</a></li> | ||
<li style="margin-bottom: 0.5rem;"><a href="#verify" style="text-decoration: none;">验证</a></li> | ||
<li style="margin-bottom: 0.5rem;"><a href="#encrypt" style="text-decoration: none;">加密</a></li> | ||
<li style="margin-bottom: 0.5rem;"><a href="#decrypt" style="text-decoration: none;">解密</a></li> | ||
</ul> | ||
</div> | ||
<div class="col-md-9"> | ||
<div class="card my-4"> | ||
<div class="card-header" id="generate">生成</div> | ||
<div class="card-body"> | ||
<p><i>生成一个新的PEM格式的RSA密钥对。</i></p> | ||
<div> | ||
<label>复杂度 | ||
<input type="number" id="generate-complexity" value="2048" class="form-control"> | ||
</label> | ||
</div> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>私钥</th> | ||
<th>公钥</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><a id="privateKeyLink" style="display: none; text-decoration: none;">下载</a></td> | ||
<td><a id="publicKeyLink" style="display: none; text-decoration: none;">下载</a></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p id="generate-error" style="color: red;"></p> | ||
</div> | ||
<div class="card-footer"> | ||
<button class="btn btn-success" onclick="generate()">开始</button> | ||
<button class="btn disabled" style="display: none; color: green;" id="update_generate_msg">已更新</button> | ||
</div> | ||
</div> | ||
<div class="card my-4"> | ||
<div class="card-header" id="sign">签名</div> | ||
<div class="card-body"> | ||
<p><i>使用私钥为消息签名,以证明身份。</i></p> | ||
<div> | ||
<label>私钥 | ||
<input type="file" id="sign-private-key" class="form-control"> | ||
</label> | ||
</div> | ||
<label for="sign-content">消息</label> | ||
<textarea rows="5" id="sign-content" class="form-control"></textarea> | ||
<label for="sign-signature">签名</label> | ||
<textarea rows="3" id="sign-signature" class="form-control" readonly disabled></textarea> | ||
<p id="sign-error" style="color: red;"></p> | ||
</div> | ||
<div class="card-footer"> | ||
<button class="btn btn-success" onclick="sign()">开始</button> | ||
<button class="btn disabled" style="display: none; color: green;" id="update_sign_msg">已更新</button> | ||
</div> | ||
</div> | ||
<div class="card my-4"> | ||
<div class="card-header" id="verify">验证</div> | ||
<div class="card-body"> | ||
<p><i>验证消息是否来自对应私钥的所有者。</i></p> | ||
<div> | ||
<label>公钥 | ||
<input type="file" id="verify-public-key" class="form-control"> | ||
</label> | ||
</div> | ||
<label for="verify-content">消息</label> | ||
<textarea rows="5" id="verify-content" class="form-control" placeholder="末尾的空格和换行符可能导致不同的结果。"></textarea> | ||
<label for="verify-signature">签名</label> | ||
<textarea rows="3" id="verify-signature" class="form-control"></textarea> | ||
<p>结果:<span id="verify-result"></span></p> | ||
<p id="verify-error" style="color: red;"></p> | ||
</div> | ||
<div class="card-footer"> | ||
<button class="btn btn-success" onclick="verify()">开始</button> | ||
<button class="btn disabled" style="display: none; color: green;" id="update_verify_msg">已更新</button> | ||
</div> | ||
</div> | ||
<div class="card my-4"> | ||
<div class="card-header" id="encrypt">加密</div> | ||
<div class="card-body"> | ||
<p><i>对消息加密,使得仅对应的私钥可以解密。</i></p> | ||
<div> | ||
<label>公钥 | ||
<input type="file" id="encrypt-public-key" class="form-control"> | ||
</label> | ||
</div> | ||
<label for="encrypt-content">消息</label> | ||
<textarea rows="5" id="encrypt-content" class="form-control"></textarea> | ||
<label for="encrypt-result">加密内容</label> | ||
<textarea rows="8" id="encrypt-result" class="form-control" readonly disabled></textarea> | ||
<p id="encrypt-error" style="color: red;"></p> | ||
</div> | ||
<div class="card-footer"> | ||
<button class="btn btn-success" onclick="encrypt()">开始</button> | ||
<button class="btn disabled" style="display: none; color: green;" id="update_encrypt_msg">已更新</button> | ||
</div> | ||
</div> | ||
<div class="card my-4"> | ||
<div class="card-header" id="decrypt">解密</div> | ||
<div class="card-body"> | ||
<p><i>解密由对应公钥加密的消息。</i></p> | ||
<div> | ||
<label>私钥 | ||
<input type="file" id="decrypt-private-key" class="form-control"> | ||
</label> | ||
</div> | ||
<label for="decrypt-content">加密内容</label> | ||
<textarea rows="8" id="decrypt-content" class="form-control" placeholder="按以下格式粘贴: | ||
{ | ||
"encrypted_session_key": "...", | ||
"nonce": "...", | ||
"tag": "...", | ||
"encrypted_message": "..." | ||
}"></textarea> | ||
<label for="decrypt-result">消息</label> | ||
<textarea rows="5" id="decrypt-result" class="form-control" readonly disabled></textarea> | ||
<p id="decrypt-error" style="color: red;"></p> | ||
</div> | ||
<div class="card-footer"> | ||
<button class="btn btn-success" onclick="decrypt()">开始</button> | ||
<button class="btn disabled" style="display: none; color: green;" id="update_decrypt_msg">已更新</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |