encryption.js: fix password not being used
This commit is contained in:
parent
48e562c936
commit
a6ff77c81f
@ -8,7 +8,7 @@ function getMsgEncoding () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getKeyMaterial () {
|
function getKeyMaterial () {
|
||||||
let pass = document.getElementById("password");
|
let pass = document.getElementById("password").value;
|
||||||
let enc = new TextEncoder();
|
let enc = new TextEncoder();
|
||||||
return window.crypto.subtle.importKey(
|
return window.crypto.subtle.importKey(
|
||||||
"raw",
|
"raw",
|
||||||
@ -91,7 +91,6 @@ async function enc () {
|
|||||||
|
|
||||||
outBox.innerHTML = `${bufTo64(output)}`;
|
outBox.innerHTML = `${bufTo64(output)}`;
|
||||||
let keyExp = await exportKey (key);
|
let keyExp = await exportKey (key);
|
||||||
window.alert(bufTo64(iv));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function dec () {
|
async function dec () {
|
||||||
@ -120,6 +119,6 @@ async function dec () {
|
|||||||
let dec = new TextDecoder();
|
let dec = new TextDecoder();
|
||||||
outBox.innerHTML = `${dec.decode(plaintext)}`;
|
outBox.innerHTML = `${dec.decode(plaintext)}`;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
window.alert(e.name);
|
window.alert("Decryption error: incorrect password?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user