kopia lustrzana https://github.com/robinmoisson/staticrypt
Update password_template.html
rodzic
94ea71cea8
commit
803f4648c9
|
@ -106,6 +106,10 @@
|
|||
text-align: center;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.staticrypt-footer a {
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
@ -124,7 +128,6 @@
|
|||
type="password"
|
||||
name="password"
|
||||
placeholder="passphrase"
|
||||
required
|
||||
autofocus/>
|
||||
|
||||
<input type="submit" class="staticrypt-decrypt-button" value="DECRYPT"/>
|
||||
|
@ -140,16 +143,14 @@
|
|||
{crypto_tag}
|
||||
|
||||
<script>
|
||||
document.getElementById('staticrypt-form').addEventListener('submit', function (e) {
|
||||
document.getElementById('staticrypt-form').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var passphrase = document.getElementById('staticrypt-password').value
|
||||
var encryptedMsg = '{encrypted}';
|
||||
|
||||
var encryptedHMAC = encryptedMsg.substring(0, 64);
|
||||
var encryptedHTML = encryptedMsg.substring(64);
|
||||
|
||||
var decryptedHMAC = CryptoJS.HmacSHA256(encryptedHTML, CryptoJS.SHA256(passphrase)).toString();
|
||||
var passphrase = document.getElementById('staticrypt-password').value,
|
||||
encryptedMsg = '{encrypted}',
|
||||
encryptedHMAC = encryptedMsg.substring(0, 64),
|
||||
encryptedHTML = encryptedMsg.substring(64),
|
||||
decryptedHMAC = CryptoJS.HmacSHA256(encryptedHTML, CryptoJS.SHA256(passphrase)).toString();
|
||||
|
||||
if (decryptedHMAC !== encryptedHMAC) {
|
||||
alert('Bad passphrase !');
|
||||
|
|
Ładowanie…
Reference in New Issue