mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-11-14 22:08:08 +00:00
Merge pull request #33 from clawoflight/master
encryption-pgp: support multiple recipients
This commit is contained in:
commit
23eaa68a33
2 changed files with 14 additions and 6 deletions
|
@ -21,8 +21,8 @@ QtObject {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identifier": "publicKey",
|
"identifier": "publicKey",
|
||||||
"name": "Public PGP Key",
|
"name": "Public PGP Keys",
|
||||||
"description": "Please enter your public pgp key:",
|
"description": "Please enter your ';'-separated public pgp keys or their emails:",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "F5161BD3",
|
"default": "F5161BD3",
|
||||||
},
|
},
|
||||||
|
@ -45,9 +45,17 @@ QtObject {
|
||||||
* @return the exncrypted or decrypted text
|
* @return the exncrypted or decrypted text
|
||||||
*/
|
*/
|
||||||
function encryptionHook(text, password, decrypt) {
|
function encryptionHook(text, password, decrypt) {
|
||||||
|
var encryptCommand = ["--encrypt", "--armor"];
|
||||||
|
// split public keys for gpg call
|
||||||
|
var pubKeys = publicKey.split(';');
|
||||||
|
for (var i = 0; i < pubKeys.length; i++) {
|
||||||
|
encryptCommand.append("-r");
|
||||||
|
encryptCommand.append(pubKeys[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// encrypt the text for public key or decrypt with gpg
|
// encrypt the text for public key or decrypt with gpg
|
||||||
// decryption will only work if you don't have to enter a password
|
// decryption will only work if you don't have to enter a password
|
||||||
var param = decrypt ? ["--decrypt"] : ["--encrypt", "--armor", "-r", publicKey];
|
var param = decrypt ? ["--decrypt"] : encryptCommand;
|
||||||
var result = script.startSynchronousProcess(gpgPath, param, text);
|
var result = script.startSynchronousProcess(gpgPath, param, text);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
"name": "PGP Encryption",
|
"name": "PGP Encryption",
|
||||||
"identifier": "encryption-pgp",
|
"identifier": "encryption-pgp",
|
||||||
"script": "encryption-pgp.qml",
|
"script": "encryption-pgp.qml",
|
||||||
"authors": ["@pbek"],
|
"authors": ["@pbek", "@ClawOfLight"],
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"minAppVersion": "17.05.7",
|
"minAppVersion": "17.05.7",
|
||||||
"description" : "This script will encrypt and decrypt notes with <a href='https://gnupg.org/'>PGP</a> instead of the internal AES-256 encryption.\nDecryption may only work if you don't have to enter a password."
|
"description" : "This script will encrypt and decrypt notes with <a href='https://gnupg.org/'>PGP</a> instead of the internal AES-256 encryption.\nDecryption may only work if you don't have to enter a password. Find out how to set up gpg-agent on your system."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue