mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
#89 Added signing using GnuPG
This commit is contained in:
parent
8d0154530c
commit
2c5322129c
5 changed files with 59 additions and 28 deletions
|
|
@ -114,17 +114,16 @@ export const PgpUserStore = new class {
|
|||
* Returns the first library that can.
|
||||
*/
|
||||
async getKeyForSigning(email) {
|
||||
/* // TODO: sign in PHP fails
|
||||
let key = GnuPGUserStore.getPrivateKeyFor(email, 1);
|
||||
if (key) {
|
||||
return ['gnupg', key];
|
||||
}
|
||||
*/
|
||||
let key = OpenPGPUserStore.getPrivateKeyFor(email, 1);
|
||||
if (key) {
|
||||
return ['openpgp', key];
|
||||
}
|
||||
|
||||
key = GnuPGUserStore.getPrivateKeyFor(email, 1);
|
||||
if (key) {
|
||||
return ['gnupg', key];
|
||||
}
|
||||
|
||||
// return await this.getMailvelopePrivateKeyFor(email, 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -431,6 +431,7 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
if (sign && !draft && sign[1]) {
|
||||
if ('openpgp' == sign[0]) {
|
||||
// Doesn't sign attachments
|
||||
params.Html = params.Text = '';
|
||||
let signed = new MimePart;
|
||||
signed.headers['Content-Type'] =
|
||||
'multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"';
|
||||
|
|
@ -441,19 +442,17 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
signature.headers['Content-Transfer-Encoding'] = '7Bit';
|
||||
signature.body = await OpenPGPUserStore.sign(data.toString(), sign[1], 1);
|
||||
signed.children.push(signature);
|
||||
params.Signed = signed.toString();
|
||||
params.Boundary = signed.boundary;
|
||||
data = signed;
|
||||
/*
|
||||
} else if ('gnupg' == sign[0])) {
|
||||
} else if ('gnupg' == sign[0]) {
|
||||
// TODO: sign in PHP fails
|
||||
// params.SignData = data.toString();
|
||||
params.SignFingerprint = sign[1].fingerprint;
|
||||
params.SignPassphrase = await GnuPGUserStore.sign(sign[1]);
|
||||
*/
|
||||
} else {
|
||||
throw 'Signing with ' + sign[0] + ' not yet implemented';
|
||||
}
|
||||
params.Signed = data.toString();
|
||||
params.Boundary = data.boundary;
|
||||
params.Html = params.Text = '';
|
||||
}
|
||||
if (encrypt) {
|
||||
if ('openpgp' == encrypt) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue