Skip to content

Commit

Permalink
Updated encryption mode to GCM
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianchifor committed May 29, 2017
1 parent 8a32818 commit 9f376e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [Ctrl + V Space](https://ctrlv.space)

Encrypted paste service. **Encryption (AES256 using [Stanford Javascript Crypto Library](http://bitwiseshiftleft.github.io/sjcl/)) only happens on the client-side** and the **password is never sent to the server**.
Encrypted paste service. **Encryption (AES256 GCM using [Stanford Javascript Crypto Library](http://bitwiseshiftleft.github.io/sjcl/)) only happens on the client-side** and the **password is never sent to the server**.

The paste creation process:
- Save button triggers `save()` function in *index.html*.
Expand Down
4 changes: 2 additions & 2 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h2 id="instruction" onclick="selectText('instruction')">Just write, save and sh
}

var password = generatePassword(16, false);
var ciphertext = sjcl.encrypt(password, mde.value(), { ks:256 });
var ciphertext = sjcl.encrypt(password, mde.value(), { mode: "gcm", ks:256 });

var formData = {};

Expand All @@ -184,7 +184,7 @@ <h2 id="instruction" onclick="selectText('instruction')">Just write, save and sh

if (destructOption == "read") {
var token = generatePassword(64, false);
var encryptedToken = sjcl.encrypt(password, token, { ks:256 });
var encryptedToken = sjcl.encrypt(password, token, { mode: "gcm", ks:256 });

formData = {
"ciphertext": String(ciphertext),
Expand Down
4 changes: 2 additions & 2 deletions templates/paste.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if (ciphertext && ciphertext.length > 1) {
ciphertext = ciphertext.replace(/&#34;/g, '"');
try {
var text = sjcl.decrypt(password, ciphertext, { ks:256 });
var text = sjcl.decrypt(password, ciphertext, { mode: "gcm", ks:256 });
mde.value(text);
} catch (err) {
mde.value("Failed to decrypt content. **" + password + "** is not the right password.")
Expand All @@ -48,7 +48,7 @@
encryptedToken = encryptedToken.replace(/&#34;/g, '"');

try {
var token = sjcl.decrypt(password, encryptedToken, { ks:256 });
var token = sjcl.decrypt(password, encryptedToken, { mode: "gcm", ks:256 });
$.post("/api/v1/destruct", { "key": "{{ key }}", "token": token }, function(data) {});
} catch (err) {}
}
Expand Down

0 comments on commit 9f376e4

Please sign in to comment.