From d0dfcb30df13a25b20e3a7de60c558fbfbc6b957 Mon Sep 17 00:00:00 2001 From: Jamie Copeland Date: Sun, 30 Mar 2014 21:30:18 -0400 Subject: [PATCH 1/2] Removes the trimming that occurs on user input passphrases for both BIP38 encryption and brainwallet. Issue is that the BIP38 encryption input is NOT trimmed, but subsequent passphrase on Wallet Details tab is trimmed. Thus the user is able to input leading or trailing spaces to encrypt the private key, but cannot include those leading and/or trailing spaces to decrypt the private key. --- bitaddress.org.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bitaddress.org.html b/bitaddress.org.html index 2de6df5..c766bad 100644 --- a/bitaddress.org.html +++ b/bitaddress.org.html @@ -8168,9 +8168,9 @@ ninja.wallets.brainwallet = { minPassphraseLength: 15, view: function () { - var key = document.getElementById("brainpassphrase").value.toString().replace(/^\s+|\s+$/g, ""); // trim white space + var key = document.getElementById("brainpassphrase").value.toString() document.getElementById("brainpassphrase").value = key; - var keyConfirm = document.getElementById("brainpassphraseconfirm").value.toString().replace(/^\s+|\s+$/g, ""); // trim white space + var keyConfirm = document.getElementById("brainpassphraseconfirm").value.toString() document.getElementById("brainpassphraseconfirm").value = keyConfirm; if (key == keyConfirm || document.getElementById("brainpassphraseshow").checked) { @@ -8373,7 +8373,7 @@ ninja.wallets.detailwallet = { document.getElementById("detailprivkeypassphrase").focus(); return; } - var passphrase = document.getElementById("detailprivkeypassphrase").value.toString().replace(/^\s+|\s+$/g, ""); // trim white space + var passphrase = document.getElementById("detailprivkeypassphrase").value.toString() if (passphrase == "") { alert(ninja.translator.get("bip38alertpassphraserequired")); return; From 63e6d2b3d7a32ec146b8867aa6b90a6380fc8cdf Mon Sep 17 00:00:00 2001 From: Jamie Copeland Date: Sun, 18 May 2014 14:12:23 -0400 Subject: [PATCH 2/2] Changes made to .js source files. --- src/ninja.brainwallet.js | 4 ++-- src/ninja.detailwallet.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ninja.brainwallet.js b/src/ninja.brainwallet.js index 8fd71a4..46980e3 100644 --- a/src/ninja.brainwallet.js +++ b/src/ninja.brainwallet.js @@ -12,9 +12,9 @@ ninja.wallets.brainwallet = { minPassphraseLength: 15, view: function () { - var key = document.getElementById("brainpassphrase").value.toString().replace(/^\s+|\s+$/g, ""); // trim white space + var key = document.getElementById("brainpassphrase").value.toString() document.getElementById("brainpassphrase").value = key; - var keyConfirm = document.getElementById("brainpassphraseconfirm").value.toString().replace(/^\s+|\s+$/g, ""); // trim white space + var keyConfirm = document.getElementById("brainpassphraseconfirm").value.toString() document.getElementById("brainpassphraseconfirm").value = keyConfirm; if (key == keyConfirm || document.getElementById("brainpassphraseshow").checked) { diff --git a/src/ninja.detailwallet.js b/src/ninja.detailwallet.js index 3f7d273..20ab5ce 100644 --- a/src/ninja.detailwallet.js +++ b/src/ninja.detailwallet.js @@ -37,7 +37,7 @@ ninja.wallets.detailwallet = { document.getElementById("detailprivkeypassphrase").focus(); return; } - var passphrase = document.getElementById("detailprivkeypassphrase").value.toString().replace(/^\s+|\s+$/g, ""); // trim white space + var passphrase = document.getElementById("detailprivkeypassphrase").value.toString() if (passphrase == "") { alert(ninja.translator.get("bip38alertpassphraserequired")); return;