Added AES decryption to #sign

Added a passphrase input to #sign which allows you to enter an AES-256
encrypted key into the private key input if you chose, which will be
decrypted using the passphrase.
This commit is contained in:
Will Caine 2016-01-22 23:47:40 +00:00
parent c276998687
commit 2cd9465de9
2 changed files with 15 additions and 0 deletions

View File

@ -874,6 +874,10 @@
</span>
</div>
</div>
<div class="col-md-12">
<label for="signPrivateKeyPassphrase">Passphrase (optional)</label>
<input id="signPrivateKeyPassphrase" type="password" class="form-control" value="">
</div>
</div>
<br>

View File

@ -1196,7 +1196,18 @@ $(document).ready(function() {
$("#signBtn").click(function(){
var wifkey = $("#signPrivateKey");
var passphrase = $("#signPrivateKeyPassphrase");
var script = $("#signTransaction");
if(passphrase.val()!=""){
var decrypted = CryptoJS.AES.decrypt(wifkey.val(), passphrase.val()).toString(CryptoJS.enc.Utf8);
if(coinjs.addressDecode(decrypted)){
$(passphrase).parent().removeClass('has-error');
wifkey.val(decrypted);
} else {
$(passphrase).parent().addClass('has-error');
}
}
if(coinjs.addressDecode(wifkey.val())){
$(wifkey).parent().removeClass('has-error');