1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>RSA加密</title>
- <link href="AFrontEnd/css/special.css" rel="stylesheet" />
- </head>
- <body class="sp-page-center" onkeydown="keyLogin();">
- <div class="sp-box" style="line-height: 30px">
- <div class="sp-page" style="width: 10%;">内容:</div>
- <textarea style="width: 80%; resize: none; " rows="10" class="sp-textarea" id="content"></textarea>
- <div class="sp-page sp-pull-right" style="width: 10%;"><button class="sp-btn-blue" onclick="encrypt()">加密</button></div>
- <div class="sp-page" style="width: 20%;">加密内容:</div>
- <textarea style="width: 80%; resize: none; " rows="10" class="sp-textarea" id="content2"></textarea>
- <div class="sp-page" style="width: 20%;">base64加密内容:</div>
- <textarea style="width: 80%; resize: none; " rows="10" class="sp-textarea" id="content3"></textarea>
- </div>
- <script src="AFrontEnd/js/jquery/jquery-1.8.3.min.js"></script>
- <script src="js/jsencrypt.js"></script>
- <script src="js/base64.js"></script>
- <script>
- var base64 = new Base64();
- var key="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgUCcDOMnAD6DXdRhPv7rsV3r9BTjFSog8IijWC9HqxxO2KrzQa_lDi9ox5_fwCSueifWykEfR55JyLdG-gnDywbErrdCMoNlq4-5aSFiieY1-0GsZYUmpN5FSvx_zPyjHzOQZgjoZ4ugzNG4cscRWbE6xH_BRfjUwQwhsecBBbzUw36KsXgpJD8UOadtx6LQTnHy93fWm1n-zmyiq3fuAOjv2VuJ8XOqfoVv6qljH_DgZ_e7CSGnhTEeKjGdys_qm2AVll3PejG4ufmj_bjMXIr0QY6YfQILK2NsLBLduqNWnH_wi8DTg4xfbcJi_Dm8SlXP4NiX8IVTTdlj4o-soQIDAQAB"
- function keyLogin() {
- if (event.keyCode == 13) //回车键的键值为13
- {
- encrypt();
- }
- }
- function encrypt() {
- var time1 = new Date().getTime();
- var jsencrypt = new JSEncrypt()
- jsencrypt.setPublicKey(key)
- var encryptMsg = jsencrypt.encrypt($("#content").val())
- $("#content2").val(encryptMsg)
- $("#content3").val(base64.encode(encryptMsg))
- var time2 = new Date().getTime();
- console.log(encryptMsg)
- console.log(time1, time2)
- }
- var n = 0;
- document.addEventListener("visibilitychange", function () {
- if (document.visibilityState == "visible") {
- n++
- console.log("jsencrypt.html" + n)
- }
- })
- </script>
- </body>
- </html>
|