From cvs at cvs.gnupg.org Wed Aug 1 12:53:08 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Wed, 01 Aug 2018 12:53:08 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-86-g68a012d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 68a012deb3b501d7417778be12c88bd475a37cb5 (commit) from 6313a2de9ee84a9321292f775e4d6c790486d3dc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 68a012deb3b501d7417778be12c88bd475a37cb5 Author: Maximilian Krambach Date: Wed Aug 1 12:51:12 2018 +0200 js: make init export immutable -- * src/index.js: The export now uses a freezed Object, which does not allow for simply overwriting the init method by e.g. a third-party library. * BrowsertestExtension: Added some tests trying if decryption of bad data properly fails diff --git a/lang/js/BrowserTestExtension/browsertest.html b/lang/js/BrowserTestExtension/browsertest.html index de8cd41..a20cfe1 100644 --- a/lang/js/BrowserTestExtension/browsertest.html +++ b/lang/js/BrowserTestExtension/browsertest.html @@ -19,6 +19,7 @@ + diff --git a/lang/js/BrowserTestExtension/tests/decryptTest.js b/lang/js/BrowserTestExtension/tests/decryptTest.js new file mode 100644 index 0000000..c6b3a3c --- /dev/null +++ b/lang/js/BrowserTestExtension/tests/decryptTest.js @@ -0,0 +1,62 @@ +/* gpgme.js - Javascript integration for gpgme + * Copyright (C) 2018 Bundesamt f?r Sicherheit in der Informationstechnik + * + * This file is part of GPGME. + * + * GPGME is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * GPGME is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, see . + * SPDX-License-Identifier: LGPL-2.1+ + * + * Author(s): + * Maximilian Krambach + */ + +/* global describe, it, before, expect, Gpgmejs */ +/* global bigString, inputvalues, sabotageMsg*/ + +describe('Decryption', function () { + let context = null; + const good_fpr = inputvalues.encrypt.good.fingerprint; + + before(function(done){ + const prm = Gpgmejs.init(); + prm.then(function(gpgmejs){ + context = gpgmejs; + done(); + }); + }); + + it('Decryption of random string fails', function (done) { + let data = bigString(20 * 1024); + context.decrypt(data).then( + function(){}, + function(error){ + expect(error).to.be.an('error'); + expect(error.code).to.equal('GNUPG_ERROR'); + done(); + }); + }); + + it('Decryption of slightly corrupted message fails', function (done) { + const data = bigString(10000); + context.encrypt(data, good_fpr).then(function(enc){ + context.decrypt(sabotageMsg(enc.data)).then( + function(){}, + function(error){ + expect(error).to.be.an('error'); + expect(error.code).to.equal('GNUPG_ERROR'); + done(); + }); + }); + }).timeout(5000); +}); \ No newline at end of file diff --git a/lang/js/BrowserTestExtension/tests/inputvalues.js b/lang/js/BrowserTestExtension/tests/inputvalues.js index 9d956b6..1e8f154 100644 --- a/lang/js/BrowserTestExtension/tests/inputvalues.js +++ b/lang/js/BrowserTestExtension/tests/inputvalues.js @@ -248,3 +248,39 @@ const ImportablePublicKey = {// eslint-disable-line no-unused-vars '=9WZ7\n' + '-----END PGP PUBLIC KEY BLOCK-----\n' }; + +/** + * Changes base64 encoded gpg messages + * @param {String} msg input message + * @param {Number} rate of changes as percentage of message length. + * @param {[Number, Number]} p begin and end of the message left untouched (to + * preserve) header/footer + */ +// eslint-disable-next-line no-unused-vars +function sabotageMsg(msg, rate = 0.01, p= [35,35]){ + const iterations = Math.floor(Math.random() * msg.length * rate) + 1; + const base64_set = + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/'; + for (let i=0; i < iterations; i++){ + let str0, str1, str2; + const chosePosition = function(){ + let position = + Math.floor( Math.random() * (msg.length - p[0] + p[1])) + + p[0]; + str1 = msg.substring(position,position+1); + if (str1 === '\n'){ + chosePosition(); + } else { + str0 = msg.substring(0,position); + str2 = msg.substring(position +1); + } + }; + chosePosition(); + let new1 = function(){ + let n = base64_set[Math.floor(Math.random() * 64)]; + return (n === str1) ? new1() : n; + }; + msg = str0.concat(new1()).concat(str2); + } + return msg; +} diff --git a/lang/js/src/index.js b/lang/js/src/index.js index 2fed95f..51f0753 100644 --- a/lang/js/src/index.js +++ b/lang/js/src/index.js @@ -34,7 +34,7 @@ import { Connection } from './Connection'; */ function init(){ return new Promise(function(resolve, reject){ - let connection = Object.freeze(new Connection); + const connection = Object.freeze(new Connection); connection.checkConnection(false).then( function(result){ if (result === true) { @@ -48,6 +48,5 @@ function init(){ }); } -export default { - init: init -}; \ No newline at end of file +const exportvalue = Object.freeze({init:init}); +export default exportvalue; \ No newline at end of file ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/browsertest.html | 1 + .../tests/{longRunningTests.js => decryptTest.js} | 46 ++++++++++++---------- lang/js/BrowserTestExtension/tests/inputvalues.js | 36 +++++++++++++++++ lang/js/src/index.js | 7 ++-- 4 files changed, 66 insertions(+), 24 deletions(-) copy lang/js/BrowserTestExtension/tests/{longRunningTests.js => decryptTest.js} (59%) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 6 09:33:37 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 06 Aug 2018 09:33:37 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-109-gd09d19f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via d09d19fa9fe1e81dd819b32208b4bd09f83e3918 (commit) from a6e5c8bf18696007c48c6f362aa355020fe82f21 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d09d19fa9fe1e81dd819b32208b4bd09f83e3918 Author: Andre Heinecke Date: Mon Aug 6 09:30:47 2018 +0200 Make GNUPGHOME for tests overridable * lang/python/tests/Makefile.am, lang/qt/tests/Makefile.am, tests/Makefile.am, tests/gpg/Makefile.am, tests/gpgsm/Makefile.am, tests/opassuan/Makefile.am (GNUPGHOME): Make variable explict. -- If the build directory has too long path, gpgme could fail. This is similar to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206 In order to fix that, this patch extracts the GNUPGHOME variable to be presented directly in the Makefile and thus overridable by command line option. A build system can then create a symlink to the GNUPGHOME directory in /tmp and use that symlink as the GNUPGHOME directory thus making the path very short. GnuPG-Bug-Id: T4091 Patch provided by vlmarek diff --git a/lang/python/tests/Makefile.am b/lang/python/tests/Makefile.am index 3864f8b..6297076 100644 --- a/lang/python/tests/Makefile.am +++ b/lang/python/tests/Makefile.am @@ -21,7 +21,8 @@ GPG_AGENT = gpg-agent test_srcdir = $(top_srcdir)/tests/gpg -TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) \ +GNUPGHOME=$(abs_builddir) \ +TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) \ LC_ALL=C GPG_AGENT_INFO= \ top_srcdir=$(top_srcdir) \ srcdir=$(srcdir) \ diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am index 104672e..bfe77ad 100644 --- a/lang/qt/tests/Makefile.am +++ b/lang/qt/tests/Makefile.am @@ -21,7 +21,8 @@ GPG = gpg -TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) +GNUPGHOME=$(abs_builddir) +TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) EXTRA_DIST = initial.test diff --git a/tests/Makefile.am b/tests/Makefile.am index 30c35f0..b5825d2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,7 +19,8 @@ ## Process this file with automake to produce Makefile.in -TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) +GNUPGHOME=$(abs_builddir) +TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) TESTS = t-version t-data t-engine-info diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index b50f4b0..392fc89 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -22,7 +22,8 @@ GPG = gpg GPG_AGENT = gpg-agent -TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO= \ +GNUPGHOME=$(abs_builddir) +TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) LC_ALL=C GPG_AGENT_INFO= \ top_srcdir=$(top_srcdir) # The keylist tests must come after the import and the edit test. diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am index d2acd05..c259920 100644 --- a/tests/gpgsm/Makefile.am +++ b/tests/gpgsm/Makefile.am @@ -22,7 +22,8 @@ GPGSM = gpgsm GPG_AGENT = gpg-agent -TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO= \ +GNUPGHOME=$(abs_builddir) +TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) LC_ALL=C GPG_AGENT_INFO= \ top_srcdir=$(top_srcdir) noinst_HEADERS = t-support.h diff --git a/tests/opassuan/Makefile.am b/tests/opassuan/Makefile.am index 31d26ed..1dba3e8 100644 --- a/tests/opassuan/Makefile.am +++ b/tests/opassuan/Makefile.am @@ -17,7 +17,8 @@ ## Process this file with automake to produce Makefile.in -TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= +GNUPGHOME=$(abs_builddir) +TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) GPG_AGENT_INFO= noinst_HEADERS = TESTS = ----------------------------------------------------------------------- Summary of changes: lang/python/tests/Makefile.am | 3 ++- lang/qt/tests/Makefile.am | 3 ++- tests/Makefile.am | 3 ++- tests/gpg/Makefile.am | 3 ++- tests/gpgsm/Makefile.am | 3 ++- tests/opassuan/Makefile.am | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 7 08:51:51 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 07 Aug 2018 08:51:51 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-133-g447ac6a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 447ac6af60381cf2077c5123db517dd5fa8ba8b0 (commit) via b87948f3919b9dd3e113e0de67d9d4a38db52bc8 (commit) via c9a83a240024f98d48ebe57a551a33c16fffa81d (commit) via 90077bd9775911edb45b77931f7284a5345aa537 (commit) via 9cba0288fbd4a7a3a1e20927703f877c8efe0935 (commit) from e4f0d5ca1ae0c27b4e52839c8ec6fd9d5cdda8e8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 447ac6af60381cf2077c5123db517dd5fa8ba8b0 Merge: b87948f 90077bd Author: Andre Heinecke Date: Tue Aug 7 08:51:27 2018 +0200 Merge remote-tracking branch 'dutch-l10n/dutch' commit b87948f3919b9dd3e113e0de67d9d4a38db52bc8 Author: Andre Heinecke Date: Tue Aug 7 08:50:13 2018 +0200 po: Update pt translation * po/pt.po: Update -- Provided again by Marco. Thanks. diff --git a/po/pt.po b/po/pt.po index e67744a..f39dcfb 100644 --- a/po/pt.po +++ b/po/pt.po @@ -9,42 +9,40 @@ msgstr "" "Project-Id-Version: GpgOL 1.1.1\n" "Report-Msgid-Bugs-To: bug-gpgol at g10code.com\n" "POT-Creation-Date: 2018-07-24 08:32+0200\n" -"PO-Revision-Date: 2018-06-12 14:14+0100\n" -"Last-Translator: aheinecke \n" -"Language-Team: Portuguese \n" +"PO-Revision-Date: 2018-07-27 10:44+0100\n" +"Last-Translator: Marco A.G.Pinto \n" +"Language-Team: Portuguese \n" "Language: pt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-SourceCharset: UTF-8\n" -"X-Generator: Lokalize 2.0\n" +"X-Generator: Poedit 2.1.1\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: src/addin-options.cpp:39 msgid "GnuPG System" -msgstr "" +msgstr "Sistema GnuPG" #: src/addin-options.cpp:40 msgid "Enable the S/MIME support" msgstr "Ativar o suporte S/MIME" #: src/addin-options.cpp:41 src/addin-options.cpp:147 -#, fuzzy msgid "Configure GpgOL" -msgstr "Configurar o GnuPG" +msgstr "Configurar o GpgOL" #: src/addin-options.cpp:42 msgid "Automation" -msgstr "" +msgstr "Automa??o" #: src/addin-options.cpp:43 msgid "General" msgstr "Geral" #: src/addin-options.cpp:45 -#, fuzzy msgid "Automatically secure &messages" -msgstr "Mensagem insegura" +msgstr "Proteger automaticamente as &mensagens" #: src/addin-options.cpp:46 msgid "Configure GnuPG" @@ -77,49 +75,56 @@ msgstr "Enviar e-mails OpenPGP sem anexos como PGP/Inline" #: src/addin-options.cpp:54 msgid "S&elect crypto settings automatically for reply and forward" msgstr "" -"Selecionar as defini??es de criptografia automaticamente para responder e " -"encaminhar." +"S&elecionar as defini??es de criptografia automaticamente para responder e " +"encaminhar" #: src/addin-options.cpp:56 msgid "&Prefer S/MIME when automatically resolving recipients" -msgstr "" +msgstr "&Preferir S/MIME ao resolver os destinat?rios automaticamente" #: src/addin-options.cpp:59 msgid "Enable or disable any automated key handling." -msgstr "" +msgstr "Ativar ou desativar qualquer manipula??o automatizada de chaves." #: src/addin-options.cpp:60 msgid "Automate trust based on communication history." -msgstr "" +msgstr "Automatizar a confian?a com base no hist?rico de comunica??o." #: src/addin-options.cpp:61 msgid "" "This changes the trust model to \"tofu+pgp\" which tracks the history of key " "usage. Automated trust can never exceed level 2." msgstr "" +"Isto altera o modelo de confian?a para \"tofu+pgp\" que rastreia o hist?rico " +"do uso de chaves. A confian?a automatizada nunca pode exceder o n?vel " +"2." #: src/addin-options.cpp:62 msgid "experimental" -msgstr "" +msgstr "experimental" #: src/addin-options.cpp:63 msgid "" "Automatically toggles secure if keys with at least level 1 trust were found " "for all recipients." msgstr "" +"Alterna automaticamente a seguran?a se chaves com confian?a m?nima de n?vel " +"1 foram encontradas para todos os destinat?rios." #: src/addin-options.cpp:64 msgid "Toggles the encrypt option for all new mails." -msgstr "" +msgstr "Alterna a op??o de encripta??o para todos os e-mails novos." #: src/addin-options.cpp:65 msgid "Toggles the sign option for all new mails." -msgstr "" +msgstr "Alterna a op??o de assinatura para todos os e-mails novos." #: src/addin-options.cpp:66 msgid "" "Toggles sign, encrypt options if the original mail was signed or encrypted." msgstr "" +"Alterna as op??es de assinar e encriptar se o e-mail original foi assinado " +"ou encriptado." #: src/addin-options.cpp:67 msgid "" @@ -127,11 +132,14 @@ msgid "" "encoding, the deprecated PGP/Inline is used.\n" "This can be required for compatibility but should generally not be used." msgstr "" +"Em vez de usar o formato PGP/MIME, que manipula corretamente os anexos e a " +"codifica??o, o PGP/Inline obsoleto ? usado.\n" +"Isto pode ser necess?rio para compatibilidade, mas geralmente n?o deve ser " +"usado." #: src/common.cpp:768 -#, fuzzy msgid "GpgOL Error" -msgstr "GpgOL" +msgstr "Erro GpgOL" #: src/gpgoladdin.cpp:515 src/mail.cpp:2065 src/mail.cpp:2136 msgid "GpgOL: Encrypted Message" @@ -244,13 +252,13 @@ msgid "GpgOL Warning" msgstr "Aviso do GpgOL" #: src/mail.cpp:904 -#, fuzzy, c-format +#, c-format msgid "" "Crypto operation failed:\n" "%s" msgstr "" -"A desencripta??o falhou\n" -"(%s)" +"A opera??o criptogr?fica falhou:\n" +"%s" #: src/mail.cpp:1006 msgid "Pubkey directory confirmation" @@ -267,13 +275,12 @@ msgstr "" "Este ? um pedido de confirma??o para publicares a tua Pubkey na diretoria " "para o teu dom?nio.\n" "\n" -"

Se n?o pediste para publicar a tua Pubkey na diretoria do teu provedor, " +"

Se n?o solicitaste publicar a tua Pubkey na diretoria do teu provedor, " "simplesmente ignora esta mensagem.

\n" #: src/mail.cpp:1015 -#, fuzzy msgid "message" -msgstr "Mensagem assinada" +msgstr "mensagem" #: src/mail.cpp:1016 msgid "Please wait while the message is being decrypted / verified..." @@ -390,7 +397,7 @@ msgstr "A encripta??o n?o est? em conformidade com VS-NfD." #: src/mail.cpp:2427 msgid "You cannot be sure who sent the message because it is not signed." msgstr "" -"N?o podes ter certeza de quem enviou a mensagem, porque n?o est? assinada." +"N?o podes ter a certeza de quem enviou a mensagem, porque n?o est? assinada." #: src/mail.cpp:2450 msgid "You signed this message." @@ -420,7 +427,7 @@ msgstr "" #: src/mail.cpp:2484 msgid "The mail provider of the recipient served this key." -msgstr "" +msgstr "O provedor de e-mail do destinat?rio forneceu esta chave." #: src/mail.cpp:2489 msgid "Some trusted people have certified the senders identity." @@ -601,8 +608,8 @@ msgid "" "For example by right clicking but not selecting the message.\n" msgstr "" "O GpgOL impediu a altera??o para a propriedade \"%s\".\n" -"As altera??es de propriedade n?o s?o ainda manipuladas para mensagens de " -"criptografia.\n" +"As altera??es de propriedade n?o s?o ainda manipuladas para mensagens " +"criptogr?ficas.\n" "\n" "Para contornar esta limita??o, por favor altera a propriedade quando a " "mensagem n?o est? aberta em qualquer janela e n?o est? selecionada na lista " @@ -643,6 +650,9 @@ msgid "" "They can't be permanently removed and will be shown again the next time this " "message is opened." msgstr "" +"Os anexos fazem parte da mensagem criptogr?fica.\n" +"N?o podem ser removidos permanentemente e ser?o mostrados novamente na " +"pr?xima vez que esta mensagem for aberta." #: src/mapihelp.cpp:1927 src/mapihelp.cpp:1935 src/mapihelp.cpp:1943 msgid "[no subject]" @@ -654,7 +664,7 @@ msgstr "Chave Desconhecida:" #: src/parsecontroller.cpp:182 msgid "Decryption canceled or timed out." -msgstr "Desencripta??o cancelada ou o tempo esgotou." +msgstr "Desencripta??o cancelada ou o tempo expirou." #: src/parsecontroller.cpp:196 msgid "" @@ -670,7 +680,7 @@ msgstr "N?o foi poss?vel desencriptar os dados: " #: src/parsecontroller.cpp:206 msgid "Failed to parse the mail." -msgstr "Falha ao analisar o e-mail." +msgstr "Falha ao interpretar o e-mail." #: src/parsecontroller.cpp:210 msgid "" @@ -704,15 +714,16 @@ msgid "" "or if someone faked the sender address." msgstr "" "A mensagem n?o foi assinada criptograficamente.\n" -"N?o h? nenhuma informa??o adicional dispon?vel se ela realmente foi enviada " +"N?o h? nenhuma informa??o adicional dispon?vel se ela foi realmente enviada " "por '%s' ou se algu?m falsificou o endere?o do remetente." #: src/ribbon-callbacks.cpp:665 -#, fuzzy msgid "" "There was an error verifying the signature.\n" "Full details:\n" -msgstr "Houve um erro ao verificar a assinatura.\n" +msgstr "" +"Houve um erro ao verificar a assinatura.\n" +"Detalhes completos:\n" #: src/ribbon-callbacks.cpp:718 msgid "" @@ -723,7 +734,7 @@ msgstr "" "Por favor, reinstala o Gpg4win com o componente Kleopatra ativado." #: src/wks-helper.cpp:410 -#, fuzzy, c-format +#, c-format msgid "" "A Pubkey directory is available for the address:\n" "\n" @@ -736,7 +747,9 @@ msgid "" "\n" "Register automatically?" msgstr "" -"Uma diretoria de Pubkey est? dispon?vel para o teu dom?nio.\n" +"Uma diretoria de Pubkey est? dispon?vel para o endere?o:\n" +"\n" +"\t%s\n" "\n" "Regista a tua Pubkey nessa diretoria para facilitar\n" "que outras pessoas te enviem e-mails encriptados.\n" @@ -779,16 +792,15 @@ msgstr "GpgOL: Confirma??o falhou" #: src/wks-helper.cpp:775 msgid "Your Pubkey can soon be retrieved from your domain." -msgstr "A tua Pubkey pode ser brevemente recuperada do teu dom?nio." +msgstr "A tua Pubkey pode ser brevemente extra?da do teu dom?nio." #: src/wks-helper.cpp:776 msgid "GpgOL: Request confirmed!" msgstr "GpgOL: Pedido confirmado!" #: src/cryptcontroller.cpp:307 -#, fuzzy msgid "No recipients for encryption selected." -msgstr "N?o foram selecionados destinat?rios para a encripta??o" +msgstr "N?o foram selecionados destinat?rios para a encripta??o." #: src/cryptcontroller.cpp:443 msgid "Resolving recipients..." commit c9a83a240024f98d48ebe57a551a33c16fffa81d Author: Andre Heinecke Date: Mon Aug 6 10:47:24 2018 +0200 Make send_message_to_ui_thread private * src/windowmessages.cpp, src/windowmessages.h (send_msg_to_ui_thread): Make it static -- Helps reviewing code to check if the wm_ctx_t is always valid. diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index 7c35484..bf252a0 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -262,7 +262,7 @@ create_responder_window () return g_responder_window; } -int +static int send_msg_to_ui_thread (wm_ctx_t *ctx) { size_t cls_name_len = strlen(RESPONDER_CLASS_NAME) + 1; diff --git a/src/windowmessages.h b/src/windowmessages.h index 175bb52..1730a25 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -70,11 +70,6 @@ typedef struct HWND create_responder_window (); -/** Send a message to the UI thread through the responder Window. - Returns 0 on success. */ -int -send_msg_to_ui_thread (wm_ctx_t *ctx); - /** Uses send_msg_to_ui_thread to execute the request in the ui thread. Returns the result. */ int commit 90077bd9775911edb45b77931f7284a5345aa537 Author: Erwin Bronkhorst Date: Wed Jun 27 22:13:05 2018 +0200 Update Dutch translation diff --git a/po/nl.po b/po/nl.po index 121304a..3b48856 100644 --- a/po/nl.po +++ b/po/nl.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: GpgOL 2.1.1\n" "Report-Msgid-Bugs-To: bug-gpgol at g10code.com\n" -"POT-Creation-Date: 2018-07-24 08:32+0200\n" -"PO-Revision-Date: 2018-06-12 21:28+0200\n" +"POT-Creation-Date: 2018-07-30 23:37+0200\n" +"PO-Revision-Date: 2018-07-30 23:57+0200\n" "Last-Translator: Erwin Bronkhorst \n" "Language-Team: \n" "Language: nl\n" @@ -20,29 +20,27 @@ msgstr "" #: src/addin-options.cpp:39 msgid "GnuPG System" -msgstr "" +msgstr "GnuPG-systeem" #: src/addin-options.cpp:40 msgid "Enable the S/MIME support" msgstr "S/MIME-ondersteuning inschakelen" -#: src/addin-options.cpp:41 src/addin-options.cpp:147 -#, fuzzy +#: src/addin-options.cpp:41 src/addin-options.cpp:148 msgid "Configure GpgOL" msgstr "GnuPG configureren" #: src/addin-options.cpp:42 msgid "Automation" -msgstr "" +msgstr "Automatisering" #: src/addin-options.cpp:43 msgid "General" msgstr "Algemeen" #: src/addin-options.cpp:45 -#, fuzzy msgid "Automatically secure &messages" -msgstr "Onveilig bericht" +msgstr "Berichten automatisch beveiligen" #: src/addin-options.cpp:46 msgid "Configure GnuPG" @@ -80,44 +78,51 @@ msgstr "" #: src/addin-options.cpp:56 msgid "&Prefer S/MIME when automatically resolving recipients" -msgstr "" +msgstr "Voorkeur geven aan S/MIME bij het opzoeken van ontvangers" #: src/addin-options.cpp:59 msgid "Enable or disable any automated key handling." -msgstr "" +msgstr "In- of uitschakelenv van automatische sleutel-afhandeling." #: src/addin-options.cpp:60 msgid "Automate trust based on communication history." -msgstr "" +msgstr "Vertrouwen automatisch baseren op communicatiegeschiedenis" #: src/addin-options.cpp:61 msgid "" "This changes the trust model to \"tofu+pgp\" which tracks the history of key " "usage. Automated trust can never exceed level 2." msgstr "" +"Dit verandert het vertrouwensmodel naar \"tofu+pgp\", dat de geschiedenis " +"van sleutelgebruik bijhoudt. Geautomatiseerd vertrouwen kan nooit " +"niveau 2 overschrijden." #: src/addin-options.cpp:62 msgid "experimental" -msgstr "" +msgstr "experimenteel" #: src/addin-options.cpp:63 msgid "" "Automatically toggles secure if keys with at least level 1 trust were found " "for all recipients." msgstr "" +"Automatisch beveiligen als sleutels met ten minste vertrouwensniveau 1 zijn " +"gevonden voor alle ontvangers." #: src/addin-options.cpp:64 msgid "Toggles the encrypt option for all new mails." -msgstr "" +msgstr "Verandert de versleutelings-optie voor alle nieuwe e-mailberichten." #: src/addin-options.cpp:65 msgid "Toggles the sign option for all new mails." -msgstr "" +msgstr "Verandert de ondertekenings-optie voor alle nieuwe e-mailberichten." #: src/addin-options.cpp:66 msgid "" "Toggles sign, encrypt options if the original mail was signed or encrypted." msgstr "" +"Verandert de ondertekenings- en versleutelings-opties als het originele e-" +"mailbericht ondertekend of versleuteld is." #: src/addin-options.cpp:67 msgid "" @@ -125,6 +130,10 @@ msgid "" "encoding, the deprecated PGP/Inline is used.\n" "This can be required for compatibility but should generally not be used." msgstr "" +"In plaats van het PGP/MIME-formaat, wat bijlages en encodering correct " +"afhandelt, wordt het verouderde PGP/Inline gebruikt.\n" +"Dit kan nodig zijn voor compatibiliteit, maar zou in het algemeen niet meer " +"gebruikt moeten worden." #: src/common.cpp:768 msgid "GpgOL Error" @@ -417,7 +426,7 @@ msgstr "" #: src/mail.cpp:2484 msgid "The mail provider of the recipient served this key." -msgstr "" +msgstr "De e-mailprovider van de ontvanger heeft deze sleutel aangeboden." #: src/mail.cpp:2489 msgid "Some trusted people have certified the senders identity." @@ -729,7 +738,7 @@ msgstr "" "Installeer Gpg4win opnieuw met het Kleopatra-component ingeschakeld." #: src/wks-helper.cpp:410 -#, fuzzy, c-format +#, c-format msgid "" "A Pubkey directory is available for the address:\n" "\n" @@ -742,7 +751,9 @@ msgid "" "\n" "Register automatically?" msgstr "" -"Er is een map voor publieke sleutels beschikbaar op uw domein.\n" +"Er is een map voor publieke sleutels beschikbaar voor het adres:\n" +"\n" +"\t%s\n" "\n" "Registreer uw publieke sleutel in die map om het makkelijk\n" "te maken voor anderen om u versleutelde e-mail te sturen.\n" commit 9cba0288fbd4a7a3a1e20927703f877c8efe0935 Author: Andre Heinecke Date: Tue Jul 24 14:09:10 2018 +0200 malloc -> xmalloc * src/w32-gettext.cpp (bindtextdomain): Change a spurious malloc to xmalloc. -- Fixes a memdbg error. diff --git a/src/w32-gettext.cpp b/src/w32-gettext.cpp index edad1fd..ab762b2 100644 --- a/src/w32-gettext.cpp +++ b/src/w32-gettext.cpp @@ -1666,7 +1666,7 @@ bindtextdomain (const char *domainname, const char *dirname) { char *p; - catval = (char *)malloc (strlen (catval_full) + 1); + catval = (char *)xmalloc (strlen (catval_full) + 1); if (catval) { strcpy (catval, catval_full); ----------------------------------------------------------------------- Summary of changes: po/nl.po | 45 ++++++++++++++---------- po/pt.po | 92 ++++++++++++++++++++++++++++---------------------- src/w32-gettext.cpp | 2 +- src/windowmessages.cpp | 2 +- src/windowmessages.h | 5 --- 5 files changed, 82 insertions(+), 64 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 8 09:25:23 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 08 Aug 2018 09:25:23 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-110-g3b78244 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 3b782443600e8091c5f19580cb218100bcbb4ad7 (commit) from d09d19fa9fe1e81dd819b32208b4bd09f83e3918 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3b782443600e8091c5f19580cb218100bcbb4ad7 Author: Andre Heinecke Date: Wed Aug 8 09:22:46 2018 +0200 cpp: Fix use after free in gencardkeyinteractor * lang/cpp/src/gpggencardkeyinteractor.cpp (GpgGenCardKeyInteractor::Private::keysize): Change to string. -- The value is only required as string so we can save it this way to avoid the need to convert it for the action command. GnuPG-Bug-Id: T4094 diff --git a/lang/cpp/src/gpggencardkeyinteractor.cpp b/lang/cpp/src/gpggencardkeyinteractor.cpp index 6f42e47..0ed6781 100644 --- a/lang/cpp/src/gpggencardkeyinteractor.cpp +++ b/lang/cpp/src/gpggencardkeyinteractor.cpp @@ -36,12 +36,11 @@ using namespace GpgME; class GpgGenCardKeyInteractor::Private { public: - Private() : keysize(2048), backup(false) + Private() : keysize("2048"), backup(false) { } - std::string name, email, backupFileName, expiry, serial; - int keysize; + std::string name, email, backupFileName, expiry, serial, keysize; bool backup; }; @@ -70,7 +69,7 @@ void GpgGenCardKeyInteractor::setDoBackup(bool value) void GpgGenCardKeyInteractor::setKeySize(int value) { - d->keysize = value; + d->keysize = std::to_string(value); } void GpgGenCardKeyInteractor::setExpiry(const std::string &timeStr) @@ -132,7 +131,7 @@ const char *GpgGenCardKeyInteractor::action(Error &err) const case SIZE: case SIZE2: case SIZE3: - return std::to_string(d->keysize).c_str(); + return d->keysize.c_str(); case COMMENT: return ""; case SAVE: ----------------------------------------------------------------------- Summary of changes: lang/cpp/src/gpggencardkeyinteractor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 8 09:51:30 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 08 Aug 2018 09:51:30 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-111-g6e48bb0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 6e48bb0f1cbf662026bf0f70549b52bafe00c017 (commit) from 3b782443600e8091c5f19580cb218100bcbb4ad7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6e48bb0f1cbf662026bf0f70549b52bafe00c017 Author: Andre Heinecke Date: Wed Aug 8 09:49:51 2018 +0200 json: Don't error out if chunksize is omitted * src/gpgme-json.c (encode_and_chunk): Don't error out if no chunksize is provided. -- This fixes 82e4b900a96c837392259469a9a5821a95e7a707 which caused every call without chunksize to error out. diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 81b70aa..9cae944 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -1491,10 +1491,7 @@ encode_and_chunk (cjson_t request, cjson_t response) } if (!chunksize) - { - err = GPG_ERR_INV_VALUE; - goto leave; - } + goto leave; pending_data.buffer = data; /* Data should already be encoded so that it does not ----------------------------------------------------------------------- Summary of changes: src/gpgme-json.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 8 13:37:30 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 08 Aug 2018 13:37:30 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-112-g974a95d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 974a95db04f9cdea02867f0246445b4679517ba0 (commit) from 6e48bb0f1cbf662026bf0f70549b52bafe00c017 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 974a95db04f9cdea02867f0246445b4679517ba0 Author: Andre Heinecke Date: Wed Aug 8 13:30:01 2018 +0200 json: Add checks when skipping byte * src/cJSON.c (parse_string, cJSON_Minify): Check for terminating NULL byte when skipping the byte after a an escaped quote. diff --git a/src/cJSON.c b/src/cJSON.c index 65d105b..eea1adf 100644 --- a/src/cJSON.c +++ b/src/cJSON.c @@ -249,7 +249,7 @@ parse_string (cJSON * item, const char *str, const char **ep) } /* not a string! */ while (*ptr != '\"' && *ptr && ++len) - if (*ptr++ == '\\') + if (*ptr++ == '\\' && *ptr) ptr++; /* Skip escaped quotes. */ out = xtrymalloc (len + 2); /* This is how long we need for the @@ -268,6 +268,8 @@ parse_string (cJSON * item, const char *str, const char **ep) else { ptr++; + if (!*ptr) + break; switch (*ptr) { case 'b': @@ -1416,9 +1418,11 @@ cJSON_Minify (char *json) { if (*json == '\\') *into++ = *json++; - *into++ = *json++; + if (*json) + *into++ = *json++; } - *into++ = *json++; + if (*json) + *into++ = *json++; } /* String literals, which are \" sensitive. */ else *into++ = *json++; /* All other characters. */ ----------------------------------------------------------------------- Summary of changes: src/cJSON.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 8 14:28:55 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 08 Aug 2018 14:28:55 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-114-g4dd1d0a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 4dd1d0abd34a382d1cd67cabb737950a39cb3fdc (commit) via fdc07b3ddc2f68e6fcb33703ea41126d0a841290 (commit) from 974a95db04f9cdea02867f0246445b4679517ba0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4dd1d0abd34a382d1cd67cabb737950a39cb3fdc Author: Andre Heinecke Date: Wed Aug 8 14:27:24 2018 +0200 json: Wipe memory in cJSON_Delete * src/cJSON.c (cJSON_Delete): Wipe memory on deletion. diff --git a/src/cJSON.c b/src/cJSON.c index 4da03cc..9e53012 100644 --- a/src/cJSON.c +++ b/src/cJSON.c @@ -123,9 +123,15 @@ cJSON_Delete (cJSON * c) if (!(c->type & cJSON_IsReference) && c->child) cJSON_Delete (c->child); if (!(c->type & cJSON_IsReference) && c->valuestring) - xfree (c->valuestring); + { + wipememory (c->valuestring, strlen (c->valuestring)); + xfree (c->valuestring); + } if (c->string) - xfree (c->string); + { + wipememory (c->string, strlen (c->string)); + xfree (c->string); + } xfree (c); c = next; } commit fdc07b3ddc2f68e6fcb33703ea41126d0a841290 Author: Andre Heinecke Date: Wed Aug 8 14:25:28 2018 +0200 json: Only use calloc instead of malloc * src/cJSON.c, src/gpgme-json.c (CALLOC_ONLY): New define to change xmalloc / xtrymalloc to use calloc. -- Some people consider malloc dangerous as it might allow an information leak. diff --git a/src/cJSON.c b/src/cJSON.c index eea1adf..4da03cc 100644 --- a/src/cJSON.c +++ b/src/cJSON.c @@ -45,20 +45,42 @@ #include #include +#include + #include "cJSON.h" +/* Only use calloc. */ +#define CALLOC_ONLY 1 + +/* To avoid that a compiler optimizes certain memset calls away, these + macros may be used instead. */ +#define wipememory2(_ptr,_set,_len) do { \ + volatile char *_vptr=(volatile char *)(_ptr); \ + size_t _vlen=(_len); \ + while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \ + } while(0) +#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) + /* We use malloc function wrappers from gpgrt (aka libgpg-error). */ #if GPGRT_VERSION_NUMBER >= 0x011c00 /* 1.28 */ # include -# define xtrymalloc(a) gpgrt_malloc ((a)) # define xtrycalloc(a,b) gpgrt_calloc ((a), (b)) # define xtrystrdup(a) gpgrt_strdup ((a)) # define xfree(a) gpgrt_free ((a)) +# if CALLOC_ONLY +# define xtrymalloc(a) gpgrt_calloc (1, (a)) +# else +# define xtrymalloc(a) gpgrt_malloc ((a)) +# endif #else /* Without gpgrt (aka libgpg-error). */ -# define xtrymalloc(a) malloc ((a)) # define xtrycalloc(a,b) calloc ((a), (b)) # define xtrystrdup(a) strdup ((a)) # define xfree(a) free ((a)) +# if CALLOC_ONLY +# define xtrymalloc(a) calloc (1, (a)) +# else +# define xtrymalloc(a) malloc ((a)) +# endif #endif diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 9cae944..5a9b9cf 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -87,13 +87,7 @@ static struct * Helper functions and macros */ -#define xtrymalloc(a) gpgrt_malloc ((a)) #define xtrystrdup(a) gpgrt_strdup ((a)) -#define xmalloc(a) ({ \ - void *_r = gpgrt_malloc ((a)); \ - if (!_r) \ - xoutofcore ("malloc"); \ - _r; }) #define xcalloc(a,b) ({ \ void *_r = gpgrt_calloc ((a), (b)); \ if (!_r) \ @@ -111,6 +105,21 @@ static struct _r; }) #define xfree(a) gpgrt_free ((a)) +/* Only use calloc. */ +#define CALLOC_ONLY 1 + +#if CALLOC_ONLY +#define xtrymalloc(a) gpgrt_calloc (1, (a)) +#define xmalloc(a) xcalloc(1, (a)) +#else +#define xtrymalloc(a) gpgrt_malloc ((a)) +#define xmalloc(a) ({ \ + void *_r = gpgrt_malloc ((a)); \ + if (!_r) \ + xoutofcore ("malloc"); \ + _r; }) +#endif + #define spacep(p) (*(p) == ' ' || *(p) == '\t') #ifndef HAVE_STPCPY ----------------------------------------------------------------------- Summary of changes: src/cJSON.c | 36 ++++++++++++++++++++++++++++++++---- src/gpgme-json.c | 21 +++++++++++++++------ 2 files changed, 47 insertions(+), 10 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 9 14:13:19 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 09 Aug 2018 14:13:19 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-136-g29f3ba0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 29f3ba005571b7a145f18240598d9f87f2ba9bca (commit) via e8737eb59f765db9206518276c81e702cec83341 (commit) via b4da0f8ff07635e862bcf306722579ef3891022a (commit) from 447ac6af60381cf2077c5123db517dd5fa8ba8b0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 29f3ba005571b7a145f18240598d9f87f2ba9bca Author: Andre Heinecke Date: Thu Aug 9 14:11:58 2018 +0200 Add new function to check for preview pane * src/oomhelp.cpp, src/oomhelp.h (is_preview_pane_visible): New. * src//ribbon-callbacks.cpp (get_mail_from_control): Use it. -- This should hopefully work on all outlook versions. diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp index c6515d2..06fd72d 100644 --- a/src/oomhelp.cpp +++ b/src/oomhelp.cpp @@ -2373,3 +2373,37 @@ log_addins () activeAddins.c_str ()); return; } + +bool +is_preview_pane_visible (LPDISPATCH explorer) +{ + if (!explorer) + { + TRACEPOINT; + return false; + } + VARIANT var; + VariantInit (&var); + VARIANT argvars[1]; + DISPPARAMS args; + VariantInit (&argvars[0]); + argvars[0].vt = VT_INT; + argvars[0].intVal = 3; + args.cArgs = 1; + args.cNamedArgs = 0; + args.rgvarg = argvars; + + if (invoke_oom_method_with_parms (explorer, "IsPaneVisible", &var, &args)) + { + log_error ("%s:%s: Failed to check visibilty.", + SRCNAME, __func__); + return false; + } + + if (var.vt != VT_BOOL) + { + TRACEPOINT; + return false; + } + return !!var.boolVal; +} diff --git a/src/oomhelp.h b/src/oomhelp.h index 3a94579..ca7c1fd 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -376,4 +376,7 @@ HRESULT gpgol_queryInterface (LPUNKNOWN pObj, REFIID riid, LPVOID FAR *ppvObj); HRESULT gpgol_openProperty (LPMAPIPROP obj, ULONG ulPropTag, LPCIID lpiid, ULONG ulInterfaceOptions, ULONG ulFlags, LPUNKNOWN FAR * lppUnk); + +/* Check if the preview pane in the explorer is visible */ +bool is_preview_pane_visible (LPDISPATCH explorer); #endif /*OOMHELP_H*/ diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp index 3eda852..43ab432 100644 --- a/src/ribbon-callbacks.cpp +++ b/src/ribbon-callbacks.cpp @@ -387,7 +387,17 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected) /* Avoid showing wrong crypto state if we don't have a reading pane. In that case the parser will finish for a mail which is gone and the crypto state will not get updated. */ - if (0 /*g_ol_version_major >= 16 */) + + if (!is_preview_pane_visible (context)) + { + *none_selected = true; + gpgol_release (mailitem); + mailitem = nullptr; + log_debug ("%s:%s: Preview pane invisible", SRCNAME, __func__); + } + +#if 0 + if (g_ol_version_major >= 16) { /* Some Versions of Outlook 2016 crashed when accessing the current view of the Explorer. This was even reproducible with @@ -439,6 +449,7 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected) } } } +#endif if (!*none_selected) { commit e8737eb59f765db9206518276c81e702cec83341 Author: Andre Heinecke Date: Thu Aug 9 14:11:20 2018 +0200 Add ref in get_strong_reference * src/oomhelp.cpp (get_strong_reference): Mark add ref. diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp index 947ffce..c6515d2 100644 --- a/src/oomhelp.cpp +++ b/src/oomhelp.cpp @@ -1529,6 +1529,7 @@ get_strong_reference (LPDISPATCH mail) ret = var.pdispVal; log_oom ("%s:%s: Got strong ref %p for %p", SRCNAME, __func__, ret, mail); + memdbg_addRef (ret); } else { commit b4da0f8ff07635e862bcf306722579ef3891022a Author: Andre Heinecke Date: Thu Aug 9 14:10:39 2018 +0200 Use utf8 gettext in ribbon callbacks * src/ribbon-callbacks.cpp: Use utf8 gettext. -- The outlook ribbon UI uses utf8 diff --git a/src/pgpmime.c b/src/pgpmime.c deleted file mode 100644 index f0dedfd..0000000 --- a/src/pgpmime.c +++ /dev/null @@ -1,721 +0,0 @@ -/* pgpmime.c - Try to handle PGP/MIME for Outlook - * Copyright (C) 2005 g10 Code GmbH - * - * This file is part of Gpgol. - * - * GPGol is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * GPGol is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#error not used - -/* - EXPLAIN what we are doing here. -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#define COBJMACROS -#include -#include /* For IStream. */ - -#include - -#include "mymapi.h" -#include "mymapitags.h" -#include "rfc822parse.h" - -#include "common.h" -#include "pgpmime.h" -#include "engine.h" - - -/* The maximum length of a line we ar able to porcess. RFC822 alows - only for 1000 bytes; thus 2000 seems to be a reasonable value. */ -#define LINEBUFSIZE 2000 - - -/* The context object we use to track information. */ -struct pgpmime_context -{ - HWND hwnd; /* A window handle to be used for message boxes etc. */ - rfc822parse_t msg; /* The handle of the RFC822 parser. */ - - int preview; /* Do only decryption and pop up no message bozes. */ - - int verify_mode; /* True if we want to verify a PGP/MIME signature. */ - - int nesting_level; /* Current MIME nesting level. */ - int in_data; /* We are currently in data (body or attachment). */ - - gpgme_data_t signed_data;/* NULL or the data object used to collect - the signed data. It would bet better to - just hash it but there is no support in - gpgme for this yet. */ - gpgme_data_t sig_data; /* NULL or data object to collect the - signature attachment which should be a - signature then. */ - - gpgme_data_t body; /* NULL or a data object used to collect the - body part we are going to display later. */ - int collect_body; /* True if we are collecting the body lines. */ - int collect_attachment; /* True if we are collecting an attachment. */ - int collect_signeddata; /* True if we are collecting the signed data. */ - int collect_signature; /* True if we are collecting a signature. */ - int start_hashing; /* Flag used to start collecting signed data. */ - int hashing_level; /* MIME level where we started hashing. */ - int is_qp_encoded; /* Current part is QP encoded. */ - int is_base64_encoded; /* Current part is base 64 encoded. */ - int is_utf8; /* Current part has charset utf-8. */ - - int part_counter; /* Counts the number of processed parts. */ - char *filename; /* Current filename (malloced) or NULL. */ - - LPSTREAM outstream; /* NULL or a stream to write a part to. */ - - b64_state_t base64; /* The state of the BAse-64 decoder. */ - - int line_too_long; /* Indicates that a received line was too long. */ - int parser_error; /* Indicates that we encountered a error from - the parser. */ - - /* Buffer used to constructed complete files. */ - size_t linebufsize; /* The allocated size of the buffer. */ - size_t linebufpos; /* The actual write posituion. */ - char linebuf[1]; /* The buffer. */ -}; -typedef struct pgpmime_context *pgpmime_context_t; - - -/* This function is a wrapper around gpgme_data_write to convert the - data to utf-8 first. We assume Latin-1 here. */ -static int -latin1_data_write (gpgme_data_t data, const char *line, size_t len) -{ - const char *s; - char *buffer, *p; - size_t i, n; - int rc; - - for (s=line, i=0, n=0 ; i < len; s++, i++ ) - { - n++; - if (*s & 0x80) - n++; - } - buffer = xmalloc (n + 1); - for (s=line, i=0, p=buffer; i < len; s++, i++ ) - { - if (*s & 0x80) - { - *p++ = 0xc0 | ((*s >> 6) & 3); - *p++ = 0x80 | (*s & 0x3f); - } - else - *p++ = *s; - } - assert (p-buffer == n); - rc = gpgme_data_write (data, buffer, n); - xfree (buffer); - return rc; -} - - -/* Print the message event EVENT. */ -static void -debug_message_event (pgpmime_context_t ctx, rfc822parse_event_t event) -{ - const char *s; - - switch (event) - { - case RFC822PARSE_OPEN: s= "Open"; break; - case RFC822PARSE_CLOSE: s= "Close"; break; - case RFC822PARSE_CANCEL: s= "Cancel"; break; - case RFC822PARSE_T2BODY: s= "T2Body"; break; - case RFC822PARSE_FINISH: s= "Finish"; break; - case RFC822PARSE_RCVD_SEEN: s= "Rcvd_Seen"; break; - case RFC822PARSE_LEVEL_DOWN: s= "Level_Down"; break; - case RFC822PARSE_LEVEL_UP: s= "Level_Up"; break; - case RFC822PARSE_BOUNDARY: s= "Boundary"; break; - case RFC822PARSE_LAST_BOUNDARY: s= "Last_Boundary"; break; - case RFC822PARSE_BEGIN_HEADER: s= "Begin_Header"; break; - case RFC822PARSE_PREAMBLE: s= "Preamble"; break; - case RFC822PARSE_EPILOGUE: s= "Epilogue"; break; - default: s= "[unknown event]"; break; - } - log_debug ("%s: ctx=%p, rfc822 event %s\n", SRCNAME, ctx, s); -} - - - - -/* This routine gets called by the RFC822 parser for all kind of - events. OPAQUE carries in our case a pgpmime context. Should - return 0 on success or -1 and as well as seeting errno on - failure. */ -static int -message_cb (void *opaque, rfc822parse_event_t event, rfc822parse_t msg) -{ - pgpmime_context_t ctx = opaque; - HRESULT hr; - - debug_message_event (ctx, event); - - if (event == RFC822PARSE_BEGIN_HEADER || event == RFC822PARSE_T2BODY) - { - /* We need to check here whether to start collecting signed data - because attachments might come without header lines and thus - we won't see the BEGIN_HEADER event. */ - if (ctx->start_hashing == 1) - { - ctx->start_hashing = 2; - ctx->hashing_level = ctx->nesting_level; - ctx->collect_signeddata = 1; - gpgme_data_new (&ctx->signed_data); - } - } - - - if (event == RFC822PARSE_T2BODY) - { - rfc822parse_field_t field; - const char *s1, *s2, *s3; - size_t off; - char *p; - int is_text = 0; - - ctx->is_utf8 = 0; - field = rfc822parse_parse_field (msg, "Content-Type", -1); - if (field) - { - s1 = rfc822parse_query_media_type (field, &s2); - if (s1) - { - log_debug ("%s: ctx=%p, media `%s' `%s'\n", - SRCNAME, ctx, s1, s2); - - if (!strcmp (s1, "multipart")) - { - /* We don't care about the top level multipart layer - but wait until it comes to the actual parts which - then will get stored as attachments. - - For now encapsulated signed or encrypted - containers are not processed in a special way as - they should. Except for the simple verify - mode. */ - if (ctx->verify_mode && !ctx->signed_data - && !strcmp (s2,"signed") - && (s3 = rfc822parse_query_parameter (field, - "protocol", 0)) - && !strcmp (s3, "application/pgp-signature")) - { - /* Need to start the hashing after the next - boundary. */ - ctx->start_hashing = 1; - } - } - else if (!strcmp (s1, "text")) - { - is_text = 1; - } - else if (ctx->verify_mode - && ctx->nesting_level == 1 - && !ctx->sig_data - && !strcmp (s1, "application") - && !strcmp (s2, "pgp-signature")) - { - /* This is the second part of a PGP/MIME signature. - We only support here full messages thus checking - the nesting level is sufficient. We do this only - for the first signature (i.e. if sig_data has not - been set yet). We do this only while in verify - mode because we don't want to write a full MUA - (although this would be easier than to tame this - Outlook beast). */ - if (!ctx->preview && !gpgme_data_new (&ctx->sig_data)) - { - ctx->collect_signature = 1; - } - } - else /* Other type. */ - { - if (!ctx->preview) - ctx->collect_attachment = 1; - } - - } - - s1 = rfc822parse_query_parameter (field, "charset", 0); - if (s1 && !strcmp (s1, "utf-8")) - ctx->is_utf8 = 1; - - rfc822parse_release_field (field); - } - else - { - /* No content-type at all indicates text/plain. */ - is_text = 1; - } - ctx->in_data = 1; - - log_debug ("%s: this body: nesting=%d part_counter=%d is_text=%d\n", - SRCNAME, ctx->nesting_level, ctx->part_counter, is_text); - - /* Need to figure out the encoding. */ - ctx->is_qp_encoded = 0; - ctx->is_base64_encoded = 0; - p = rfc822parse_get_field (msg, "Content-Transfer-Encoding", -1, &off); - if (p) - { - if (!stricmp (p+off, "quoted-printable")) - ctx->is_qp_encoded = 1; - else if (!stricmp (p+off, "base64")) - { - ctx->is_base64_encoded = 1; - b64_init (&ctx->base64); - } - xfree (p); - } - - /* If this is a text part, decide whether we treat it as our body. */ - if (is_text) - { - /* If this is the first text part at all we will - start to collect it and use it later as the - regular body. An initialized ctx->BODY is an - indication that this is not the first text part - - we treat such a part like any other - attachment. */ - if (!ctx->body) - { - if (!gpgme_data_new (&ctx->body)) - ctx->collect_body = 1; - } - else if (!ctx->preview) - ctx->collect_attachment = 1; - } - - - if (ctx->collect_attachment) - { - /* Now that if we have an attachment prepare for writing it - out. */ - p = NULL; - field = rfc822parse_parse_field (msg, "Content-Disposition", -1); - if (field) - { - s1 = rfc822parse_query_parameter (field, "filename", 0); - if (s1) - p = xstrdup (s1); - rfc822parse_release_field (field); - } - if (!p) - { - p = xmalloc (50); - snprintf (p, 49, "unnamed-%d.dat", ctx->part_counter); - } - if (ctx->outstream) - { - IStream_Release (ctx->outstream); - ctx->outstream = NULL; - } - tryagain: - xfree (ctx->filename); - ctx->filename = ctx->preview? NULL:get_save_filename (ctx->hwnd, p); - if (!ctx->filename) - ctx->collect_attachment = 0; /* User does not want to save it. */ - else - { - hr = OpenStreamOnFile (MAPIAllocateBuffer, MAPIFreeBuffer, - (STGM_CREATE | STGM_READWRITE), - ctx->filename, NULL, &ctx->outstream); - if (FAILED (hr)) - { - log_error ("%s:%s: can't create file `%s': hr=%#lx\n", - SRCNAME, __func__, ctx->filename, hr); - MessageBox (ctx->hwnd, _("Error creating file\n" - "Please select another one"), - _("I/O-Error"), MB_ICONERROR|MB_OK); - goto tryagain; - } - log_debug ("%s:%s: writing attachment to `%s'\n", - SRCNAME, __func__, ctx->filename); - } - xfree (p); - } - } - else if (event == RFC822PARSE_LEVEL_DOWN) - { - ctx->nesting_level++; - } - else if (event == RFC822PARSE_LEVEL_UP) - { - if (ctx->nesting_level) - ctx->nesting_level--; - else - { - log_error ("%s: ctx=%p, invalid structure: bad nesting level\n", - SRCNAME, ctx); - ctx->parser_error = 1; - } - } - else if (event == RFC822PARSE_BOUNDARY || event == RFC822PARSE_LAST_BOUNDARY) - { - ctx->in_data = 0; - ctx->collect_body = 0; - ctx->collect_attachment = 0; - xfree (ctx->filename); - ctx->filename = NULL; - if (ctx->outstream) - { - IStream_Commit (ctx->outstream, 0); - IStream_Release (ctx->outstream); - ctx->outstream = NULL; - } - if (ctx->start_hashing == 2 && ctx->hashing_level == ctx->nesting_level) - { - ctx->start_hashing = 3; /* Avoid triggering it again. */ - ctx->collect_signeddata = 0; - } - } - else if (event == RFC822PARSE_BEGIN_HEADER) - { - ctx->part_counter++; - } - - return 0; -} - - -/* This handler is called by GPGME with the decrypted plaintext. */ -static ssize_t -plaintext_handler (void *handle, const void *buffer, size_t size) -{ - pgpmime_context_t ctx = handle; - const char *s; - size_t nleft, pos, len; - - s = buffer; - pos = ctx->linebufpos; - nleft = size; - for (; nleft ; nleft--, s++) - { - if (pos >= ctx->linebufsize) - { - log_error ("%s: ctx=%p, rfc822 parser failed: line too long\n", - SRCNAME, ctx); - ctx->line_too_long = 1; - return 0; /* Error. */ - } - if (*s != '\n') - ctx->linebuf[pos++] = *s; - else - { /* Got a complete line. Remove the last CR */ - if (pos && ctx->linebuf[pos-1] == '\r') - pos--; - - if (rfc822parse_insert (ctx->msg, ctx->linebuf, pos)) - { - log_error ("%s: ctx=%p, rfc822 parser failed: %s\n", - SRCNAME, ctx, strerror (errno)); - ctx->parser_error = 1; - return 0; /* Error. */ - } - - - if (ctx->collect_signeddata && ctx->signed_data) - { - /* Save the signed data. Note that we need to delay - the CR/LF because the last line ending belongs to the - next boundary. */ - if (ctx->collect_signeddata == 2) - gpgme_data_write (ctx->signed_data, "\r\n", 2); - gpgme_data_write (ctx->signed_data, ctx->linebuf, pos); - ctx->collect_signeddata = 2; - } - - if (ctx->in_data && ctx->collect_body && ctx->body) - { - /* We are inside the body of the message. Save it away - to a gpgme data object. Note that this is only - used for the first text part. */ - if (ctx->collect_body == 1) /* Need to skip the first line. */ - ctx->collect_body = 2; - else - { - if (ctx->is_qp_encoded) - len = qp_decode (ctx->linebuf, pos); - else if (ctx->is_base64_encoded) - len = b64_decode (&ctx->base64, ctx->linebuf, pos); - else - len = pos; - if (len) - { - if (ctx->is_utf8) - gpgme_data_write (ctx->body, ctx->linebuf, len); - else - latin1_data_write (ctx->body, ctx->linebuf, len); - } - if (!ctx->is_base64_encoded) - gpgme_data_write (ctx->body, "\r\n", 2); - } - } - else if (ctx->in_data && ctx->collect_attachment) - { - /* We are inside of an attachment part. Write it out. */ - if (ctx->collect_attachment == 1) /* Skip the first line. */ - ctx->collect_attachment = 2; - else if (ctx->outstream) - { - HRESULT hr = 0; - - if (ctx->is_qp_encoded) - len = qp_decode (ctx->linebuf, pos); - else if (ctx->is_base64_encoded) - len = b64_decode (&ctx->base64, ctx->linebuf, pos); - else - len = pos; - if (len) - hr = IStream_Write (ctx->outstream, ctx->linebuf, - len, NULL); - if (!hr && !ctx->is_base64_encoded) - hr = IStream_Write (ctx->outstream, "\r\n", 2, NULL); - if (hr) - { - log_debug ("%s:%s: Write failed: hr=%#lx", - SRCNAME, __func__, hr); - if (!ctx->preview) - MessageBox (ctx->hwnd, _("Error writing file"), - _("I/O-Error"), MB_ICONERROR|MB_OK); - ctx->parser_error = 1; - return 0; /* Error. */ - } - } - } - else if (ctx->in_data && ctx->collect_signature) - { - /* We are inside of a signature attachment part. */ - if (ctx->collect_signature == 1) /* Skip the first line. */ - ctx->collect_signature = 2; - else if (ctx->sig_data) - { - if (ctx->is_qp_encoded) - len = qp_decode (ctx->linebuf, pos); - else if (ctx->is_base64_encoded) - len = b64_decode (&ctx->base64, ctx->linebuf, pos); - else - len = pos; - if (len) - gpgme_data_write (ctx->sig_data, ctx->linebuf, len); - if (!ctx->is_base64_encoded) - gpgme_data_write (ctx->sig_data, "\r\n", 2); - } - } - - /* Continue with next line. */ - pos = 0; - } - } - ctx->linebufpos = pos; - - return size; -} - - -/* Decrypt the PGP/MIME INSTREAM (i.e the second part of the - multipart/mixed) and allow saving of all attachments. On success a - newly allocated body will be stored at BODY. If ATTESTATION is not - NULL a text with the result of the signature verification will get - printed to it. HWND is the window to be used for message box and - such. In PREVIEW_MODE no verification will be done, no messages - saved and no messages boxes will pop up. */ -int -pgpmime_decrypt (LPSTREAM instream, int ttl, char **body, - gpgme_data_t attestation, HWND hwnd, int preview_mode) -{ - gpg_error_t err; - struct gpgme_data_cbs cbs; - gpgme_data_t plaintext; - pgpmime_context_t ctx; - char *tmp; - - *body = NULL; - - memset (&cbs, 0, sizeof cbs); - cbs.write = plaintext_handler; - - ctx = xcalloc (1, sizeof *ctx + LINEBUFSIZE); - ctx->linebufsize = LINEBUFSIZE; - ctx->hwnd = hwnd; - ctx->preview = preview_mode; - - ctx->msg = rfc822parse_open (message_cb, ctx); - if (!ctx->msg) - { - err = gpg_error_from_errno (errno); - log_error ("failed to open the RFC822 parser: %s", strerror (errno)); - goto leave; - } - - err = gpgme_data_new_from_cbs (&plaintext, &cbs, ctx); - if (err) - goto leave; - - tmp = native_to_utf8 (_("[PGP/MIME message]")); - err = op_decrypt_stream_to_gpgme (GPGME_PROTOCOL_OpenPGP, - instream, plaintext, ttl, tmp, - attestation, preview_mode); - xfree (tmp); - if (!err && (ctx->parser_error || ctx->line_too_long)) - err = gpg_error (GPG_ERR_GENERAL); - - if (!err) - { - if (ctx->body) - { - /* Return the buffer but first make sure it is a string. */ - if (gpgme_data_write (ctx->body, "", 1) == 1) - { - *body = gpgme_data_release_and_get_mem (ctx->body, NULL); - ctx->body = NULL; - } - } - else - { - *body = native_to_utf8 (_("[PGP/MIME message " - "without plain text body]")); - } - } - - leave: - if (plaintext) - gpgme_data_release (plaintext); - if (ctx) - { - if (ctx->outstream) - { - IStream_Revert (ctx->outstream); - IStream_Release (ctx->outstream); - } - rfc822parse_close (ctx->msg); - if (ctx->body) - gpgme_data_release (ctx->body); - xfree (ctx->filename); - xfree (ctx); - } - return err; -} - - - -int -pgpmime_verify (const char *message, int ttl, char **body, - gpgme_data_t attestation, HWND hwnd, int preview_mode) -{ - gpg_error_t err = 0; - pgpmime_context_t ctx; - const char *s; - - *body = NULL; - - ctx = xcalloc (1, sizeof *ctx + LINEBUFSIZE); - ctx->linebufsize = LINEBUFSIZE; - ctx->hwnd = hwnd; - ctx->preview = preview_mode; - ctx->verify_mode = 1; - - ctx->msg = rfc822parse_open (message_cb, ctx); - if (!ctx->msg) - { - err = gpg_error_from_errno (errno); - log_error ("failed to open the RFC822 parser: %s", strerror (errno)); - goto leave; - } - - /* Need to pass the data line by line to the handler. */ - for (;(s = strchr (message, '\n')); message = s+1) - { - plaintext_handler (ctx, message, (s - message) + 1); - if (ctx->parser_error || ctx->line_too_long) - { - err = gpg_error (GPG_ERR_GENERAL); - break; - } - } - - /* Unless there is an error we should return the body. */ - if (!err) - { - if (ctx->body) - { - /* Return the buffer but first make sure it is a string. */ - if (gpgme_data_write (ctx->body, "", 1) == 1) - { - *body = gpgme_data_release_and_get_mem (ctx->body, NULL); - ctx->body = NULL; - } - } - else - { - *body = native_to_utf8 (_("[PGP/MIME signed message without a " - "plain text body]")); - } - } - - /* Now actually verify the signature. */ - if (!err && ctx->signed_data && ctx->sig_data) - { - char *tmp; - - gpgme_data_seek (ctx->signed_data, 0, SEEK_SET); - gpgme_data_seek (ctx->sig_data, 0, SEEK_SET); - tmp = native_to_utf8 (_("[PGP/MIME signature]")); - err = op_verify_detached_sig_gpgme (GPGME_PROTOCOL_OpenPGP, - ctx->signed_data, ctx->sig_data, - tmp, attestation); - xfree (tmp); - } - - - leave: - if (ctx) - { - if (ctx->outstream) - { - IStream_Revert (ctx->outstream); - IStream_Release (ctx->outstream); - } - rfc822parse_close (ctx->msg); - if (ctx->body) - gpgme_data_release (ctx->body); - if (ctx->signed_data) - gpgme_data_release (ctx->signed_data); - if (ctx->sig_data) - gpgme_data_release (ctx->sig_data); - xfree (ctx->filename); - xfree (ctx); - } - return err; -} diff --git a/src/pgpmime.h b/src/pgpmime.h deleted file mode 100644 index 5270368..0000000 --- a/src/pgpmime.h +++ /dev/null @@ -1,43 +0,0 @@ -/* pgpmime.h - PGP/MIME routines for Outlook - * Copyright (C) 2005 g10 Code GmbH - * - * This file is part of GPGol. - * - * GPGol is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * GPGol is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ -#ifndef PGPMIME_H -#define PGPMIME_H - -#error not used - -#ifdef __cplusplus -extern "C" { -#if 0 -} -#endif -#endif - -int pgpmime_decrypt (LPSTREAM instream, int ttl, char **body, - gpgme_data_t attestation, HWND hwnd, - int preview_mode); -int pgpmime_verify (const char *message, int ttl, char **body, - gpgme_data_t attestation, HWND hwnd, int preview_mode); - - -#ifdef __cplusplus -} -#endif -#endif /*PGPMIME_H*/ diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp index fa10c8c..3eda852 100644 --- a/src/ribbon-callbacks.cpp +++ b/src/ribbon-callbacks.cpp @@ -46,6 +46,9 @@ #include #include +#undef _ +#define _(a) utf8_gettext (a) + using namespace GpgME; /* This is so super stupid. I bet even Microsft developers laugh ----------------------------------------------------------------------- Summary of changes: src/oomhelp.cpp | 35 +++ src/oomhelp.h | 3 + src/pgpmime.c | 721 ----------------------------------------------- src/pgpmime.h | 43 --- src/ribbon-callbacks.cpp | 16 +- 5 files changed, 53 insertions(+), 765 deletions(-) delete mode 100644 src/pgpmime.c delete mode 100644 src/pgpmime.h hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 9 19:42:32 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Thu, 09 Aug 2018 19:42:32 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-115-gb6d2a66 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via b6d2a66b41fee5b7fb484566aefcdbcc4cdad094 (commit) from 4dd1d0abd34a382d1cd67cabb737950a39cb3fdc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b6d2a66b41fee5b7fb484566aefcdbcc4cdad094 Author: Ben McGinnes Date: Fri Aug 10 03:39:46 2018 +1000 Link fixes * lang/python/README: Fixed links in both versions of the README. diff --git a/lang/python/README b/lang/python/README index aadf980..a13345f 100644 --- a/lang/python/README +++ b/lang/python/README @@ -13,7 +13,7 @@ Table of Contents The "gpg" module is a python interface to the GPGME library: -[https://www.gnupg.org/software/gpgme/] + "gpg" offers two interfaces, one is a high-level, curated, and idiomatic interface that is implemented as a shim on top of the low-level @@ -27,16 +27,16 @@ functionality of the underlying library. ?????????????? For general discussion and help see the gnupg-users mailing list: - [https://lists.gnupg.org/mailman/listinfo/gnupg-users] + For development see the gnupg-devel mailing list: - [https://lists.gnupg.org/mailman/listinfo/gnupg-devel] + 2 Bugs ?????? - Please report bugs using our bug tracker [https://bugs.gnupg.org] with + Please report bugs using our bug tracker with tag (aka project) 'gpgme'. @@ -64,14 +64,14 @@ functionality of the underlying library. ? The bindings have been merged into the GPGME repository in 2016. ? The latest version of PyME for Python 3.2 and above (as of May, - 2015) is v0.9.1. [https://git.gnupg.org/gpgme.git/lang/py3-pyme] + 2015) is v0.9.1. ? The latest version of PyME for Python 2.6 and 2.7 (as of this - writing) is v0.9.0. [https://bitbucket.org/malb/pyme] + writing) is v0.9.0. ? A previous version of PyME v0.8.0 can be found on sourceforge: - [http://pyme.sourceforge.net/] + ? A previous version of PyME v0.5.1 which works with GPGME v0.3.15 can - be found on John Goerzen's PyME page: [http://quux.org/devel/pyme/] - [http://www.complete.org/JohnGoerzen] + be found on John Goerzen's PyME page: + diff --git a/lang/python/README.org b/lang/python/README.org index df6c63d..bd7047c 100644 --- a/lang/python/README.org +++ b/lang/python/README.org @@ -2,7 +2,7 @@ #+OPTIONS: author:nil The "gpg" module is a python interface to the GPGME library: -[[https://www.gnupg.org/software/gpgme/]] +[[https://www.gnupg.org/software/gpgme/][https://www.gnupg.org/software/gpgme/]] "gpg" offers two interfaces, one is a high-level, curated, and idiomatic interface that is implemented as a shim on top of the @@ -14,15 +14,15 @@ functionality of the underlying library. * Mailing List For general discussion and help see the gnupg-users mailing list: -https://lists.gnupg.org/mailman/listinfo/gnupg-users +[[https://lists.gnupg.org/mailman/listinfo/gnupg-users][gnupg-users]] For development see the gnupg-devel mailing list: -https://lists.gnupg.org/mailman/listinfo/gnupg-devel +[[https://lists.gnupg.org/mailman/listinfo/gnupg-devel][gnupg-devel]] * Bugs Please report bugs using our bug tracker -[[https://bugs.gnupg.org]] with tag (aka project) 'gpgme'. +[[https://bugs.gnupg.org][bugs.gnupg.org]] with tag (aka project) 'gpgme'. * Authors @@ -46,15 +46,15 @@ references to previous versions. - The latest version of PyME for Python 3.2 and above (as of May, 2015) is v0.9.1. - https://git.gnupg.org/gpgme.git/lang/py3-pyme + [[https://git.gnupg.org/gpgme.git/lang/py3-pyme][Python 3 PyME]] - The latest version of PyME for Python 2.6 and 2.7 (as of this - writing) is v0.9.0. https://bitbucket.org/malb/pyme + writing) is v0.9.0. [[https://bitbucket.org/malb/pyme][PyME 0.9.0]] - A previous version of PyME v0.8.0 can be found on sourceforge: - http://pyme.sourceforge.net/ + [[http://pyme.sourceforge.net/][PyME 0.8.0]] - A previous version of PyME v0.5.1 which works with GPGME v0.3.15 can be found on John Goerzen's PyME page: - http://quux.org/devel/pyme/ - http://www.complete.org/JohnGoerzen + [[http://quux.org/devel/pyme/][PyME 0.3.15]] + [[http://www.complete.org/JohnGoerzen][John Goerzen]] ----------------------------------------------------------------------- Summary of changes: lang/python/README | 18 +++++++++--------- lang/python/README.org | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 10 04:49:25 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Fri, 10 Aug 2018 04:49:25 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-116-g94bf13e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 94bf13e78e65e1d1bc2e5d6b2311f9c9657bfe5f (commit) from b6d2a66b41fee5b7fb484566aefcdbcc4cdad094 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 94bf13e78e65e1d1bc2e5d6b2311f9c9657bfe5f Author: Ben McGinnes Date: Fri Aug 10 11:25:01 2018 +1000 PEP8 compliance and other code fixes * Ran all the .py files in src/ and below through Yapf. * Included some manual edits of core.py, this time successfully making two notorious sections a bit more pythonic than scheming. * Left the module imports as is. * This will be committed if it passes the most essential test: compiling, installing and running it. Signed-off-by: Ben McGinnes diff --git a/lang/python/src/__init__.py b/lang/python/src/__init__.py index 385b17e..82c1cce 100644 --- a/lang/python/src/__init__.py +++ b/lang/python/src/__init__.py @@ -15,7 +15,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - """gpg: GnuPG Interface for Python (GPGME bindings) Welcome to gpg, the GnuPG Interface for Python. @@ -117,5 +116,7 @@ del gpgme _ = [Context, Data, core, errors, constants, util, callbacks, version] del _ -__all__ = ["Context", "Data", - "core", "errors", "constants", "util", "callbacks", "version"] +__all__ = [ + "Context", "Data", "core", "errors", "constants", "util", "callbacks", + "version" +] diff --git a/lang/python/src/callbacks.py b/lang/python/src/callbacks.py index b25a9a7..e8a9c43 100644 --- a/lang/python/src/callbacks.py +++ b/lang/python/src/callbacks.py @@ -20,6 +20,7 @@ del absolute_import, print_function, unicode_literals from getpass import getpass + def passphrase_stdin(hint, desc, prev_bad, hook=None): """This is a sample callback that will read a passphrase from the terminal. The hook here, if present, will be used to describe @@ -32,10 +33,12 @@ def passphrase_stdin(hint, desc, prev_bad, hook=None): print("Please supply %s' password%s:" % (hint, why)) return getpass() + def progress_stdout(what, type, current, total, hook=None): print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" %\ (what, type, current, total)) + def readcb_fh(count, hook): """A callback for data. hook should be a Python file-like object.""" if count: diff --git a/lang/python/src/constants/__init__.py b/lang/python/src/constants/__init__.py index 484ffd2..da37395 100644 --- a/lang/python/src/constants/__init__.py +++ b/lang/python/src/constants/__init__.py @@ -25,16 +25,18 @@ util.process_constants('GPGME_', globals()) del util # For convenience, we import the modules here. -from . import data, keylist, sig, tofu # The subdirs. +from . import data, keylist, sig, tofu # The subdirs. from . import create, event, keysign, md, pk, protocol, sigsum, status, validity # A complication arises because 'import' is a reserved keyword. # Import it as 'Import' instead. -globals()['Import'] = getattr(__import__('', globals(), locals(), - [str('import')], 1), "import") +globals()['Import'] = getattr( + __import__('', globals(), locals(), [str('import')], 1), "import") -__all__ = ['data', 'event', 'import', 'keysign', 'keylist', 'md', 'pk', - 'protocol', 'sig', 'sigsum', 'status', 'tofu', 'validity', 'create'] +__all__ = [ + 'data', 'event', 'import', 'keysign', 'keylist', 'md', 'pk', 'protocol', + 'sig', 'sigsum', 'status', 'tofu', 'validity', 'create' +] # GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We # implement gpg.Context.op_edit using gpgme_op_interact, so the diff --git a/lang/python/src/constants/data/__init__.py b/lang/python/src/constants/data/__init__.py index 8274ab9..b864b7c 100644 --- a/lang/python/src/constants/data/__init__.py +++ b/lang/python/src/constants/data/__init__.py @@ -1,4 +1,3 @@ - from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals diff --git a/lang/python/src/constants/keylist/__init__.py b/lang/python/src/constants/keylist/__init__.py index 2ce0edf..9d1e2d5 100644 --- a/lang/python/src/constants/keylist/__init__.py +++ b/lang/python/src/constants/keylist/__init__.py @@ -1,4 +1,3 @@ - from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals diff --git a/lang/python/src/constants/sig/__init__.py b/lang/python/src/constants/sig/__init__.py index 39d4e6e..fc34f8e 100644 --- a/lang/python/src/constants/sig/__init__.py +++ b/lang/python/src/constants/sig/__init__.py @@ -1,4 +1,3 @@ - from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals diff --git a/lang/python/src/core.py b/lang/python/src/core.py index 276d2b5..7858468 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -14,8 +14,8 @@ from . import constants from . import errors from . import util -# Copyright (C) 2016-2017 g10 Code GmbH -# Copyright (C) 2004,2008 Igor Belyi +# Copyright (C) 2016-2018 g10 Code GmbH +# Copyright (C) 2004, 2008 Igor Belyi # Copyright (C) 2002 John Goerzen # # This library is free software; you can redistribute it and/or @@ -31,7 +31,6 @@ from . import util # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - """Core functionality Core functionality of GPGME wrapped in a object-oriented fashion. @@ -53,8 +52,8 @@ class GpgmeWrapper(object): self.wrapped = wrapped def __repr__(self): - return '<{}/{!r}>'.format(super(GpgmeWrapper, self).__repr__(), - self.wrapped) + return '<{}/{!r}>'.format( + super(GpgmeWrapper, self).__repr__(), self.wrapped) def __str__(self): acc = ['{}.{}'.format(__name__, self.__class__.__name__)] @@ -102,10 +101,8 @@ class GpgmeWrapper(object): _boolean_properties = set() def __wrap_boolean_property(self, key, do_set=False, value=None): - get_func = getattr(gpgme, - "{}get_{}".format(self._cprefix, key)) - set_func = getattr(gpgme, - "{}set_{}".format(self._cprefix, key)) + get_func = getattr(gpgme, "{}get_{}".format(self._cprefix, key)) + set_func = getattr(gpgme, "{}set_{}".format(self._cprefix, key)) def get(slf): return bool(get_func(slf.wrapped)) @@ -135,12 +132,14 @@ class GpgmeWrapper(object): func = getattr(gpgme, name) if self._errorcheck(name): + def _funcwrap(slf, *args): result = func(slf.wrapped, *args) if slf._callback_excinfo: gpgme.gpg_raise_callback_exception(slf) return errorcheck(result, name) else: + def _funcwrap(slf, *args): result = func(slf.wrapped, *args) if slf._callback_excinfo: @@ -156,6 +155,7 @@ class GpgmeWrapper(object): # Bind the method to 'self'. def wrapper(*args): return _funcwrap(self, *args) + wrapper.__doc__ = doc return wrapper @@ -181,10 +181,15 @@ class Context(GpgmeWrapper): """ - def __init__(self, armor=False, textmode=False, offline=False, - signers=[], pinentry_mode=constants.PINENTRY_MODE_DEFAULT, + def __init__(self, + armor=False, + textmode=False, + offline=False, + signers=[], + pinentry_mode=constants.PINENTRY_MODE_DEFAULT, protocol=constants.PROTOCOL_OpenPGP, - wrapped=None, home_dir=None): + wrapped=None, + home_dir=None): """Construct a context object Keyword arguments: @@ -226,16 +231,23 @@ class Context(GpgmeWrapper): return data.read() def __repr__(self): - return ( - "Context(armor={0.armor}, " - "textmode={0.textmode}, offline={0.offline}, " - "signers={0.signers}, pinentry_mode={0.pinentry_mode}, " - "protocol={0.protocol}, home_dir={0.home_dir}" - ")").format(self) - - def encrypt(self, plaintext, recipients=[], sign=True, sink=None, - passphrase=None, always_trust=False, add_encrypt_to=False, - prepare=False, expect_sign=False, compress=True): + return ("Context(armor={0.armor}, " + "textmode={0.textmode}, offline={0.offline}, " + "signers={0.signers}, pinentry_mode={0.pinentry_mode}, " + "protocol={0.protocol}, home_dir={0.home_dir}" + ")").format(self) + + def encrypt(self, + plaintext, + recipients=[], + sign=True, + sink=None, + passphrase=None, + always_trust=False, + add_encrypt_to=False, + prepare=False, + expect_sign=False, + compress=True): """Encrypt data Encrypt the given plaintext for the given recipients. If the @@ -282,6 +294,7 @@ class Context(GpgmeWrapper): def passphrase_cb(hint, desc, prev_bad, hook=None): return passphrase + self.set_passphrase_cb(passphrase_cb) try: @@ -292,19 +305,20 @@ class Context(GpgmeWrapper): except errors.GPGMEError as e: result = self.op_encrypt_result() sig_result = self.op_sign_result() if sign else None - results = (self.__read__(sink, ciphertext), - result, sig_result) + results = (self.__read__(sink, ciphertext), result, sig_result) if e.getcode() == errors.UNUSABLE_PUBKEY: if result.invalid_recipients: - raise errors.InvalidRecipients(result.invalid_recipients, - error=e.error, - results=results) + raise errors.InvalidRecipients( + result.invalid_recipients, + error=e.error, + results=results) if e.getcode() == errors.UNUSABLE_SECKEY: sig_result = self.op_sign_result() if sig_result.invalid_signers: - raise errors.InvalidSigners(sig_result.invalid_signers, - error=e.error, - results=results) + raise errors.InvalidSigners( + sig_result.invalid_signers, + error=e.error, + results=results) # Otherwise, just raise the error, but attach the results # first. e.results = results @@ -360,6 +374,7 @@ class Context(GpgmeWrapper): def passphrase_cb(hint, desc, prev_bad, hook=None): return passphrase + self.set_passphrase_cb(passphrase_cb) try: @@ -371,8 +386,7 @@ class Context(GpgmeWrapper): result = self.op_decrypt_result() verify_result = self.op_verify_result() if verify else None # Just raise the error, but attach the results first. - e.results = (self.__read__(sink, plaintext), - result, verify_result) + e.results = (self.__read__(sink, plaintext), result, verify_result) raise e finally: if passphrase is not None: @@ -384,8 +398,8 @@ class Context(GpgmeWrapper): verify_result = self.op_verify_result() if verify else None results = (self.__read__(sink, plaintext), result, verify_result) if result.unsupported_algorithm: - raise errors.UnsupportedAlgorithm(result.unsupported_algorithm, - results=results) + raise errors.UnsupportedAlgorithm( + result.unsupported_algorithm, results=results) if verify: if any(s.status != errors.NO_ERROR @@ -408,8 +422,8 @@ class Context(GpgmeWrapper): if not ok: missing.append(key) if missing: - raise errors.MissingSignatures(verify_result, missing, - results=results) + raise errors.MissingSignatures( + verify_result, missing, results=results) return results @@ -441,13 +455,13 @@ class Context(GpgmeWrapper): try: self.op_sign(data, signeddata, mode) except errors.GPGMEError as e: - results = (self.__read__(sink, signeddata), - self.op_sign_result()) + results = (self.__read__(sink, signeddata), self.op_sign_result()) if e.getcode() == errors.UNUSABLE_SECKEY: if results[1].invalid_signers: - raise errors.InvalidSigners(results[1].invalid_signers, - error=e.error, - results=results) + raise errors.InvalidSigners( + results[1].invalid_signers, + error=e.error, + results=results) e.results = results raise e @@ -491,8 +505,7 @@ class Context(GpgmeWrapper): self.op_verify(signed_data, None, data) except errors.GPGMEError as e: # Just raise the error, but attach the results first. - e.results = (self.__read__(sink, data), - self.op_verify_result()) + e.results = (self.__read__(sink, data), self.op_verify_result()) raise e results = (self.__read__(sink, data), self.op_verify_result()) @@ -514,8 +527,8 @@ class Context(GpgmeWrapper): if not ok: missing.append(key) if missing: - raise errors.MissingSignatures(results[1], missing, - results=results) + raise errors.MissingSignatures( + results[1], missing, results=results) return results @@ -676,7 +689,9 @@ class Context(GpgmeWrapper): return result - def keylist(self, pattern=None, secret=False, + def keylist(self, + pattern=None, + secret=False, mode=constants.keylist.mode.LOCAL, source=None): """List keys @@ -711,9 +726,17 @@ class Context(GpgmeWrapper): key = self.op_keylist_next() self.op_keylist_end() - def create_key(self, userid, algorithm=None, expires_in=0, expires=True, - sign=False, encrypt=False, certify=False, - authenticate=False, passphrase=None, force=False): + def create_key(self, + userid, + algorithm=None, + expires_in=0, + expires=True, + sign=False, + encrypt=False, + certify=False, + authenticate=False, + passphrase=None, + force=False): """Create a primary key Create a primary key for the user id USERID. @@ -769,19 +792,23 @@ class Context(GpgmeWrapper): def passphrase_cb(hint, desc, prev_bad, hook=None): return passphrase + self.set_passphrase_cb(passphrase_cb) try: - self.op_createkey(userid, algorithm, 0, # reserved - expires_in, None, # extrakey - ((constants.create.SIGN if sign else 0) - | (constants.create.ENCR if encrypt else 0) - | (constants.create.CERT if certify else 0) - | (constants.create.AUTH if authenticate else 0) - | (constants.create.NOPASSWD - if passphrase is None else 0) - | (0 if expires else constants.create.NOEXPIRE) - | (constants.create.FORCE if force else 0))) + self.op_createkey( + userid, + algorithm, + 0, # reserved + expires_in, + None, # extrakey + ((constants.create.SIGN if sign else 0) | + (constants.create.ENCR if encrypt else 0) | + (constants.create.CERT if certify else 0) | + (constants.create.AUTH if authenticate else 0) | + (constants.create.NOPASSWD if passphrase is None else 0) | + (0 if expires else constants.create.NOEXPIRE) | + (constants.create.FORCE if force else 0))) finally: if util.is_a_string(passphrase): self.pinentry_mode = old_pinentry_mode @@ -790,8 +817,14 @@ class Context(GpgmeWrapper): return self.op_genkey_result() - def create_subkey(self, key, algorithm=None, expires_in=0, expires=True, - sign=False, encrypt=False, authenticate=False, + def create_subkey(self, + key, + algorithm=None, + expires_in=0, + expires=True, + sign=False, + encrypt=False, + authenticate=False, passphrase=None): """Create a subkey @@ -845,19 +878,20 @@ class Context(GpgmeWrapper): def passphrase_cb(hint, desc, prev_bad, hook=None): return passphrase + self.set_passphrase_cb(passphrase_cb) try: - self.op_createsubkey(key, algorithm, 0, # reserved - expires_in, - ((constants.create.SIGN if sign else 0) - | (constants.create.ENCR if encrypt else 0) - | (constants.create.AUTH - if authenticate else 0) - | (constants.create.NOPASSWD - if passphrase is None else 0) - | (0 if expires - else constants.create.NOEXPIRE))) + self.op_createsubkey( + key, + algorithm, + 0, # reserved + expires_in, + ((constants.create.SIGN if sign else 0) | + (constants.create.ENCR if encrypt else 0) | + (constants.create.AUTH if authenticate else 0) | + (constants.create.NOPASSWD if passphrase is None else 0) | + (0 if expires else constants.create.NOEXPIRE))) finally: if util.is_a_string(passphrase): self.pinentry_mode = old_pinentry_mode @@ -943,8 +977,11 @@ class Context(GpgmeWrapper): """ self.op_tofu_policy(key, policy) - def assuan_transact(self, command, - data_cb=None, inquire_cb=None, status_cb=None): + def assuan_transact(self, + command, + data_cb=None, + inquire_cb=None, + status_cb=None): """Issue a raw assuan command This function can be used to issue a raw assuan command to the @@ -975,12 +1012,10 @@ class Context(GpgmeWrapper): errptr = gpgme.new_gpgme_error_t_p() err = gpgme.gpgme_op_assuan_transact_ext( - self.wrapped, - cmd, - (weakref.ref(self), data_cb) if data_cb else None, - (weakref.ref(self), inquire_cb) if inquire_cb else None, - (weakref.ref(self), status_cb) if status_cb else None, - errptr) + self.wrapped, cmd, (weakref.ref(self), data_cb) + if data_cb else None, (weakref.ref(self), inquire_cb) + if inquire_cb else None, (weakref.ref(self), status_cb) + if status_cb else None, errptr) if self._callback_excinfo: gpgme.gpg_raise_callback_exception(self) @@ -1019,8 +1054,8 @@ class Context(GpgmeWrapper): else: opaquedata = (weakref.ref(self), func) - result = gpgme.gpgme_op_interact(self.wrapped, key, flags, - opaquedata, sink) + result = gpgme.gpgme_op_interact(self.wrapped, key, flags, opaquedata, + sink) if self._callback_excinfo: gpgme.gpg_raise_callback_exception(self) errorcheck(result) @@ -1079,13 +1114,14 @@ class Context(GpgmeWrapper): # $ grep '^gpgme_error_t ' obj/lang/python/python3.5-gpg/gpgme.h \ # | grep -v _op_ | awk "/\(gpgme_ctx/ { printf (\"'%s',\\n\", \$2) } " return ((name.startswith('gpgme_op_') and not - name.endswith('_result')) or name in - {'gpgme_new', 'gpgme_set_ctx_flag', 'gpgme_set_protocol', + name.endswith('_result')) or name in { + 'gpgme_new', 'gpgme_set_ctx_flag', 'gpgme_set_protocol', 'gpgme_set_sub_protocol', 'gpgme_set_keylist_mode', 'gpgme_set_pinentry_mode', 'gpgme_set_locale', 'gpgme_ctx_set_engine_info', 'gpgme_signers_add', 'gpgme_sig_notation_add', 'gpgme_set_sender', - 'gpgme_cancel', 'gpgme_cancel_async', 'gpgme_get_key'}) + 'gpgme_cancel', 'gpgme_cancel_async', 'gpgme_get_key' + }) _boolean_properties = {'armor', 'textmode', 'offline'} @@ -1319,8 +1355,8 @@ class Context(GpgmeWrapper): magic numbers will break as a result. """ - warnings.warn("Call to deprecated method op_edit.", - category=DeprecationWarning) + warnings.warn( + "Call to deprecated method op_edit.", category=DeprecationWarning) return self.interact(key, func, sink=out, fnc_value=fnc_value) @@ -1362,8 +1398,13 @@ class Data(GpgmeWrapper): 'gpgme_data_identify', } - def __init__(self, string=None, file=None, offset=None, - length=None, cbs=None, copy=True): + def __init__(self, + string=None, + file=None, + offset=None, + length=None, + cbs=None, + copy=True): """Initialize a new gpgme_data_t object. If no args are specified, make it an empty object. @@ -1451,8 +1492,8 @@ class Data(GpgmeWrapper): def new_from_mem(self, string, copy=True): tmp = gpgme.new_gpgme_data_t_p() - errorcheck(gpgme.gpgme_data_new_from_mem(tmp, string, len(string), - copy)) + errorcheck( + gpgme.gpgme_data_new_from_mem(tmp, string, len(string), copy)) self.wrapped = gpgme.gpgme_data_t_p_value(tmp) gpgme.delete_gpgme_data_t_p(tmp) @@ -1471,11 +1512,11 @@ class Data(GpgmeWrapper): def new_from_cbs(self, read_cb, write_cb, seek_cb, release_cb, hook=None): tmp = gpgme.new_gpgme_data_t_p() if hook is not None: - hookdata = (weakref.ref(self), - read_cb, write_cb, seek_cb, release_cb, hook) + hookdata = (weakref.ref(self), read_cb, write_cb, seek_cb, + release_cb, hook) else: - hookdata = (weakref.ref(self), - read_cb, write_cb, seek_cb, release_cb) + hookdata = (weakref.ref(self), read_cb, write_cb, seek_cb, + release_cb) gpgme.gpg_data_new_from_cbs(self, hookdata, tmp) self.wrapped = gpgme.gpgme_data_t_p_value(tmp) gpgme.delete_gpgme_data_t_p(tmp) @@ -1498,11 +1539,12 @@ class Data(GpgmeWrapper): else: fp = gpgme.fdopen(file.fileno(), file.mode) if fp is None: - raise ValueError("Failed to open file from %s arg %s" % - (str(type(file)), str(file))) + raise ValueError("Failed to open file from %s arg %s" % (str( + type(file)), str(file))) - errorcheck(gpgme.gpgme_data_new_from_filepart(tmp, filename, fp, - offset, length)) + errorcheck( + gpgme.gpgme_data_new_from_filepart(tmp, filename, fp, offset, + length)) self.wrapped = gpgme.gpgme_data_t_p_value(tmp) gpgme.delete_gpgme_data_t_p(tmp) @@ -1637,6 +1679,7 @@ def addrspec_from_uid(uid): def check_version(version=None): return gpgme.gpgme_check_version(version) + # check_version also makes sure that several subsystems are properly # initialized, and it must be run at least once before invoking any # other function. We do it here so that the user does not have to do diff --git a/lang/python/src/errors.py b/lang/python/src/errors.py index c41ac69..45157c5 100644 --- a/lang/python/src/errors.py +++ b/lang/python/src/errors.py @@ -30,6 +30,7 @@ EOF = None util.process_constants('GPG_ERR_', globals()) del util + class GpgError(Exception): """A GPG Error @@ -55,6 +56,7 @@ class GpgError(Exception): exception objects. """ + def __init__(self, error=None, context=None, results=None): self.error = error self.context = context @@ -93,6 +95,7 @@ class GpgError(Exception): msgs.append(self.code_str) return ': '.join(msgs) + class GPGMEError(GpgError): '''Generic error @@ -101,24 +104,30 @@ class GPGMEError(GpgError): returns an error. This is the error that was used in PyME. ''' + @classmethod def fromSyserror(cls): return cls(gpgme.gpgme_err_code_from_syserror()) + @property def message(self): return self.context + def getstring(self): return str(self) + def getcode(self): return self.code + def getsource(self): return self.source -def errorcheck(retval, extradata = None): +def errorcheck(retval, extradata=None): if retval: raise GPGMEError(retval, extradata) + class KeyNotFound(GPGMEError, KeyError): """Raised if a key was not found @@ -127,63 +136,76 @@ class KeyNotFound(GPGMEError, KeyError): indicating EOF, and a KeyError. """ + def __init__(self, keystr): self.keystr = keystr GPGMEError.__init__(self, EOF) + def __str__(self): return self.keystr + # These errors are raised in the idiomatic interface code. + class EncryptionError(GpgError): pass + class InvalidRecipients(EncryptionError): def __init__(self, recipients, **kwargs): EncryptionError.__init__(self, **kwargs) self.recipients = recipients + def __str__(self): - return ", ".join("{}: {}".format(r.fpr, - gpgme.gpgme_strerror(r.reason)) + return ", ".join("{}: {}".format(r.fpr, gpgme.gpgme_strerror(r.reason)) for r in self.recipients) + class DeryptionError(GpgError): pass + class UnsupportedAlgorithm(DeryptionError): def __init__(self, algorithm, **kwargs): DeryptionError.__init__(self, **kwargs) self.algorithm = algorithm + def __str__(self): return self.algorithm + class SigningError(GpgError): pass + class InvalidSigners(SigningError): def __init__(self, signers, **kwargs): SigningError.__init__(self, **kwargs) self.signers = signers + def __str__(self): - return ", ".join("{}: {}".format(s.fpr, - gpgme.gpgme_strerror(s.reason)) + return ", ".join("{}: {}".format(s.fpr, gpgme.gpgme_strerror(s.reason)) for s in self.signers) + class VerificationError(GpgError): def __init__(self, result, **kwargs): GpgError.__init__(self, **kwargs) self.result = result + class BadSignatures(VerificationError): def __str__(self): - return ", ".join("{}: {}".format(s.fpr, - gpgme.gpgme_strerror(s.status)) + return ", ".join("{}: {}".format(s.fpr, gpgme.gpgme_strerror(s.status)) for s in self.result.signatures if s.status != NO_ERROR) + class MissingSignatures(VerificationError): def __init__(self, result, missing, **kwargs): VerificationError.__init__(self, result, **kwargs) self.missing = missing + def __str__(self): return ", ".join(k.subkeys[0].fpr for k in self.missing) diff --git a/lang/python/src/results.py b/lang/python/src/results.py index bfd0f68..6b5f63c 100644 --- a/lang/python/src/results.py +++ b/lang/python/src/results.py @@ -19,7 +19,6 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals - """Robust result objects Results returned by the underlying library are fragile, i.e. they are @@ -30,23 +29,28 @@ therefore create deep copies of the results. """ + class Result(object): """Result object Describes the result of an operation. """ - """Convert to types""" _type = {} - """Map functions over list attributes""" _map = {} - """Automatically copy unless blacklisted""" _blacklist = { - 'acquire', 'append', 'disown', 'next', 'own', 'this', 'thisown', + 'acquire', + 'append', + 'disown', + 'next', + 'own', + 'this', + 'thisown', } + def __init__(self, fragile): for key, func in self._type.items(): if hasattr(fragile, key): @@ -67,52 +71,67 @@ class Result(object): def __repr__(self): return '{}({})'.format( self.__class__.__name__, - ', '.join('{}={!r}'.format(k, getattr(self, k)) - for k in dir(self) if not k.startswith('_'))) + ', '.join('{}={!r}'.format(k, getattr(self, k)) for k in dir(self) + if not k.startswith('_'))) + class InvalidKey(Result): pass + class EncryptResult(Result): _map = dict(invalid_recipients=InvalidKey) + class Recipient(Result): pass + class DecryptResult(Result): _type = dict(wrong_key_usage=bool, is_de_vs=bool) _map = dict(recipients=Recipient) + class NewSignature(Result): pass + class SignResult(Result): _map = dict(invalid_signers=InvalidKey, signatures=NewSignature) + class Notation(Result): pass + class Signature(Result): _type = dict(wrong_key_usage=bool, chain_model=bool, is_de_vs=bool) _map = dict(notations=Notation) + class VerifyResult(Result): _map = dict(signatures=Signature) + class ImportStatus(Result): pass + class ImportResult(Result): _map = dict(imports=ImportStatus) + class GenkeyResult(Result): _type = dict(primary=bool, sub=bool) + class KeylistResult(Result): _type = dict(truncated=bool) + class VFSMountResult(Result): pass + class EngineInfo(Result): pass diff --git a/lang/python/src/util.py b/lang/python/src/util.py index e4fca4c..77d1421 100644 --- a/lang/python/src/util.py +++ b/lang/python/src/util.py @@ -21,6 +21,7 @@ del absolute_import, print_function, unicode_literals import sys + def process_constants(prefix, scope): """Called by the constant modules to load up the constants from the C library starting with PREFIX. Matching constants will be inserted @@ -30,17 +31,19 @@ def process_constants(prefix, scope): """ from . import gpgme index = len(prefix) - constants = {identifier[index:]: getattr(gpgme, identifier) - for identifier in dir(gpgme) - if identifier.startswith(prefix)} + constants = { + identifier[index:]: getattr(gpgme, identifier) + for identifier in dir(gpgme) if identifier.startswith(prefix) + } scope.update(constants) return list(constants.keys()) + def percent_escape(s): - return ''.join( - '%{0:2x}'.format(ord(c)) - if c == '+' or c == '"' or c == '%' or ord(c) <= 0x20 else c - for c in s) + return ''.join('%{0:2x}'.format(ord(c)) + if c == '+' or c == '"' or c == '%' or ord(c) <= 0x20 else c + for c in s) + # Python2/3 compatibility if sys.version_info[0] == 3: ----------------------------------------------------------------------- Summary of changes: lang/python/src/__init__.py | 7 +- lang/python/src/callbacks.py | 3 + lang/python/src/constants/__init__.py | 12 +- lang/python/src/constants/data/__init__.py | 1 - lang/python/src/constants/keylist/__init__.py | 1 - lang/python/src/constants/sig/__init__.py | 1 - lang/python/src/core.py | 239 +++++++++++++++----------- lang/python/src/errors.py | 36 +++- lang/python/src/results.py | 33 +++- lang/python/src/util.py | 17 +- 10 files changed, 220 insertions(+), 130 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 10 08:40:34 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 10 Aug 2018 08:40:34 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-6-g822c633 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 822c633845066756b6442ca67b93b4b5c4316ca0 (commit) from f1c0d9bb6506eee6a3ad93ef432fe6aa5b72aabd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 822c633845066756b6442ca67b93b4b5c4316ca0 Author: NIIBE Yutaka Date: Fri Aug 10 15:29:06 2018 +0900 g10: Fix undefined behavior when EOF in parsing packet for S2K. * g10/parse-packet.c (parse_symkeyenc): Use iobuf_get_noeof. (parse_key): Likewise. -- Cherry picked from master commit: 1b309d9f6199a91caa0ca0b97b92d599e00b736e When EOF comes at parsing s2k.count, it is possible the value will be (unsigned long)-1. Then, the result of S2K_DECODE_COUNT will be undefined. This patch fixes undefined behavior. Reported-by: Philippe Antoine GnuPG-bug-id: 4093 Signed-off-by: NIIBE Yutaka diff --git a/g10/parse-packet.c b/g10/parse-packet.c index a64d4f7..8d0be19 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1171,7 +1171,7 @@ parse_symkeyenc (IOBUF inp, int pkttype, unsigned long pktlen, } if (s2kmode == 3) { - k->s2k.count = iobuf_get (inp); + k->s2k.count = iobuf_get_noeof (inp); pktlen--; } k->seskeylen = seskeylen; @@ -2489,7 +2489,7 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen, err = gpg_error (GPG_ERR_INV_PACKET); goto leave; } - ski->s2k.count = iobuf_get (inp); + ski->s2k.count = iobuf_get_noeof (inp); pktlen--; if (list_mode) es_fprintf (listfp, "\tprotect count: %lu (%lu)\n", ----------------------------------------------------------------------- Summary of changes: g10/parse-packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 10 08:40:45 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 10 Aug 2018 08:40:45 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-187-g1b309d9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 1b309d9f6199a91caa0ca0b97b92d599e00b736e (commit) from e88f56f1937ac92f6a3b94e50b6db2649ec0be41 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1b309d9f6199a91caa0ca0b97b92d599e00b736e Author: NIIBE Yutaka Date: Fri Aug 10 15:29:06 2018 +0900 g10: Fix undefined behavior when EOF in parsing packet for S2K. * g10/parse-packet.c (parse_symkeyenc): Use iobuf_get_noeof. (parse_key): Likewise. -- When EOF comes at parsing s2k.count, it is possible the value will be (unsigned long)-1. Then, the result of S2K_DECODE_COUNT will be undefined. This patch fixes undefined behavior. Reported-by: Philippe Antoine GnuPG-bug-id: 4093 Signed-off-by: NIIBE Yutaka diff --git a/g10/parse-packet.c b/g10/parse-packet.c index e933abf..0fa8be6 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1186,7 +1186,7 @@ parse_symkeyenc (IOBUF inp, int pkttype, unsigned long pktlen, } if (s2kmode == 3) { - k->s2k.count = iobuf_get (inp); + k->s2k.count = iobuf_get_noeof (inp); pktlen--; } k->seskeylen = seskeylen; @@ -2528,7 +2528,7 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen, err = gpg_error (GPG_ERR_INV_PACKET); goto leave; } - ski->s2k.count = iobuf_get (inp); + ski->s2k.count = iobuf_get_noeof (inp); pktlen--; if (list_mode) es_fprintf (listfp, "\tprotect count: %lu (%lu)\n", ----------------------------------------------------------------------- Summary of changes: g10/parse-packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 13 18:23:54 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Mon, 13 Aug 2018 18:23:54 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-117-ged5ef82 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via ed5ef8293cdbfcc3b91268eeae1eb6b4f8d271bb (commit) from 94bf13e78e65e1d1bc2e5d6b2311f9c9657bfe5f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ed5ef8293cdbfcc3b91268eeae1eb6b4f8d271bb Author: Ben McGinnes Date: Tue Aug 14 02:22:36 2018 +1000 Symmetric encryption example. * lang/python/examples/howto/symcrypt-file.py: A variation on standard key based encryption. diff --git a/lang/python/examples/howto/symcrypt-file.py b/lang/python/examples/howto/symcrypt-file.py new file mode 100755 index 0000000..2b24284 --- /dev/null +++ b/lang/python/examples/howto/symcrypt-file.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +from __future__ import absolute_import, division, unicode_literals + +import gpg +import sys + +# Copyright (C) 2018 Ben McGinnes +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU +# Lesser General Public Licensefor more details. +# +# You should have received a copy of the GNU General Public License and the GNU +# Lesser General Public along with this program; if not, see +# . + +""" +Symmetrically encrypts a file. Passphrase will be prompted for via Pinentry. + +Will produce both an ASCII armoured and GPG binary format copy of the encrypted +file. +""" + +if len(sys.argv) > 2: + filename = " ".join(sys.argv[1:]) +elif len(sys.argv) == 2: + filename = sys.argv[1] +else: + filename = input("Enter the path and filename to encrypt: ") + +with open(filename, "rb") as f: + text = f.read() + +with gpg.Context(armor=True) as ca: + try: + ciphertext, result, sign_result = ca.encrypt(text, passphrase=None, + sign=False) + with open("{0}.asc".format(filename), "wb") as fa: + fa.write(ciphertext) + except gpg.errors.InvalidRecipients as e: + print(e) + +with gpg.Context() as cg: + try: + ciphertext, result, sign_result = cg.encrypt(text, passphrase=None, + sign=False) + with open("{0}.gpg".format(filename), "wb") as fg: + fg.write(ciphertext) + except gpg.errors.InvalidRecipients as e: + print(e) ----------------------------------------------------------------------- Summary of changes: .../howto/{encrypt-file.py => symcrypt-file.py} | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) copy lang/python/examples/howto/{encrypt-file.py => symcrypt-file.py} (74%) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 13 18:49:44 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Mon, 13 Aug 2018 18:49:44 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-118-ga256d84 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via a256d84882616341b3f357340533893a1db8b5c1 (commit) from ed5ef8293cdbfcc3b91268eeae1eb6b4f8d271bb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a256d84882616341b3f357340533893a1db8b5c1 Author: Ben McGinnes Date: Tue Aug 14 02:48:38 2018 +1000 Symmetric encryption example * lang/python/examples/howto/symcrypt-file.py: Fixed the error code and the passphrase key word arg. diff --git a/lang/python/examples/howto/symcrypt-file.py b/lang/python/examples/howto/symcrypt-file.py index 2b24284..2e6ece4 100755 --- a/lang/python/examples/howto/symcrypt-file.py +++ b/lang/python/examples/howto/symcrypt-file.py @@ -46,18 +46,18 @@ with open(filename, "rb") as f: with gpg.Context(armor=True) as ca: try: - ciphertext, result, sign_result = ca.encrypt(text, passphrase=None, + ciphertext, result, sign_result = ca.encrypt(text, passphrase=True, sign=False) with open("{0}.asc".format(filename), "wb") as fa: fa.write(ciphertext) - except gpg.errors.InvalidRecipients as e: + except gpg.errors.GPGMEError as e: print(e) with gpg.Context() as cg: try: - ciphertext, result, sign_result = cg.encrypt(text, passphrase=None, + ciphertext, result, sign_result = cg.encrypt(text, passphrase=True, sign=False) with open("{0}.gpg".format(filename), "wb") as fg: fg.write(ciphertext) - except gpg.errors.InvalidRecipients as e: + except gpg.errors.GPGMEError as e: print(e) ----------------------------------------------------------------------- Summary of changes: lang/python/examples/howto/symcrypt-file.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 13 19:00:09 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Mon, 13 Aug 2018 19:00:09 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-119-g279cac0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 279cac0ffbb3d865d997dc7fc9c1b53bbb55d3a2 (commit) from a256d84882616341b3f357340533893a1db8b5c1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 279cac0ffbb3d865d997dc7fc9c1b53bbb55d3a2 Author: Ben McGinnes Date: Tue Aug 14 02:55:56 2018 +1000 Symmetric example * lang/python/examples/howto/symcrypt-file.py: *sigh*; passphrase was right the first time, just the error check that wasn't. * I really should stop second guessing myself one of these days ... Signed-off-by: Ben McGinnes diff --git a/lang/python/examples/howto/symcrypt-file.py b/lang/python/examples/howto/symcrypt-file.py index 2e6ece4..785a4d0 100755 --- a/lang/python/examples/howto/symcrypt-file.py +++ b/lang/python/examples/howto/symcrypt-file.py @@ -46,7 +46,7 @@ with open(filename, "rb") as f: with gpg.Context(armor=True) as ca: try: - ciphertext, result, sign_result = ca.encrypt(text, passphrase=True, + ciphertext, result, sign_result = ca.encrypt(text, passphrase=None, sign=False) with open("{0}.asc".format(filename), "wb") as fa: fa.write(ciphertext) @@ -55,7 +55,7 @@ with gpg.Context(armor=True) as ca: with gpg.Context() as cg: try: - ciphertext, result, sign_result = cg.encrypt(text, passphrase=True, + ciphertext, result, sign_result = cg.encrypt(text, passphrase=None, sign=False) with open("{0}.gpg".format(filename), "wb") as fg: fg.write(ciphertext) ----------------------------------------------------------------------- Summary of changes: lang/python/examples/howto/symcrypt-file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 15 20:34:38 2018 From: cvs at cvs.gnupg.org (by Damien Goutte-Gattat via Gnupg-devel) Date: Wed, 15 Aug 2018 20:34:38 +0200 Subject: [git] Pinentry - branch, master, updated. pinentry-1.1.0-11-g0fb3392 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via 0fb3392f61569cb93e52c81465bc8e4636bca3b7 (commit) via a75786a11666a080cae67f6e386163fcf93ff233 (commit) via 4b06bc6009011a84e5e8d4da2f01659f35e5a2d5 (commit) via fd22facabd784586f72eeecc72830620a534929c (commit) from 779b8e6df7d2678d40bc61ba9e9ff35324a40d03 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0fb3392f61569cb93e52c81465bc8e4636bca3b7 Author: Damien Goutte-Gattat via Gnupg-devel Date: Sat Aug 4 22:24:11 2018 +0100 tqt: Disable echoing if backspace is pressed first. * tqt/secqlineedit.h (backspacePressed): New signal. * tqt/secqinternal.cpp (SecTQLineEdit::backspace): Emit new signal. * tqt/pinentrydialog.h (_got_input): New member field. (onBackspace): New slot. * tqt/pinentrydialog.cpp (onBackspace): New slot. (PinEntryDialog::updateQuality): Prevent echo disabling as soon as the text has been edited. GnuPG-bug-id: 3428 Signed-off-by: Damien Goutte-Gattat diff --git a/tqt/pinentrydialog.cpp b/tqt/pinentrydialog.cpp index 069eeaf..6a2ae12 100644 --- a/tqt/pinentrydialog.cpp +++ b/tqt/pinentrydialog.cpp @@ -32,7 +32,8 @@ PinEntryDialog::PinEntryDialog( TQWidget* parent, const char* name, bool modal, bool enable_quality_bar ) - : TQDialog( parent, name, modal, TQt::WStyle_StaysOnTop ), _grabbed( false ) + : TQDialog( parent, name, modal, TQt::WStyle_StaysOnTop ), _grabbed( false ), + _got_input( false ) { TQBoxLayout* top = new TQVBoxLayout( this, 6 ); TQBoxLayout* upperLayout = new TQHBoxLayout( top ); @@ -89,6 +90,8 @@ PinEntryDialog::PinEntryDialog( TQWidget* parent, const char* name, this, SIGNAL( rejected() ) ); connect( _edit, SIGNAL( textModified(const SecTQString&) ), this, SLOT( updateQuality(const SecTQString&) ) ); + connect (_edit, SIGNAL (backspacePressed()), + this, SLOT (onBackspace ())); connect (this, SIGNAL (accepted ()), this, SLOT (accept ())); connect (this, SIGNAL (rejected ()), @@ -131,6 +134,8 @@ void PinEntryDialog::updateQuality( const SecTQString & txt ) int percent; TQPalette pal; + _got_input = true; + if (!_have_quality_bar || !_pinentry_info) return; pin = (char*)txt.utf8(); @@ -159,6 +164,13 @@ void PinEntryDialog::updateQuality( const SecTQString & txt ) } +void PinEntryDialog::onBackspace() +{ + if (!_got_input) + _edit->setEchoMode( SecTQLineEdit::NoEcho ); +} + + void PinEntryDialog::setDescription( const TQString& txt ) { _desc->setText( txt ); diff --git a/tqt/pinentrydialog.h b/tqt/pinentrydialog.h index d6f20c6..eb4d332 100644 --- a/tqt/pinentrydialog.h +++ b/tqt/pinentrydialog.h @@ -63,6 +63,7 @@ public: public slots: void updateQuality(const SecTQString &); + void onBackspace(); signals: void accepted(); @@ -86,6 +87,7 @@ private: bool _grabbed; bool _have_quality_bar; pinentry_t _pinentry_info; + bool _got_input; }; diff --git a/tqt/secqlineedit.cpp b/tqt/secqlineedit.cpp index ee95c8d..da0637a 100644 --- a/tqt/secqlineedit.cpp +++ b/tqt/secqlineedit.cpp @@ -719,6 +719,8 @@ void SecTQLineEdit::backspace() d->del( TRUE ); } d->finishChange( priorState ); + + emit backspacePressed(); } /*! diff --git a/tqt/secqlineedit.h b/tqt/secqlineedit.h index bd28cec..126f231 100644 --- a/tqt/secqlineedit.h +++ b/tqt/secqlineedit.h @@ -187,6 +187,7 @@ signals: void returnPressed(); void lostFocus(); void selectionChanged(); + void backspacePressed(); protected: bool event( TQEvent * ); commit a75786a11666a080cae67f6e386163fcf93ff233 Author: Damien Goutte-Gattat via Gnupg-devel Date: Sat Aug 4 22:24:10 2018 +0100 qt: Disable echoing if backspace is pressed first. * qt/pinlineedit.h: New file. * qt/pinlineedit.cpp: New file. * qt/Makefile.am: Add new source files. * qt/pinentrydialog.cpp (PinEntryDialog): New member _got_input; Type of _edit member changed to PinLineEdit. (PinEntryDialog::onBackspace): New slot. GnuPG-bug-id: 3428 Signed-off-by: Damien Goutte-Gattat diff --git a/qt/Makefile.am b/qt/Makefile.am index 698005e..840d0c0 100644 --- a/qt/Makefile.am +++ b/qt/Makefile.am @@ -43,16 +43,17 @@ pinentry_qt_LDADD = \ $(COMMON_LIBS) $(PINENTRY_QT_LIBS) $(libcurses) $(LIBCAP) BUILT_SOURCES = \ - pinentryconfirm.moc pinentrydialog.moc + pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc CLEANFILES = \ - pinentryconfirm.moc pinentrydialog.moc + pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc pinentry_qt_SOURCES = pinentrydialog.h pinentrydialog.cpp \ - main.cpp qrc_pinentry.cpp pinentryconfirm.cpp pinentryconfirm.h + main.cpp qrc_pinentry.cpp pinentryconfirm.cpp pinentryconfirm.h \ + pinlineedit.h pinlineedit.cpp nodist_pinentry_qt_SOURCES = \ - pinentryconfirm.moc pinentrydialog.moc + pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc .h.moc: $(MOC) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ diff --git a/qt/pinentrydialog.cpp b/qt/pinentrydialog.cpp index d42ae4a..b7f2e53 100644 --- a/qt/pinentrydialog.cpp +++ b/qt/pinentrydialog.cpp @@ -36,6 +36,7 @@ #include #include #include +#include "pinlineedit.h" #ifdef Q_OS_WIN #include @@ -137,6 +138,7 @@ PinEntryDialog::PinEntryDialog(QWidget *parent, const char *name, : QDialog(parent), mRepeat(NULL), _grabbed(false), + _got_input(false), mVisibilityTT(visibilityTT), mHideTT(hideTT), mVisiActionEdit(NULL), @@ -163,7 +165,7 @@ PinEntryDialog::PinEntryDialog(QWidget *parent, const char *name, _prompt = new QLabel(this); _prompt->hide(); - _edit = new QLineEdit(this); + _edit = new PinLineEdit(this); _edit->setMaxLength(256); _edit->setEchoMode(QLineEdit::Password); @@ -205,6 +207,8 @@ PinEntryDialog::PinEntryDialog(QWidget *parent, const char *name, this, SLOT(updateQuality(QString))); connect(_edit, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); + connect(_edit, SIGNAL(backspacePressed()), + this, SLOT(onBackspace())); QTimer::singleShot(0, _edit, SLOT(setFocus())); @@ -356,6 +360,16 @@ void PinEntryDialog::setQualityBarTT(const QString &txt) } } +void PinEntryDialog::onBackspace() +{ + if (!_got_input) { + _edit->setEchoMode(QLineEdit::NoEcho); + if (mRepeat) { + mRepeat->setEchoMode(QLineEdit::NoEcho); + } + } +} + void PinEntryDialog::updateQuality(const QString &txt) { int length; @@ -366,6 +380,8 @@ void PinEntryDialog::updateQuality(const QString &txt) _timer->stop(); } + _got_input = true; + if (!_have_quality_bar || !_pinentry_info) { return; } diff --git a/qt/pinentrydialog.h b/qt/pinentrydialog.h index 52b7343..396f03b 100644 --- a/qt/pinentrydialog.h +++ b/qt/pinentrydialog.h @@ -33,6 +33,7 @@ class QLabel; class QPushButton; class QLineEdit; +class PinLineEdit; class QString; class QProgressBar; class QCheckBox; @@ -89,6 +90,7 @@ protected slots: void textChanged(const QString &); void focusChanged(QWidget *old, QWidget *now); void toggleVisibility(); + void onBackspace(); protected: /* reimp */ void showEvent(QShowEvent *event); @@ -100,13 +102,14 @@ private: QLabel *_prompt; QLabel *_quality_bar_label; QProgressBar *_quality_bar; - QLineEdit *_edit; - QLineEdit *mRepeat; + PinLineEdit *_edit; + QLineEdit *mRepeat; QPushButton *_ok; QPushButton *_cancel; bool _grabbed; bool _have_quality_bar; bool _timed_out; + bool _got_input; pinentry_t _pinentry_info; QTimer *_timer; QString mRepeatError, diff --git a/qt/pinlineedit.cpp b/qt/pinlineedit.cpp new file mode 100644 index 0000000..c7c7f36 --- /dev/null +++ b/qt/pinlineedit.cpp @@ -0,0 +1,36 @@ +/* pinlineedit.cpp - Modified QLineEdit widget. + * Copyright (C) 2018 Damien Goutte-Gattat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include "pinlineedit.h" + +#include + +PinLineEdit::PinLineEdit(QWidget *parent) : QLineEdit(parent) +{ +} + +void +PinLineEdit::keyPressEvent(QKeyEvent *e) +{ + QLineEdit::keyPressEvent(e); + + if ( e->key() == Qt::Key::Key_Backspace ) + emit backspacePressed(); +} + +#include "pinlineedit.moc" diff --git a/qt/pinlineedit.h b/qt/pinlineedit.h new file mode 100644 index 0000000..b1b48df --- /dev/null +++ b/qt/pinlineedit.h @@ -0,0 +1,38 @@ +/* pinlineedit.h - Modified QLineEdit widget. + * Copyright (C) 2018 Damien Goutte-Gattat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef _PINLINEEDIT_H_ +#define _PINLINEEDIT_H_ + +#include + +class PinLineEdit : public QLineEdit +{ + Q_OBJECT + +public: + PinLineEdit(QWidget *); + +signals: + void backspacePressed(); + +protected: + void keyPressEvent(QKeyEvent *); +}; + +#endif // _PINLINEEDIT_H_ commit 4b06bc6009011a84e5e8d4da2f01659f35e5a2d5 Author: Damien Goutte-Gattat via Gnupg-devel Date: Sat Aug 4 22:24:09 2018 +0100 gtk: Disable echoing if backspace is pressed first. * gtk+-2/pinentry-gtk-2.c (backspace_handler): New callback. (create_window): Attach previous callback to "backspace" signal. GnuPG-bug-id: 3428 Signed-off-by: Damien Goutte-Gattat diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c index c803628..1e07fdc 100644 --- a/gtk+-2/pinentry-gtk-2.c +++ b/gtk+-2/pinentry-gtk-2.c @@ -419,6 +419,22 @@ changed_text_handler (GtkWidget *widget) } +/* Called upon a press on Backspace in the entry widget. + Used to completely disable echoing if we got no prior input. */ +static void +backspace_handler (GtkWidget *widget, gpointer data) +{ + (void)data; + + if (!got_input) + { + gtk_entry_set_invisible_char (GTK_ENTRY (entry), 0); + if (repeat_entry) + gtk_entry_set_invisible_char (GTK_ENTRY (repeat_entry), 0); + } +} + + #ifdef HAVE_LIBSECRET static void may_save_passphrase_toggled (GtkWidget *widget, gpointer data) @@ -713,6 +729,8 @@ create_window (pinentry_t ctx) gtk_widget_set_size_request (entry, 200, -1); g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (changed_text_handler), entry); + g_signal_connect (G_OBJECT (entry), "backspace", + G_CALLBACK (backspace_handler), entry); hbox = gtk_hbox_new (FALSE, HIG_TINY); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); /* There was a wish in issue #2139 that this button should not commit fd22facabd784586f72eeecc72830620a534929c Author: Damien Goutte-Gattat via Gnupg-devel Date: Sat Aug 4 22:24:08 2018 +0100 curses: Disable echoing if backspace is pressed first. * pinentry/pinentry-curses.c (struct dialog): New fields got_input, no_echo. (dialog_input): Disable echoing and display instead "[no echo]" if the backspace key is pressed first. GnuPG-bug-id: 3428 Signed-off-by: Damien Goutte-Gattat diff --git a/pinentry/pinentry-curses.c b/pinentry/pinentry-curses.c index 89bb5b6..cfc1abd 100644 --- a/pinentry/pinentry-curses.c +++ b/pinentry/pinentry-curses.c @@ -94,6 +94,8 @@ struct dialog int pin_max; /* Length of PIN. */ int pin_len; + int got_input; + int no_echo; int ok_y; int ok_x; @@ -596,6 +598,9 @@ dialog_create (pinentry_t pinentry, dialog_t dialog) addstr (dialog->ok); } + dialog->got_input = 0; + dialog->no_echo = 0; + out: if (description) free (description); @@ -730,6 +735,12 @@ dialog_input (dialog_t diag, int alt, int chr) diag->pin_loc = diag->pin_len; } } + else if (!diag->got_input) + { + diag->no_echo = 1; + move (diag->pin_y, diag->pin_x); + addstr ("[no echo]"); + } break; case 'l' - 'a' + 1: /* control-l */ @@ -801,19 +812,24 @@ dialog_input (dialog_t diag, int alt, int chr) break; } - if (old_loc < diag->pin_loc) - { - move (diag->pin_y, diag->pin_x + old_loc); - while (old_loc++ < diag->pin_loc) - addch ('*'); - } - else if (old_loc > diag->pin_loc) + diag->got_input = 1; + + if (!diag->no_echo) { + if (old_loc < diag->pin_loc) + { + move (diag->pin_y, diag->pin_x + old_loc); + while (old_loc++ < diag->pin_loc) + addch ('*'); + } + else if (old_loc > diag->pin_loc) + { + move (diag->pin_y, diag->pin_x + diag->pin_loc); + while (old_loc-- > diag->pin_loc) + addch ('_'); + } move (diag->pin_y, diag->pin_x + diag->pin_loc); - while (old_loc-- > diag->pin_loc) - addch ('_'); } - move (diag->pin_y, diag->pin_x + diag->pin_loc); } static int ----------------------------------------------------------------------- Summary of changes: gtk+-2/pinentry-gtk-2.c | 18 +++++++++++++++++ pinentry/pinentry-curses.c | 36 ++++++++++++++++++++++++--------- qt/Makefile.am | 9 +++++---- qt/pinentrydialog.cpp | 18 ++++++++++++++++- qt/pinentrydialog.h | 7 +++++-- qt/pinlineedit.cpp | 36 +++++++++++++++++++++++++++++++++ qt/{pinentryconfirm.h => pinlineedit.h} | 34 ++++++++++++------------------- tqt/pinentrydialog.cpp | 14 ++++++++++++- tqt/pinentrydialog.h | 2 ++ tqt/secqlineedit.cpp | 2 ++ tqt/secqlineedit.h | 1 + 11 files changed, 138 insertions(+), 39 deletions(-) create mode 100644 qt/pinlineedit.cpp copy qt/{pinentryconfirm.h => pinlineedit.h} (50%) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 16 11:30:06 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 16 Aug 2018 11:30:06 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-88-gaeb065a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via aeb065acc91a22b6548ebf0a558951ed26398214 (commit) via 622db0d1de665dfd93c991cd2d517078b04b3a13 (commit) from 68a012deb3b501d7417778be12c88bd475a37cb5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit aeb065acc91a22b6548ebf0a558951ed26398214 Author: Maximilian Krambach Date: Thu Aug 16 11:29:10 2018 +0200 js: simplify getDefaultKey -- * src/Keyring.js: In case no default Key is set in configuration, only Keys reported as having a secret part should be considered for default Keys, avoiding some extra requests. diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index d25216c..c4b89b2 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -192,17 +192,13 @@ export class GPGME_Keyring { reject(error); }); } else { - // TODO: this is overly 'expensive' in communication - // and probably performance, too - me.getKeys(null,true).then(function(keys){ - for (let i=0; i < keys.length; i++){ - if (keys[i].get('hasSecret') === true){ - resolve(keys[i]); - break; - } - if (i === keys.length -1){ - reject(gpgme_error('KEY_NO_DEFAULT')); - } + let msg = createMessage('keylist'); + msg.setParameter('secret', true); + msg.post().then(function(result){ + if (result.keys.length === 0){ + reject(gpgme_error('KEY_NO_DEFAULT')); + } else { + resolve(result.keys[0]); } }, function(error){ reject(error); commit 622db0d1de665dfd93c991cd2d517078b04b3a13 Author: Maximilian Krambach Date: Thu Aug 16 11:25:50 2018 +0200 js: consistently return uppercase fingerprint -- * src/Key.js: the fingerprint returned by a Key is now always upper case hex, even if the constructor had lower case input. This is to be more consistent with gpgme and to be more readable and reliable in comparisions. diff --git a/lang/js/BrowserTestExtension/browsertest.html b/lang/js/BrowserTestExtension/browsertest.html index a20cfe1..0d3e293 100644 --- a/lang/js/BrowserTestExtension/browsertest.html +++ b/lang/js/BrowserTestExtension/browsertest.html @@ -15,6 +15,7 @@ + diff --git a/lang/js/BrowserTestExtension/tests/KeyInfos.js b/lang/js/BrowserTestExtension/tests/KeyInfos.js new file mode 100644 index 0000000..03773a4 --- /dev/null +++ b/lang/js/BrowserTestExtension/tests/KeyInfos.js @@ -0,0 +1,46 @@ +/* gpgme.js - Javascript integration for gpgme + * Copyright (C) 2018 Bundesamt f?r Sicherheit in der Informationstechnik + * + * This file is part of GPGME. + * + * GPGME is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * GPGME is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, see . + * SPDX-License-Identifier: LGPL-2.1+ + * + * Author(s): + * Maximilian Krambach + */ + +/* global describe, it, expect, before, Gpgmejs */ +/* global inputvalues, fixedLengthString */ + +describe('Key information', function () { + let context = null; + before(function(done){ + const prm = Gpgmejs.init(); + prm.then(function(gpgmejs){ + context = gpgmejs; + done(); + }); + }); + + it('A fingerprint is consistently returned upper case hex', function(done){ + const mixedCase = inputvalues.encrypt.good.fingerprint_mixedcase; + context.Keyring.getKeys(mixedCase).then(function(result){ + expect(result).to.be.an('array'); + expect(result.length).to.equal(1); + expect(result[0].fingerprint).to.equal(mixedCase.toUpperCase()); + done(); + }); + }); +}); \ No newline at end of file diff --git a/lang/js/BrowserTestExtension/tests/inputvalues.js b/lang/js/BrowserTestExtension/tests/inputvalues.js index 1e8f154..7dda47c 100644 --- a/lang/js/BrowserTestExtension/tests/inputvalues.js +++ b/lang/js/BrowserTestExtension/tests/inputvalues.js @@ -28,6 +28,7 @@ const inputvalues = {// eslint-disable-line no-unused-vars // Fingerprint of a key that has been imported to gnupg // (i.e. see testkey.pub; testkey.sec) fingerprint : 'D41735B91236FDB882048C5A2301635EEFF0CB05', + fingerprint_mixedcase: 'D41735B91236fdb882048C5A2301635eeFF0Cb05', data_nonascii: '??u?erste ?? f?r ?oquis at h?me! ?????? ????', // used for checking encoding consistency in > 2MB messages. diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index 88c49d3..eeb2703 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -58,7 +58,7 @@ export class GPGME_Key { */ this.isAsync = async; - let _data = {fingerprint: fingerprint}; + let _data = {fingerprint: fingerprint.toUpperCase()}; this.getFingerprint = function(){ if (!_data.fingerprint || !isFingerprint(_data.fingerprint)){ return gpgme_error('KEY_INVALID'); @@ -88,7 +88,8 @@ export class GPGME_Key { if (typeof(data) !== 'object') { return gpgme_error('KEY_INVALID'); } - if (!data.fingerprint || data.fingerprint !== _data.fingerprint){ + if (!data.fingerprint || + data.fingerprint.toUpperCase() !== _data.fingerprint){ return gpgme_error('KEY_INVALID'); } let keys = Object.keys(data); ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/browsertest.html | 1 + .../{popup.js => tests/KeyInfos.js} | 26 +++++++++++++++++----- lang/js/BrowserTestExtension/tests/inputvalues.js | 1 + lang/js/src/Key.js | 5 +++-- lang/js/src/Keyring.js | 18 ++++++--------- 5 files changed, 33 insertions(+), 18 deletions(-) copy lang/js/BrowserTestExtension/{popup.js => tests/KeyInfos.js} (55%) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 16 12:04:38 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 16 Aug 2018 12:04:38 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-89-g715cdc0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 715cdc0d7d5bc8d39ff3cc49774c59e5db01c1b6 (commit) from aeb065acc91a22b6548ebf0a558951ed26398214 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 715cdc0d7d5bc8d39ff3cc49774c59e5db01c1b6 Author: Maximilian Krambach Date: Thu Aug 16 12:03:30 2018 +0200 js: get default key fixes -- * src/Keyring.js: The answer was not parsed correctly, so a config was being ignored. * If no config is set, we return the first non-invalid key with a secret, instead of the first key (which may be e.g. an expired one) diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index c4b89b2..9fdd53b 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -176,12 +176,13 @@ export class GPGME_Keyring { let msg = createMessage('config_opt'); msg.setParameter('component', 'gpg'); msg.setParameter('option', 'default-key'); - msg.post().then(function(response){ - if (response.value !== undefined - && response.value.hasOwnProperty('string') - && typeof(response.value.string) === 'string' - ){ - me.getKeys(response.value.string,true).then( + msg.post().then(function(resp){ + if (resp.option !== undefined + && resp.option.hasOwnProperty('value') + && resp.option.value.length === 1 + && resp.option.value[0].hasOwnProperty('string') + && typeof(resp.option.value[0].string) === 'string'){ + me.getKeys(resp.option.value[0].string, true).then( function(keys){ if(keys.length === 1){ resolve(keys[0]); @@ -198,7 +199,14 @@ export class GPGME_Keyring { if (result.keys.length === 0){ reject(gpgme_error('KEY_NO_DEFAULT')); } else { - resolve(result.keys[0]); + for (let i=0; i< result.keys.length; i++ ) { + if (result.keys[i].get('invalid') === false) { + resolve(result.keys[i]); + break; + } else if (i === result.keys.length - 1){ + reject(gpgme_error('KEY_NO_DEFAULT')); + } + } } }, function(error){ reject(error); ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 16 12:13:47 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 16 Aug 2018 12:13:47 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-90-g43cff51 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 43cff5136459c5bca4dca66772eb815f5761c6cd (commit) from 715cdc0d7d5bc8d39ff3cc49774c59e5db01c1b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 43cff5136459c5bca4dca66772eb815f5761c6cd Author: Maximilian Krambach Date: Thu Aug 16 12:13:10 2018 +0200 js: wrong object assumed in recent commit -- * src/Keyring.js I wrongly assumed an object to be a GPGME_Key, it was the raw answer from nativeMessaging instead. Now it returns a GPGME_Key again. diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 9fdd53b..93923c6 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -200,8 +200,11 @@ export class GPGME_Keyring { reject(gpgme_error('KEY_NO_DEFAULT')); } else { for (let i=0; i< result.keys.length; i++ ) { - if (result.keys[i].get('invalid') === false) { - resolve(result.keys[i]); + if (result.keys[i].invalid === false) { + let k = createKey( + result.keys[i].fingerprint); + k.setKeyData(result.keys[i]); + resolve(k); break; } else if (i === result.keys.length - 1){ reject(gpgme_error('KEY_NO_DEFAULT')); ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 16 17:06:59 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 16 Aug 2018 17:06:59 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-92-gd65a392 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via d65a392670888f86071ca629266ec14b7afb0e46 (commit) via ea43158d4043b01058afd7411c84aa38b61c2009 (commit) from 43cff5136459c5bca4dca66772eb815f5761c6cd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d65a392670888f86071ca629266ec14b7afb0e46 Author: Maximilian Krambach Date: Thu Aug 16 17:07:29 2018 +0200 js: fix import feedback -- * src/Keyring.js For Key imports without prepare_sync the import feedback was lacking the summary diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 93923c6..eb4f60f 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -327,7 +327,15 @@ export class GPGME_Keyring { status: infos[fprs[i]].status }); } - resolve(resultset); + let summary = {}; + for (let i=0; i < feedbackValues.length; i++ ){ + summary[feedbackValues[i]] = + response[feedbackValues[i]]; + } + resolve({ + Keys:resultset, + summary:summary + }); } }, function(error){ commit ea43158d4043b01058afd7411c84aa38b61c2009 Author: Maximilian Krambach Date: Thu Aug 16 14:40:53 2018 +0200 js: avoid async getters -- * src/Key.js get armored was returning a promise on async keys. As getters should not do that, it returns an error in this case. diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index eeb2703..aa41905 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -303,7 +303,11 @@ export class GPGME_Key { * @returns {String|GPGME_Error} The armored public Key block. */ get armored(){ - return this.get('armored', true); + if (this.isAsync === true){ + return gpgme_error('KEY_NO_INIT'); + } else { + return this.get('armored'); + } } } @@ -389,15 +393,6 @@ class GPGME_UserId { } /** - * Validates a subkey property against {@link validUserIdProperties} and - * sets it if validation is successful - * @param {String} property - * @param {*} value - * @param private - */ - - - /** * Fetches information about the user * @param {String} property Information to request * @returns {String | Number} ----------------------------------------------------------------------- Summary of changes: lang/js/src/Key.js | 15 +++++---------- lang/js/src/Keyring.js | 10 +++++++++- 2 files changed, 14 insertions(+), 11 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 16 17:57:56 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 16 Aug 2018 17:57:56 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-93-g90cb4a6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 90cb4a684211fe5630f209ba61510e8be3129eae (commit) from d65a392670888f86071ca629266ec14b7afb0e46 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 90cb4a684211fe5630f209ba61510e8be3129eae Author: Maximilian Krambach Date: Thu Aug 16 17:58:11 2018 +0200 js: importKey feedback refactor -- * src/Keyring.js: An empty result should no longer cause an error, the import feedback summary has been refactored slightly * Browsertests to reflect import feedback change diff --git a/lang/js/BrowserTestExtension/tests/KeyImportExport.js b/lang/js/BrowserTestExtension/tests/KeyImportExport.js index d2fa2d3..6d0ba10 100644 --- a/lang/js/BrowserTestExtension/tests/KeyImportExport.js +++ b/lang/js/BrowserTestExtension/tests/KeyImportExport.js @@ -71,10 +71,13 @@ describe('Key importing', function () { expect(result).to.be.an('array'); expect(result.length).to.equal(0); context.Keyring.importKey(pubKey).then(function(result){ - expect(result[0]).to.not.be.undefined; - expect(result[0].key).to.be.an('object'); - expect(result[0].key.fingerprint).to.equal(fpr); - expect(result[0].status).to.equal('newkey'); + expect(result.Keys).to.be.an('array'); + expect(result.Keys[0]).to.not.be.undefined; + expect(result.Keys[0].key).to.be.an('object'); + expect(result.Keys[0].key.fingerprint).to.equal(fpr); + expect(result.Keys[0].status).to.equal('newkey'); + expect(result.summary.considered).to.equal(1); + expect(result.summary.imported).to.equal(1); done(); }); }); @@ -83,15 +86,16 @@ describe('Key importing', function () { it('Updating Key', function(done){ context.Keyring.importKey(pubKey) .then(function(result){ - expect(result[0].key).to.not.be.undefined; - expect(result[0].status).to.equal('newkey'); + expect(result.Keys[0].key).to.not.be.undefined; + expect(result.Keys[0].status).to.equal('newkey'); context.Keyring.importKey(changedKey).then(function(res){ - expect(res[0].key).to.be.an('object'); - expect(res[0].key.fingerprint).to.equal(fpr); - expect(res[0].status).to.equal('change'); - expect(res[0].changes.userId).to.be.true; - expect(res[0].changes.subkey).to.be.false; - expect(res[0].changes.signature).to.be.true; + expect(res.Keys[0].key).to.be.an('object'); + expect(res.Keys[0].key.fingerprint).to.equal(fpr); + expect(res.Keys[0].status).to.equal('change'); + expect(res.Keys[0].changes.userId).to.be.true; + expect(res.Keys[0].changes.subkey).to.be.false; + expect(res.Keys[0].changes.signature).to.be.true; + expect(res.summary.considered).to.equal(1); done(); }); }); @@ -99,9 +103,9 @@ describe('Key importing', function () { it('Deleting Key', function(done) { context.Keyring.importKey(pubKey).then(function(result){ - expect(result[0].key).to.be.an('object'); - expect(result[0].key.fingerprint).to.equal(fpr); - result[0].key.delete().then(function(result){ + expect(result.Keys[0].key).to.be.an('object'); + expect(result.Keys[0].key.fingerprint).to.equal(fpr); + result.Keys[0].key.delete().then(function(result){ expect(result).to.be.true; done(); }); diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index eb4f60f..a678798 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -274,6 +274,17 @@ export class GPGME_Keyring { msg.post().then(function(response){ let infos = {}; let fprs = []; + let summary = {}; + for (let i=0; i < feedbackValues.length; i++ ){ + summary[feedbackValues[i]] = + response.result[feedbackValues[i]]; + } + if (!response.result.hasOwnProperty('imports') || + response.result.imports.length === 0 + ){ + resolve({Keys:[],summary: summary}); + return; + } for (let res=0; res This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via ad39d54d192864b54a155bf5f94d5b6bb3e8612a (commit) via 754e799d35fd62d7a979452f44342934659908c7 (commit) from 90cb4a684211fe5630f209ba61510e8be3129eae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ad39d54d192864b54a155bf5f94d5b6bb3e8612a Author: Maximilian Krambach Date: Fri Aug 17 16:57:41 2018 +0200 js: removed Key.armor property in synchronous use -- * src/Key.js The synchronous mode for a Key does not offer an armor/ armored property anymore. This frees up a lot of performance issues, also the armored expoort is expected to change quite often, so a cached version is not advisable. * hasSecret/getHasSecret is now refactored, to reflect their uses. With get('hasSecret') there is a method that fetches the result. * src/Key.js also some refactoring diff --git a/lang/js/src/Errors.js b/lang/js/src/Errors.js index 39e3a74..b22eca7 100644 --- a/lang/js/src/Errors.js +++ b/lang/js/src/Errors.js @@ -81,6 +81,10 @@ const err_list = { msg:'This property has not been retrieved yet from GPG', type: 'error' }, + 'KEY_ASYNC_ONLY': { + msg: 'This property cannot be used in synchronous calls', + type: 'error' + }, 'KEY_NO_DEFAULT': { msg:'A default key could not be established. Please check yout gpg ' + 'configuration', diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index 8d7fd94..5d0c816 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -81,54 +81,30 @@ class GPGME_Key { }; /** - * Property indicating if the Key possesses a private/secret part. If - * this information is not yet cached, it returns an - * {@link GPGME_Error} with code 'KEY_NO_INIT'. Running - * {@link refreshKey} may help in this case. - * @returns {Boolean} If the Key has a secret subkey. - */ - this.hasSecret= function (){ - return this.get('hasSecret'); - }; - - - /** * Query any property of the Key listed in {@link validKeyProperties} * @param {String} property property to be retreived - * @returns {*|Promise<*>} the value (Boolean, String, Array, Object). - * If 'cached' is false, the value will be resolved as a Promise. + * @returns {Boolean| String | Date | Array | Object |GPGME_Error} + * the value of the property. If the Key is set to Async, the value + * will be fetched from gnupg and resolved as a Promise. If Key is not + * async, the armored property is not available (it can still be + * retrieved asynchronously by {@link Key.getArmor}) */ this.get = function(property) { if (this.isAsync === true) { - let me = this; - return new Promise(function(resolve, reject) { - if (property === 'armored'){ - resolve(me.getArmor()); - } else if (property === 'hasSecret'){ - resolve(me.getHasSecret()); - } else if (validKeyProperties.hasOwnProperty(property)){ - let msg = createMessage('keylist'); - msg.setParameter('keys', _data.fingerprint); - msg.post().then(function(result){ - if (result.keys && result.keys.length === 1 && - result.keys[0].hasOwnProperty(property)){ - resolve(result.keys[0][property]); - } else { - reject(gpgme_error('CONN_UNEXPECTED_ANSWER')); - } - }, function(error){ - reject(gpgme_error(error)); - }); - } else { - reject(gpgme_error('PARAM_WRONG')); - } - }); + switch (property){ + case 'armored': + return this.getArmor(); + case 'hasSecret': + return this.getGnupgSecretState(); + default: + return getGnupgState(property); + } } else { + if (property === 'armored') { + return gpgme_error('KEY_ASYNC_ONLY'); + } if (!validKeyProperties.hasOwnProperty(property)){ return gpgme_error('PARAM_WRONG'); - } - if (!_data.hasOwnProperty(property)){ - return gpgme_error('KEY_NO_INIT'); } else { return (_data[property]); } @@ -160,7 +136,7 @@ class GPGME_Key { reject(gpgme_error('KEY_INVALID')); } else { _data = newdata; - me.getHasSecret().then(function(){ + me.getGnupgSecretState().then(function(){ me.getArmor().then(function(){ resolve(me); }, function(error){ @@ -195,7 +171,6 @@ class GPGME_Key { msg.setParameter('armor', true); msg.setParameter('keys', _data.fingerprint); msg.post().then(function(result){ - _data.armored = result.data; resolve(result.data); }, function(error){ reject(error); @@ -205,37 +180,38 @@ class GPGME_Key { /** * Find out if the Key includes a secret part. Note that this is a - * rather nonperformant operation, as it needs to query gnupg twice. + * rather nonperformant operation. * If you want this inforrmation about more than a few Keys, it may be * advisable to run {@link Keyring.getKeys} instead. * @returns {Promise} True if a secret/private Key * is available in the gnupg Keyring * @async */ - this.getHasSecret = function (){ + this.getGnupgSecretState = function (){ return new Promise(function(resolve, reject) { if (!_data.fingerprint){ reject(gpgme_error('KEY_INVALID')); + } else { + let msg = createMessage('keylist'); + msg.setParameter('keys', _data.fingerprint); + msg.setParameter('secret', true); + msg.post().then(function(result){ + _data.hasSecret = null; + if ( + result.keys && + result.keys.length === 1 && + result.keys[0].secret === true + ) { + _data.hasSecret = true; + resolve(true); + } else { + _data.hasSecret = false; + resolve(false); + } + }, function(error){ + reject(error); + }); } - let msg = createMessage('keylist'); - msg.setParameter('keys', _data.fingerprint); - msg.setParameter('secret', true); - msg.post().then(function(result){ - _data.hasSecret = null; - if ( - result.keys && - result.keys.length === 1 && - result.keys[0].secret === true - ) { - _data.hasSecret = true; - resolve(true); - } else { - _data.hasSecret = false; - resolve(false); - } - }, function(error){ - reject(error); - }); }); }; @@ -262,25 +238,11 @@ class GPGME_Key { } /** - * @returns {String} The fingerprint defining this Key + * @returns {String} The fingerprint defining this Key. Convenience getter */ get fingerprint(){ return this.getFingerprint(); } - - /** - * Property for the export of armored Key. If the armored Key is not - * cached, it returns an {@link GPGME_Error} with code 'KEY_NO_INIT'. - * Running {@link refreshKey} may help in this case. - * @returns {String|GPGME_Error} The armored public Key block. - */ - get armored(){ - if (this.isAsync === true){ - return gpgme_error('KEY_NO_INIT'); - } else { - return this.get('armored'); - } - } } /** @@ -496,7 +458,31 @@ const validSubKeyProperties = { /** * Validation definition for Keys. Each valid Key property is represented - * as a key-value pair, with their value being a validation function + * as a key-value pair, with their value being a validation function. For + * details on the meanings, please refer to the gpgme documentation + * https://www.gnupg.org/documentation/manuals/gpgme/Key-objects.html#Key-objects + * @param {String} fingerprint + * @param {Boolean} revoked + * @param {Boolean} expired + * @param {Boolean} disabled + * @param {Boolean} invalid + * @param {Boolean} can_encrypt + * @param {Boolean} can_sign + * @param {Boolean} can_certify + * @param {Boolean} can_authenticate + * @param {Boolean} secret + * @param {Boolean}is_qualified + * @param {String} protocol + * @param {String} issuer_serial + * @param {String} issuer_name + * @param {Boolean} chain_id + * @param {String} owner_trust + * @param {Date} last_update + * @param {String} origin + * @param {Array} subkeys + * @param {Array} userids + * @param {Array} tofu + * @param {Boolean} hasSecret * @protected * @const */ @@ -504,9 +490,6 @@ const validKeyProperties = { 'fingerprint': function(value){ return isFingerprint(value); }, - 'armored': function(value){ - return typeof(value === 'string'); - }, 'revoked': function(value){ return typeof(value) === 'boolean'; }, @@ -623,4 +606,75 @@ function validateKeyData(data){ } } return key; +} + +/** + * Fetches and sets properties from gnupg + * @param {String} fingerprint + * @param {String} property to search for. + * @private + * @async + */ +function getGnupgState (fingerprint, property){ + return new Promise(function(resolve, reject) { + if (!isFingerprint(fingerprint)) { + reject(gpgme_error('KEY_INVALID')); + } else { + let msg = createMessage('keylist'); + msg.setParameter('keys', fingerprint); + msg.post().then(function(result){ + if (!result.keys || result.keys.length !== 1){ + reject(gpgme_error('KEY_INVALID')); + } else { + const key = result.keys[0]; + let result; + switch (property){ + case 'subkeys': + result = []; + if (key.subkeys.length){ + for (let i=0; i < key.subkeys.length; i++) { + result.push(Object.freeze( + new GPGME_Subkey(key.subkeys[i]))); + } + } + resolve(result); + break; + case 'userids': + result = []; + if (key.userids.length){ + for (let i=0; i< key.userids.length; i++) { + result.push(Object.freeze( + new GPGME_UserId(key.userids[i]))); + } + } + resolve(result); + break; + case 'last_update': + if (key.last_update === undefined){ + reject(gpgme_error('CONN_UNEXPECTED_ANSWER')); + } else if (key.last_update !== null){ + resolve(new Date( key.last_update * 1000)); + } else { + resolve(null); + } + break; + default: + if (!validKeyProperties.hasOwnProperty(property)){ + reject(gpgme_error('PARAM_WRONG')); + } else { + if (key.hasOwnProperty(property)){ + resolve(key[property]); + } else { + reject(gpgme_error( + 'CONN_UNEXPECTED_ANSWER')); + } + } + break; + } + } + }, function(error){ + reject(gpgme_error(error)); + }); + } + }); } \ No newline at end of file diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 43ab96c..766bab1 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -38,12 +38,11 @@ export class GPGME_Keyring { * * @param {String | Array} pattern (optional) A pattern to * search for in userIds or KeyIds. - * @param {Boolean} prepare_sync (optional) if set to true, the - * 'hasSecret' and 'armored' properties will be fetched for the Keys as - * well. These require additional calls to gnupg, resulting in a - * performance hungry operation. Calling them here enables direct, - * synchronous use of these properties for all keys, without having to - * resort to a refresh() first. + * @param {Boolean} prepare_sync (optional) if set to true, most data + * (with the exception of armored Key blocks) will be cached for the + * Keys. This enables direct, synchronous use of these properties for + * all keys. It does not check for changes on the backend. The cached + * information can be updated with the {@link Key.refresh} method. * @param {Boolean} search (optional) retrieve Keys from external * servers with the method(s) defined in gnupg (e.g. WKD/HKP lookup) * @returns {Promise>} @@ -97,7 +96,6 @@ export class GPGME_Keyring { break; } } - // TODO getArmor() to be used in sync } } let k = createKey(result.keys[i].fingerprint, diff --git a/lang/js/unittests.js b/lang/js/unittests.js index 3304b1e..25023bc 100644 --- a/lang/js/unittests.js +++ b/lang/js/unittests.js @@ -304,10 +304,6 @@ function unittests (){ expect(result).to.be.an('array'); expect(result[0]).to.be.an.instanceof(GPGME_Key); expect(result[0].get('hasSecret')).to.be.a('boolean'); - // TODO: preparing sync for armored is still in discussion - // expect(result[0].get('armored')).to.be.a('string'); - // expect(result[0].get('armored')).to.include( - // '-----END PGP PUBLIC KEY BLOCK-----'); done(); } ); commit 754e799d35fd62d7a979452f44342934659908c7 Author: Maximilian Krambach Date: Fri Aug 17 14:40:27 2018 +0200 js: disallow bulk set data on key from outside -- * src/Key.js Key class is not exported anymore, as it should not be used directly anywhere. setKeyData is no more a method of the Key, (optional) data are now validated and set on Key creation and on updates, both from within this module, thus no longer exposing setKeyData to the outside. * createKey now gained an optional parameter which allows to set Key data at this point. diff --git a/lang/js/src/Helpers.js b/lang/js/src/Helpers.js index 0fd1499..accc2af 100644 --- a/lang/js/src/Helpers.js +++ b/lang/js/src/Helpers.js @@ -22,7 +22,6 @@ */ import { gpgme_error } from './Errors'; -import { GPGME_Key } from './Key'; /** * Tries to return an array of fingerprints, either from input fingerprints or @@ -50,7 +49,7 @@ export function toKeyIdArray(input){ } } else if (typeof(input[i]) === 'object'){ let fpr = ''; - if (input[i] instanceof GPGME_Key){ + if (input[i].hasOwnProperty('fingerprint')){ fpr = input[i].fingerprint; } else if (input[i].hasOwnProperty('primaryKey') && input[i].primaryKey.hasOwnProperty('getFingerprint')){ diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index aa41905..8d7fd94 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -31,13 +31,22 @@ import { createMessage } from './Message'; * @param {Boolean} async If True, Key properties (except fingerprint) will be * queried from gnupg on each call, making the operation up-to-date, the * answers will be Promises, and the performance will likely suffer - * @returns {GPGME_Key|GPGME_Error} + * @param {Object} data additional initial properties this Key will have. Needs + * a full object as delivered by gpgme-json + * @returns {Object|GPGME_Error} The verified and updated data */ -export function createKey(fingerprint, async = false){ +export function createKey(fingerprint, async = false, data){ if (!isFingerprint(fingerprint) || typeof(async) !== 'boolean'){ return gpgme_error('PARAM_WRONG'); } - else return Object.freeze(new GPGME_Key(fingerprint, async)); + if (data !== undefined){ + data = validateKeyData(data); + } + if (data instanceof Error){ + return gpgme_error('KEY_INVALID'); + } else { + return Object.freeze(new GPGME_Key(fingerprint, async, data)); + } } /** @@ -49,9 +58,9 @@ export function createKey(fingerprint, async = false){ * * @class */ -export class GPGME_Key { +class GPGME_Key { - constructor(fingerprint, async){ + constructor(fingerprint, async, data){ /** * @property {Boolean} If true, most answers will be asynchronous @@ -59,6 +68,11 @@ export class GPGME_Key { this.isAsync = async; let _data = {fingerprint: fingerprint.toUpperCase()}; + if (data !== undefined + && data.fingerprint.toUpperCase() === _data.fingerprint + ) { + _data = data; + } this.getFingerprint = function(){ if (!_data.fingerprint || !isFingerprint(_data.fingerprint)){ return gpgme_error('KEY_INVALID'); @@ -77,54 +91,6 @@ export class GPGME_Key { return this.get('hasSecret'); }; - /** - * @param {Object} data Bulk set the data for this key, with an Object - * sent by gpgme-json. - * @returns {GPGME_Key|GPGME_Error} Itself after values have been set, - * an error if something went wrong. - * @private - */ - this.setKeyData = function (data){ - if (typeof(data) !== 'object') { - return gpgme_error('KEY_INVALID'); - } - if (!data.fingerprint || - data.fingerprint.toUpperCase() !== _data.fingerprint){ - return gpgme_error('KEY_INVALID'); - } - let keys = Object.keys(data); - for (let i=0; i< keys.length; i++){ - if (!validKeyProperties.hasOwnProperty(keys[i])){ - return gpgme_error('KEY_INVALID'); - } - //running the defined validation function - if (validKeyProperties[keys[i]](data[keys[i]]) !== true ){ - return gpgme_error('KEY_INVALID'); - } - switch (keys[i]){ - case 'subkeys': - _data.subkeys = []; - for (let i=0; i< data.subkeys.length; i++) { - _data.subkeys.push(Object.freeze( - new GPGME_Subkey(data.subkeys[i]))); - } - break; - case 'userids': - _data.userids = []; - for (let i=0; i< data.userids.length; i++) { - _data.userids.push(Object.freeze( - new GPGME_UserId(data.userids[i]))); - } - break; - case 'last_update': - _data[keys[i]] = new Date( data[keys[i]] * 1000 ); - break; - default: - _data[keys[i]] = data[keys[i]]; - } - } - return this; - }; /** * Query any property of the Key listed in {@link validKeyProperties} @@ -188,16 +154,22 @@ export class GPGME_Key { msg.setParameter('keys', _data.fingerprint); msg.post().then(function(result){ if (result.keys.length === 1){ - me.setKeyData(result.keys[0]); - me.getHasSecret().then(function(){ - me.getArmor().then(function(){ - resolve(me); + const newdata = validateKeyData( + _data.fingerprint, result.keys[0]); + if (newdata instanceof Error){ + reject(gpgme_error('KEY_INVALID')); + } else { + _data = newdata; + me.getHasSecret().then(function(){ + me.getArmor().then(function(){ + resolve(me); + }, function(error){ + reject(error); + }); }, function(error){ reject(error); }); - }, function(error){ - reject(error); - }); + } } else { reject(gpgme_error('KEY_NOKEY')); } @@ -602,3 +574,53 @@ const validKeyProperties = { } }; + +/** +* sets the Key data in bulk. It can only be used from inside a Key, either +* during construction or on a refresh callback. +* @param {Object} key the original internal key data. +* @param {Object} data Bulk set the data for this key, with an Object structure +* as sent by gpgme-json. +* @returns {Object|GPGME_Error} the changed data after values have been set, +* an error if something went wrong. +* @private +*/ +function validateKeyData(data){ + const key = {}; + if ( typeof(data) !== 'object' + || !data.fingerprint){ + return gpgme_error('KEY_INVALID'); + } + let props = Object.keys(data); + for (let i=0; i< props.length; i++){ + if (!validKeyProperties.hasOwnProperty(props[i])){ + return gpgme_error('KEY_INVALID'); + } + // running the defined validation function + if (validKeyProperties[props[i]](data[props[i]]) !== true ){ + return gpgme_error('KEY_INVALID'); + } + switch (props[i]){ + case 'subkeys': + key.subkeys = []; + for (let i=0; i< data.subkeys.length; i++) { + key.subkeys.push(Object.freeze( + new GPGME_Subkey(data.subkeys[i]))); + } + break; + case 'userids': + key.userids = []; + for (let i=0; i< data.userids.length; i++) { + key.userids.push(Object.freeze( + new GPGME_UserId(data.userids[i]))); + } + break; + case 'last_update': + key[props[i]] = new Date( data[props[i]] * 1000 ); + break; + default: + key[props[i]] = data[props[i]]; + } + } + return key; +} \ No newline at end of file diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index a678798..43ab96c 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -100,8 +100,8 @@ export class GPGME_Keyring { // TODO getArmor() to be used in sync } } - let k = createKey(result.keys[i].fingerprint); - k.setKeyData(result.keys[i]); + let k = createKey(result.keys[i].fingerprint, + !prepare_sync, result.keys[i]); resultset.push(k); } resolve(resultset); @@ -170,7 +170,7 @@ export class GPGME_Keyring { * @async * @static */ - this.getDefaultKey = function() { + this.getDefaultKey = function(prepare_sync = false) { let me = this; return new Promise(function(resolve, reject){ let msg = createMessage('config_opt'); @@ -202,8 +202,9 @@ export class GPGME_Keyring { for (let i=0; i< result.keys.length; i++ ) { if (result.keys[i].invalid === false) { let k = createKey( - result.keys[i].fingerprint); - k.setKeyData(result.keys[i]); + result.keys[i].fingerprint, + !prepare_sync, + result.keys[i]); resolve(k); break; } else if (i === result.keys.length - 1){ ----------------------------------------------------------------------- Summary of changes: lang/js/src/Errors.js | 4 + lang/js/src/Helpers.js | 3 +- lang/js/src/Key.js | 358 ++++++++++++++++++++++++++++++------------------- lang/js/src/Keyring.js | 23 ++-- lang/js/unittests.js | 4 - 5 files changed, 233 insertions(+), 159 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 17 17:13:06 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 17 Aug 2018 17:13:06 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-96-g3fb094a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 3fb094a9b8c320fc10e537a9bb5fab34807f4e52 (commit) from ad39d54d192864b54a155bf5f94d5b6bb3e8612a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3fb094a9b8c320fc10e537a9bb5fab34807f4e52 Author: Maximilian Krambach Date: Fri Aug 17 17:14:51 2018 +0200 js: small documentation fix -- diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index 5d0c816..ea6fd88 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -179,12 +179,13 @@ class GPGME_Key { }; /** - * Find out if the Key includes a secret part. Note that this is a - * rather nonperformant operation. - * If you want this inforrmation about more than a few Keys, it may be - * advisable to run {@link Keyring.getKeys} instead. - * @returns {Promise} True if a secret/private Key - * is available in the gnupg Keyring + * Find out if the Key is part of a Key pair including public and + * private key(s). If you want this information about more than a few + * Keys in synchronous mode, it may be advisable to run + * {@link Keyring.getKeys} instead, as it performs faster in bulk + * querying this state. + * @returns {Promise} True if a private Key is + * available in the gnupg Keyring. * @async */ this.getGnupgSecretState = function (){ ----------------------------------------------------------------------- Summary of changes: lang/js/src/Key.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 17 17:22:00 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 17 Aug 2018 17:22:00 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-97-g8e87790 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 8e87790db3499b1625fd65f3272192df47b5dfd0 (commit) from 3fb094a9b8c320fc10e537a9bb5fab34807f4e52 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8e87790db3499b1625fd65f3272192df47b5dfd0 Author: Maximilian Krambach Date: Fri Aug 17 17:20:35 2018 +0200 js: don't expire new keys if no date is set -- * src/Keyring.js A new Key without expiration is documented as 'never expire' here, and should behave accordingly. This requires sending '0' here. diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 766bab1..d18fb64 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -390,6 +390,8 @@ export class GPGME_Keyring { if (expires){ msg.setParameter('expires', Math.floor(expires.valueOf()/1000)); + } else { + msg.setParameter('expires', 0); } msg.post().then(function(response){ me.getKeys(response.fingerprint, true).then( ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 17 17:43:27 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 17 Aug 2018 17:43:27 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-98-g5b0f823 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 5b0f8230b2172bffcb3a3b629a75c9cf1a50a3d8 (commit) from 8e87790db3499b1625fd65f3272192df47b5dfd0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5b0f8230b2172bffcb3a3b629a75c9cf1a50a3d8 Author: Maximilian Krambach Date: Fri Aug 17 17:44:06 2018 +0200 js: decrypt callback is_mime fix -- * src/gpgmejs: is_mime should report its' counterpart. Also, file_name is not optional in specification. We'll send null if there is no file_name diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 9154979..1816436 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -193,9 +193,11 @@ export class GpgME { msg.post().then(function(result){ let _result = {data: result.data}; _result.base64 = result.base64 ? true: false; - _result.is_mime = result.mime ? true: false; + _result.is_mime = result.is_mime ? true: false; if (result.file_name){ _result.file_name = result.file_name; + } else { + _result.file_name = null; } if ( result.hasOwnProperty('signatures') && ----------------------------------------------------------------------- Summary of changes: lang/js/src/gpgmejs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 17 17:54:22 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 17 Aug 2018 17:54:22 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-99-gfff365f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via fff365ffc583ef87ac585df2ac84fd8586202b8e (commit) from 5b0f8230b2172bffcb3a3b629a75c9cf1a50a3d8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fff365ffc583ef87ac585df2ac84fd8586202b8e Author: Maximilian Krambach Date: Fri Aug 17 17:55:11 2018 +0200 js: expect additional 'info' to arrive on decrypt, too -- * src/permittedOperations.js: if decrypt includes a verification, this info needs to pass, too. diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js index 1c28ab8..676ebaf 100644 --- a/lang/js/src/permittedOperations.js +++ b/lang/js/src/permittedOperations.js @@ -166,7 +166,8 @@ export const permittedOperations = { type: ['signature', 'ciphertext'], data: { 'data': 'string', - 'base64':'boolean' + 'base64':'boolean', + 'info': 'object' } } ----------------------------------------------------------------------- Summary of changes: lang/js/src/permittedOperations.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 17 18:26:10 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 17 Aug 2018 18:26:10 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-100-g3cbafb9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 3cbafb97ec4d94c1b9a2232a74f19f432ba67384 (commit) from fff365ffc583ef87ac585df2ac84fd8586202b8e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3cbafb97ec4d94c1b9a2232a74f19f432ba67384 Author: Maximilian Krambach Date: Fri Aug 17 18:25:57 2018 +0200 js: correct decrypt result info (2) -- * the permittedOperation from last commit ended up in the wrong place. sign does not return an additional 'info' object. diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js index 676ebaf..f9145da 100644 --- a/lang/js/src/permittedOperations.js +++ b/lang/js/src/permittedOperations.js @@ -127,7 +127,8 @@ export const permittedOperations = { 'data': 'string', 'base64': 'boolean', 'mime': 'boolean', - 'signatures': 'object' + 'signatures': 'object', + 'info': 'object' } } }, @@ -166,8 +167,7 @@ export const permittedOperations = { type: ['signature', 'ciphertext'], data: { 'data': 'string', - 'base64':'boolean', - 'info': 'object' + 'base64':'boolean' } } ----------------------------------------------------------------------- Summary of changes: lang/js/src/permittedOperations.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 17 19:27:59 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 17 Aug 2018 19:27:59 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-101-g74684f2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 74684f24c663af12c88b196fecd5f44863b893e4 (commit) from 3cbafb97ec4d94c1b9a2232a74f19f432ba67384 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 74684f24c663af12c88b196fecd5f44863b893e4 Author: Maximilian Krambach Date: Fri Aug 17 19:20:35 2018 +0200 js: decode arriving gpg message strings -- * Arriving strings (i.e. user id names, error messages) are not always in javascript encoding. This is an attempt to go through the whole gpgme answer (with the exception of payload data) and to fix the encoding of these diff --git a/lang/js/BrowserTestExtension/tests/KeyInfos.js b/lang/js/BrowserTestExtension/tests/KeyInfos.js index 03773a4..1829f22 100644 --- a/lang/js/BrowserTestExtension/tests/KeyInfos.js +++ b/lang/js/BrowserTestExtension/tests/KeyInfos.js @@ -22,7 +22,7 @@ */ /* global describe, it, expect, before, Gpgmejs */ -/* global inputvalues, fixedLengthString */ +/* global inputvalues*/ describe('Key information', function () { let context = null; @@ -43,4 +43,15 @@ describe('Key information', function () { done(); }); }); + + it('A userId keeps their encoding', function(done){ + context.Keyring.importKey(inputvalues.publicKeyNonAscii.key, true) + .then(function(result){ + expect(result.Keys[0]).to.be.an('object'); + const user = result.Keys[0].key.get('userids')[0]; + expect(user.get('name')).to.equal( + inputvalues.publicKeyNonAscii.userid); + done(); + }); + }); }); \ No newline at end of file diff --git a/lang/js/BrowserTestExtension/tests/inputvalues.js b/lang/js/BrowserTestExtension/tests/inputvalues.js index 7dda47c..b33d985 100644 --- a/lang/js/BrowserTestExtension/tests/inputvalues.js +++ b/lang/js/BrowserTestExtension/tests/inputvalues.js @@ -89,7 +89,40 @@ const inputvalues = {// eslint-disable-line no-unused-vars '-----END PGP SIGNATURE-----\n', }, - someInputParameter: 'bad string' + someInputParameter: 'bad string', + + publicKeyNonAscii: { + userid: 'M?ller ?uro', + key: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + '\n' + + 'mQENBFt2/VIBCADIWBIMxExZlHda4XIVnM9nsIfUYLebJSC/krEriyWgzytU8/fQ\n' + + 'S05cfnYx7RXvOOq4k8aa7mu80ovg3q77idXauLreAUwng4Njw0nMxWq/vtoMiZ60\n' + + '9f8EmfthZophhkQF2HIPHyqXMDZzMLWv4oTr2UJ9BKudL1XtbK51y9TbiyfQygBl\n' + + '8bl+zrOo70/dN6aunvuo6Hlu5cEzkj2QrzZlqTdfG5qv6KVEMut1eAbxZAmvSnna\n' + + 'R4wqiRCT3/eRXGJbDL/8GaCEYkwi9FBrimjOTV0MpcLNwAU4aGfDxMUsxML9xJ+/\n' + + '/6GFxzYf7Lmk5UhvoewR58uQkHkTVPjZ9hXZABEBAAG0KE3DvGxsZXIg4oKsdXJv\n' + + 'IDxtdWVsbGVyZXVyb0BleGFtcGxlLm9yZz6JAVQEEwEIAD4WIQQVNixp3XT/DuGT\n' + + 'F4MFmkL4L5UZdAUCW3b9UgIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIeAQIX\n' + + 'gAAKCRAFmkL4L5UZdAhiCACowW1aC8DYGtJyAaBO2MqWhyw1wVCbQN9uFsQZPydY\n' + + 'v3BEbCDrRc0HyfV1PVoRQsgkiNMes1S2tz2IMJoEOTMaz3WjPM8yK0dDbo5sfx/o\n' + + '/XaXeKhyYNqRkz2dPzorg1sHyHe0ki/HoQiANEJ8mByMtlwnPWlhnINAX+27eL17\n' + + 'JC8juhBYUchqoIBAl+ajYKSThdLzrUkcL7QfJjZb3pPytJSTTdFc0rD6ERDbfXXc\n' + + '/vnE2SDYme+XXn7H5tNe67tPM8M96vbp+uM+n2t/z96C+Pqb6GJFMBa35PM+/qQO\n' + + 'yr0I2oaQnTecx2AfBXGZvd81wMYikAJ9rAOWyMQZHJWouQENBFt2/VIBCADXCvKD\n' + + '3wRWCOzRWtLTs7hpAjCDxp6niPkwxKuUf9r/sUPmn0pWdZHYlbPDev9psN9bnJ+C\n' + + '+wzzPZ1zgSYKIAN0IMoh0L7BRAoau7VWQ3Q7hP6HIbdzOTEGyklSoh9pIh6IlwZZ\n' + + 'XfPlFlnn7FeH1UeA711E174SUpDRKYSfT+mFObQUuQewGi9QC3gBsz5MPLQQLzML\n' + + 'yimIOT+8i64fHHSKChw5ZDckBffej31/YHPQ7+JsWFV+G/6xDfbwnaFZFAUwo+1L\n' + + '4w9UiMyCNkIWCkulzJ2Hbz66xzFMi/8zMYxr08Af+PpsXaWTQHAa5V4GNJSInDEB\n' + + '7gy/CGLcY90EozoDABEBAAGJATwEGAEIACYWIQQVNixp3XT/DuGTF4MFmkL4L5UZ\n' + + 'dAUCW3b9UgIbDAUJA8JnAAAKCRAFmkL4L5UZdPqoB/9kpqxqa82k7JMcq7UiwQY7\n' + + 'CdqCUPKF88ciOWKBpZmpl8V7zgM7kEXwmM6ocHcznXi8xM7eOfDIJcBeqFVIE4OT\n' + + '63OCMuvZICM9Kiu48wLNAw5W/YGAOBH7ySQzZM2XrtvwfFtJ3lR00t5f4FVtriA5\n' + + '47BjYYG5tTdJc8HwEHs045S99xKCWqwuDgO9qskIi6iPePUkuhpaVBLuEj2Goku6\n' + + 'i8aql/vKYQS67L7UHJiEbjLe+wP9k3FvWUFTx39lAubsDzb4Abhe+qRqs2TKD7Go\n' + + 'k35ZriRIYllmx4c9KyWL7Mvzcp+84Sq9LeMfsN4JstBDJ7jn6g19SjO5dmtxSuP0\n' + + '=zZSJ\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n' + } }; // (Pseudo-)Random String covering all of utf8. diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index b010575..8d381f1 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -26,6 +26,7 @@ import { permittedOperations } from './permittedOperations'; import { gpgme_error } from './Errors'; import { GPGME_Message, createMessage } from './Message'; +import { decode } from './Helpers'; /** * A Connection handles the nativeMessaging interaction via a port. As the @@ -239,7 +240,7 @@ class Answer{ case 'type': if (_decodedResponse.type === 'error'){ return (gpgme_error('GNUPG_ERROR', - decodeURIComponent(escape(_decodedResponse.msg)))); + decode(_decodedResponse.msg))); } else if (poa.type.indexOf(_decodedResponse.type) < 0){ return gpgme_error('CONN_UNEXPECTED_ANSWER'); } @@ -270,7 +271,7 @@ class Answer{ ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); } else { - _response[key] = _decodedResponse[key]; + _response[key] = decode(_decodedResponse[key]); } break; } diff --git a/lang/js/src/Helpers.js b/lang/js/src/Helpers.js index accc2af..379015f 100644 --- a/lang/js/src/Helpers.js +++ b/lang/js/src/Helpers.js @@ -108,3 +108,30 @@ export function isFingerprint(value){ export function isLongId(value){ return hextest(value, 16); } + +/** + * Recursively decodes input (utf8) to output (utf-16; javascript) strings + * @param {Object | Array | String} property + */ +export function decode(property){ + if (typeof property === 'string'){ + return decodeURIComponent(escape(property)); + } else if (Array.isArray(property)){ + let res = []; + for (let arr=0; arr < property.length; arr++){ + res.push(decode(property[arr])); + } + return res; + } else if (typeof property === 'object'){ + const keys = Object.keys(property); + if (keys.length){ + let res = {}; + for (let k=0; k < keys.length; k++ ){ + res[keys[k]] = decode(property[keys[k]]); + } + return res; + } + return property; + } + return property; +} \ No newline at end of file ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/tests/KeyInfos.js | 13 ++++++++- lang/js/BrowserTestExtension/tests/inputvalues.js | 35 ++++++++++++++++++++++- lang/js/src/Connection.js | 5 ++-- lang/js/src/Helpers.js | 27 +++++++++++++++++ 4 files changed, 76 insertions(+), 4 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Sat Aug 18 07:08:17 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Sat, 18 Aug 2018 07:08:17 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-120-g7962cde Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 7962cde13c5cbdc643bbde795e2c29e638dfc186 (commit) from 279cac0ffbb3d865d997dc7fc9c1b53bbb55d3a2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7962cde13c5cbdc643bbde795e2c29e638dfc186 Author: Ben McGinnes Date: Sat Aug 18 15:05:34 2018 +1000 Python bindings src: PEP8 compliance * import namespace clearance for src/*.py. * Fixed a handful of is/is not None checks as well. diff --git a/lang/python/src/__init__.py b/lang/python/src/__init__.py index 82c1cce..30e638c 100644 --- a/lang/python/src/__init__.py +++ b/lang/python/src/__init__.py @@ -95,7 +95,6 @@ GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/ """ from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from . import core from . import errors @@ -106,6 +105,8 @@ from . import version from .core import Context from .core import Data +del absolute_import, print_function, unicode_literals + # Interface hygiene. # Drop the low-level gpgme that creeps in for some reason. diff --git a/lang/python/src/callbacks.py b/lang/python/src/callbacks.py index e8a9c43..9aacf56 100644 --- a/lang/python/src/callbacks.py +++ b/lang/python/src/callbacks.py @@ -16,17 +16,18 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from getpass import getpass +del absolute_import, print_function, unicode_literals + def passphrase_stdin(hint, desc, prev_bad, hook=None): """This is a sample callback that will read a passphrase from the terminal. The hook here, if present, will be used to describe why the passphrase is needed.""" why = '' - if hook != None: + if hook is not None: why = ' ' + hook if prev_bad: why += ' (again)' @@ -35,7 +36,7 @@ def passphrase_stdin(hint, desc, prev_bad, hook=None): def progress_stdout(what, type, current, total, hook=None): - print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" %\ + print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" % (what, type, current, total)) diff --git a/lang/python/src/core.py b/lang/python/src/core.py index 7858468..d471131 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import re import os @@ -14,6 +13,8 @@ from . import constants from . import errors from . import util +del absolute_import, print_function, unicode_literals + # Copyright (C) 2016-2018 g10 Code GmbH # Copyright (C) 2004, 2008 Igor Belyi # Copyright (C) 2002 John Goerzen diff --git a/lang/python/src/errors.py b/lang/python/src/errors.py index 45157c5..9c7f037 100644 --- a/lang/python/src/errors.py +++ b/lang/python/src/errors.py @@ -17,11 +17,12 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from . import gpgme from . import util +del absolute_import, print_function, unicode_literals + # To appease static analysis tools, we define some constants here. # They are overwritten with the proper values by process_constants. NO_ERROR = None @@ -64,33 +65,33 @@ class GpgError(Exception): @property def code(self): - if self.error == None: + if self.error is None: return None return gpgme.gpgme_err_code(self.error) @property def code_str(self): - if self.error == None: + if self.error is None: return None return gpgme.gpgme_strerror(self.error) @property def source(self): - if self.error == None: + if self.error is None: return None return gpgme.gpgme_err_source(self.error) @property def source_str(self): - if self.error == None: + if self.error is None: return None return gpgme.gpgme_strsource(self.error) def __str__(self): msgs = [] - if self.context != None: + if self.context is not None: msgs.append(self.context) - if self.error != None: + if self.error is not None: msgs.append(self.source_str) msgs.append(self.code_str) return ': '.join(msgs) diff --git a/lang/python/src/util.py b/lang/python/src/util.py index 77d1421..320a823 100644 --- a/lang/python/src/util.py +++ b/lang/python/src/util.py @@ -17,10 +17,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys +del absolute_import, print_function, unicode_literals + def process_constants(prefix, scope): """Called by the constant modules to load up the constants from the C ----------------------------------------------------------------------- Summary of changes: lang/python/src/__init__.py | 3 ++- lang/python/src/callbacks.py | 7 ++++--- lang/python/src/core.py | 3 ++- lang/python/src/errors.py | 15 ++++++++------- lang/python/src/util.py | 3 ++- 5 files changed, 18 insertions(+), 13 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Sat Aug 18 07:47:00 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Sat, 18 Aug 2018 07:47:00 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-121-g8a6a73b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 8a6a73b9c4f92b159450edb5e4a780fc7389ca82 (commit) from 7962cde13c5cbdc643bbde795e2c29e638dfc186 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8a6a73b9c4f92b159450edb5e4a780fc7389ca82 Author: Ben McGinnes Date: Sat Aug 18 15:36:23 2018 +1000 Python bindings constants: PEP8 compliance (almost) * PEP8 compliance for all constants except the globals in src/constants/__init__.py depending on whether the import sequence affects the globals themselves. diff --git a/lang/python/src/constants/__init__.py b/lang/python/src/constants/__init__.py index da37395..7a953aa 100644 --- a/lang/python/src/constants/__init__.py +++ b/lang/python/src/constants/__init__.py @@ -18,15 +18,19 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util +# Globals may need to be set prior to module import, if so this prevents PEP8 +# compliance, but better that than code breakage. util.process_constants('GPGME_', globals()) -del util # For convenience, we import the modules here. from . import data, keylist, sig, tofu # The subdirs. -from . import create, event, keysign, md, pk, protocol, sigsum, status, validity +# The remaining modules can no longer fit on one line. +from . import create, event, keysign, md, pk, protocol, sigsum, status +from . import validity + +del absolute_import, print_function, unicode_literals, util # A complication arises because 'import' is a reserved keyword. # Import it as 'Import' instead. diff --git a/lang/python/src/constants/create.py b/lang/python/src/constants/create.py index 132e96d..382dad9 100644 --- a/lang/python/src/constants/create.py +++ b/lang/python/src/constants/create.py @@ -18,8 +18,7 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_CREATE_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/data/__init__.py b/lang/python/src/constants/data/__init__.py index b864b7c..c085667 100644 --- a/lang/python/src/constants/data/__init__.py +++ b/lang/python/src/constants/data/__init__.py @@ -1,5 +1,6 @@ from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from . import encoding __all__ = ['encoding'] + +del absolute_import, print_function, unicode_literals diff --git a/lang/python/src/constants/data/encoding.py b/lang/python/src/constants/data/encoding.py index e76a22e..9afa732 100644 --- a/lang/python/src/constants/data/encoding.py +++ b/lang/python/src/constants/data/encoding.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_DATA_ENCODING_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/event.py b/lang/python/src/constants/event.py index 1b14d1d..9f9273d 100644 --- a/lang/python/src/constants/event.py +++ b/lang/python/src/constants/event.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_EVENT_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/import.py b/lang/python/src/constants/import.py index 47c296c..e477eb2 100644 --- a/lang/python/src/constants/import.py +++ b/lang/python/src/constants/import.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_IMPORT_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/keylist/__init__.py b/lang/python/src/constants/keylist/__init__.py index 9d1e2d5..fa8f7f0 100644 --- a/lang/python/src/constants/keylist/__init__.py +++ b/lang/python/src/constants/keylist/__init__.py @@ -1,5 +1,6 @@ from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from . import mode __all__ = ['mode'] + +del absolute_import, print_function, unicode_literals diff --git a/lang/python/src/constants/keylist/mode.py b/lang/python/src/constants/keylist/mode.py index 39e1819..bda7710 100644 --- a/lang/python/src/constants/keylist/mode.py +++ b/lang/python/src/constants/keylist/mode.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_KEYLIST_MODE_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/keysign.py b/lang/python/src/constants/keysign.py index fccdbc4..328dfb9 100644 --- a/lang/python/src/constants/keysign.py +++ b/lang/python/src/constants/keysign.py @@ -18,8 +18,7 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_KEYSIGN_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/md.py b/lang/python/src/constants/md.py index f3e8bbd..068b31d 100644 --- a/lang/python/src/constants/md.py +++ b/lang/python/src/constants/md.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_MD_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/pk.py b/lang/python/src/constants/pk.py index 6bf2a21..3a826d1 100644 --- a/lang/python/src/constants/pk.py +++ b/lang/python/src/constants/pk.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_PK_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/protocol.py b/lang/python/src/constants/protocol.py index d086bbd..cc9ca07 100644 --- a/lang/python/src/constants/protocol.py +++ b/lang/python/src/constants/protocol.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_PROTOCOL_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/sig/__init__.py b/lang/python/src/constants/sig/__init__.py index fc34f8e..f45af00 100644 --- a/lang/python/src/constants/sig/__init__.py +++ b/lang/python/src/constants/sig/__init__.py @@ -1,5 +1,6 @@ from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from . import mode, notation __all__ = ['mode', 'notation'] + +del absolute_import, print_function, unicode_literals diff --git a/lang/python/src/constants/sig/mode.py b/lang/python/src/constants/sig/mode.py index 0f4f0ef..3a2d17a 100644 --- a/lang/python/src/constants/sig/mode.py +++ b/lang/python/src/constants/sig/mode.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_SIG_MODE_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/sig/notation.py b/lang/python/src/constants/sig/notation.py index 9a79e01..9e56be3 100644 --- a/lang/python/src/constants/sig/notation.py +++ b/lang/python/src/constants/sig/notation.py @@ -18,8 +18,7 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_SIG_NOTATION_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/sigsum.py b/lang/python/src/constants/sigsum.py index 09ef9d7..0fe0e77 100644 --- a/lang/python/src/constants/sigsum.py +++ b/lang/python/src/constants/sigsum.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_SIGSUM_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/tofu/__init__.py b/lang/python/src/constants/tofu/__init__.py index 819a58b..5e58a6a 100644 --- a/lang/python/src/constants/tofu/__init__.py +++ b/lang/python/src/constants/tofu/__init__.py @@ -18,7 +18,8 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from . import policy __all__ = ['policy'] + +del absolute_import, print_function, unicode_literals diff --git a/lang/python/src/constants/tofu/policy.py b/lang/python/src/constants/tofu/policy.py index 5a61f06..53d853d 100644 --- a/lang/python/src/constants/tofu/policy.py +++ b/lang/python/src/constants/tofu/policy.py @@ -18,8 +18,7 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_TOFU_POLICY_', globals()) -del util +del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/validity.py b/lang/python/src/constants/validity.py index d3c5345..4ecf4ec 100644 --- a/lang/python/src/constants/validity.py +++ b/lang/python/src/constants/validity.py @@ -16,8 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals from gpg import util util.process_constants('GPGME_VALIDITY_', globals()) -del util +del absolute_import, print_function, unicode_literals, util ----------------------------------------------------------------------- Summary of changes: lang/python/src/constants/__init__.py | 10 +++++++--- lang/python/src/constants/create.py | 3 +-- lang/python/src/constants/data/__init__.py | 3 ++- lang/python/src/constants/data/encoding.py | 3 +-- lang/python/src/constants/event.py | 3 +-- lang/python/src/constants/import.py | 3 +-- lang/python/src/constants/keylist/__init__.py | 3 ++- lang/python/src/constants/keylist/mode.py | 3 +-- lang/python/src/constants/keysign.py | 3 +-- lang/python/src/constants/md.py | 3 +-- lang/python/src/constants/pk.py | 3 +-- lang/python/src/constants/protocol.py | 3 +-- lang/python/src/constants/sig/__init__.py | 3 ++- lang/python/src/constants/sig/mode.py | 3 +-- lang/python/src/constants/sig/notation.py | 3 +-- lang/python/src/constants/sigsum.py | 3 +-- lang/python/src/constants/tofu/__init__.py | 3 ++- lang/python/src/constants/tofu/policy.py | 3 +-- lang/python/src/constants/validity.py | 3 +-- 19 files changed, 29 insertions(+), 35 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Sat Aug 18 10:21:35 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Sat, 18 Aug 2018 10:21:35 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-122-gfc55cac Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via fc55caccfc87253e1703df66b21917cc399fba62 (commit) from 8a6a73b9c4f92b159450edb5e4a780fc7389ca82 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fc55caccfc87253e1703df66b21917cc399fba62 Author: Ben McGinnes Date: Sat Aug 18 18:19:16 2018 +1000 Python bindings setup: Near PEP8 compliance * lang/python/version.py.in: Fixed most things, but there's still an issue near the build portion with the existing Python bugs referenced. * lang/python/setup.py.in: Now PEP8 compliant. diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index 0622b61..4767e14 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (C) 2016-2017 g10 Code GmbH +# Copyright (C) 2016-2018 g10 Code GmbH # Copyright (C) 2004,2008 Igor Belyi # Copyright (C) 2002 John Goerzen # @@ -19,11 +19,14 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from distutils.core import setup, Extension -import os, os.path, sys + import glob +import os +import os.path import re import shutil import subprocess +import sys # Out-of-tree build of the gpg bindings. gpg_error_config = ["gpg-error-config"] @@ -40,9 +43,11 @@ top_builddir = os.environ.get("top_builddir") if top_builddir: # In-tree build. in_tree = True - gpgme_config = [os.path.join(top_builddir, "src/gpgme-config")] + gpgme_config_flags + gpgme_config = [os.path.join(top_builddir, "src/gpgme-config") + ] + gpgme_config_flags gpgme_h = os.path.join(top_builddir, "src/gpgme.h") - library_dirs = [os.path.join(top_builddir, "src/.libs")] # XXX uses libtool internals + library_dirs = [os.path.join(top_builddir, + "src/.libs")] # XXX uses libtool internals extra_macros.update( HAVE_CONFIG_H=1, HAVE_DATA_H=1, @@ -55,17 +60,18 @@ else: devnull = open(os.devnull, "w") try: - subprocess.check_call(gpgme_config + ['--version'], - stdout=devnull) + subprocess.check_call(gpgme_config + ['--version'], stdout=devnull) except: sys.exit("Could not find gpgme-config. " + "Please install the libgpgme development package.") + def getconfig(what, config=gpgme_config): - confdata = subprocess.Popen(config + ["--%s" % what], - stdout=subprocess.PIPE).communicate()[0] + confdata = subprocess.Popen( + config + ["--%s" % what], stdout=subprocess.PIPE).communicate()[0] return [x for x in confdata.decode('utf-8').split() if x != ''] + version = version_raw = getconfig("version")[0] if '-' in version: version = version.split('-')[0] @@ -90,7 +96,7 @@ for item in getconfig('cflags'): include_dirs.append(item[2:]) elif item.startswith("-D"): defitem = item[2:].split("=", 1) - if len(defitem)==2: + if len(defitem) == 2: define_macros.append((defitem[0], defitem[1])) else: define_macros.append((defitem[0], None)) @@ -98,49 +104,59 @@ for item in getconfig('cflags'): # Adjust include and library locations in case of win32 uname_s = os.popen("uname -s").read() if uname_s.startswith("MINGW32"): - mnts = [x.split()[0:3:2] for x in os.popen("mount").read().split("\n") if x] - tmplist = sorted([(len(x[1]), x[1], x[0]) for x in mnts]) - tmplist.reverse() - extra_dirs = [] - for item in include_dirs: - for ln, mnt, tgt in tmplist: - if item.startswith(mnt): - item = os.path.normpath(item[ln:]) - while item[0] == os.path.sep: - item = item[1:] - extra_dirs.append(os.path.join(tgt, item)) - break - include_dirs += extra_dirs - for item in [x[2:] for x in libs if x.startswith("-L")]: - for ln, mnt, tgt in tmplist: - if item.startswith(mnt): - item = os.path.normpath(item[ln:]) - while item[0] == os.path.sep: - item = item[1:] - library_dirs.append(os.path.join(tgt, item)) - break + mnts = [ + x.split()[0:3:2] for x in os.popen("mount").read().split("\n") if x + ] + tmplist = sorted([(len(x[1]), x[1], x[0]) for x in mnts]) + tmplist.reverse() + extra_dirs = [] + for item in include_dirs: + for ln, mnt, tgt in tmplist: + if item.startswith(mnt): + item = os.path.normpath(item[ln:]) + while item[0] == os.path.sep: + item = item[1:] + extra_dirs.append(os.path.join(tgt, item)) + break + include_dirs += extra_dirs + for item in [x[2:] for x in libs if x.startswith("-L")]: + for ln, mnt, tgt in tmplist: + if item.startswith(mnt): + item = os.path.normpath(item[ln:]) + while item[0] == os.path.sep: + item = item[1:] + library_dirs.append(os.path.join(tgt, item)) + break + def in_srcdir(name): return os.path.join(os.environ.get("srcdir", ""), name) + + def up_to_date(source, target): - return (os.path.exists(target) - and os.path.getmtime(source) <= os.path.getmtime(target)) + return (os.path.exists(target) and + os.path.getmtime(source) <= os.path.getmtime(target)) + # We build an Extension using SWIG, which generates a Python module. # By default, the 'build_py' step is run before 'build_ext', and # therefore the generated Python module is not copied into the build # directory. -# Bug: http://bugs.python.org/issue1016626 +# Bugs: https://bugs.python.org/issue1016626 +# https://bugs.python.org/issue2624 # Workaround: -# http://stackoverflow.com/questions/12491328/python-distutils-not-include-the-swig-generated-module +# https://stackoverflow.com/questions/12491328/python-distutils-not-include-the-swig-generated-module from distutils.command.build import build -class BuildExtFirstHack(build): + +class BuildExtFirstHack(build): def _read_header(self, header, cflags): tmp_include = self._in_build_base("include1.h") with open(tmp_include, 'w') as f: f.write("#include <%s>" % header) - return subprocess.check_output(os.environ.get('CPP', 'cc -E').split() + cflags + [tmp_include]).decode('utf-8') + return subprocess.check_output( + os.environ.get('CPP', 'cc -E').split() + cflags + + [tmp_include]).decode('utf-8') def _write_if_unchanged(self, target, content): if os.path.exists(target): @@ -158,13 +174,14 @@ class BuildExtFirstHack(build): def _generate_errors_i(self): try: - subprocess.check_call(gpg_error_config + ['--version'], - stdout=devnull) + subprocess.check_call( + gpg_error_config + ['--version'], stdout=devnull) except: sys.exit("Could not find gpg-error-config. " + "Please install the libgpg-error development package.") - gpg_error_content = self._read_header("gpg-error.h", getconfig("cflags", config=gpg_error_config)) + gpg_error_content = self._read_header( + "gpg-error.h", getconfig("cflags", config=gpg_error_config)) filter_re = re.compile(r'GPG_ERR_[^ ]* =') rewrite_re = re.compile(r' *(.*) = .*') @@ -173,9 +190,11 @@ class BuildExtFirstHack(build): for line in gpg_error_content.splitlines(): if not filter_re.search(line): continue - errors_i_content += rewrite_re.sub(r'%constant long \1 = \1;'+'\n', line.strip()) + errors_i_content += rewrite_re.sub( + r'%constant long \1 = \1;' + '\n', line.strip()) - self._write_if_unchanged(self._in_build_base("errors.i"), errors_i_content) + self._write_if_unchanged( + self._in_build_base("errors.i"), errors_i_content) def _in_build_base(self, name): return os.path.join(self.build_base, name) @@ -191,7 +210,8 @@ class BuildExtFirstHack(build): # Copy due to http://bugs.python.org/issue2624 # Avoid creating in srcdir for source, target in ((in_srcdir(n), self._in_build_base(n)) - for n in ('gpgme.i', 'helpers.c', 'private.h', 'helpers.h')): + for n in ('gpgme.i', 'helpers.c', 'private.h', + 'helpers.h')): if not up_to_date(source, target): shutil.copy2(source, target) @@ -203,53 +223,60 @@ class BuildExtFirstHack(build): def run(self): self._generate() - swig_sources.extend((self._in_build_base('gpgme.i'), self._in_build_base('helpers.c'))) - swig_opts.extend(['-I' + self.build_base, - '-outdir', os.path.join(self.build_lib, 'gpg')]) + swig_sources.extend((self._in_build_base('gpgme.i'), + self._in_build_base('helpers.c'))) + swig_opts.extend([ + '-I' + self.build_base, '-outdir', + os.path.join(self.build_lib, 'gpg') + ]) include_dirs.insert(0, self.build_base) self.run_command('build_ext') build.run(self) + py3 = [] if sys.version_info.major < 3 else ['-py3'] swig_sources = [] swig_opts = ['-threads'] + py3 + extra_swig_opts -swige = Extension("gpg._gpgme", - sources = swig_sources, - swig_opts = swig_opts, - include_dirs = include_dirs, - define_macros = define_macros, - library_dirs = library_dirs, - extra_link_args = libs) - -setup(name="gpg", - cmdclass={'build': BuildExtFirstHack}, - version="@VERSION@", - description='Python bindings for GPGME GnuPG cryptography library', - # XXX add a long description - #long_description=long_description, - author='The GnuPG hackers', - author_email='gnupg-devel at gnupg.org', - url='https://www.gnupg.org', - ext_modules=[swige], - packages = ['gpg', 'gpg.constants', 'gpg.constants.data', - 'gpg.constants.keylist', 'gpg.constants.sig', - 'gpg.constants.tofu'], - license="LGPL2.1+ (the library), GPL2+ (tests and examples)", - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Operating System :: POSIX', - 'Operating System :: Microsoft :: Windows', - 'Topic :: Communications :: Email', - 'Topic :: Security :: Cryptography', - ], +swige = Extension( + "gpg._gpgme", + sources=swig_sources, + swig_opts=swig_opts, + include_dirs=include_dirs, + define_macros=define_macros, + library_dirs=library_dirs, + extra_link_args=libs) + +setup( + name="gpg", + cmdclass={'build': BuildExtFirstHack}, + version="@VERSION@", + description='Python bindings for GPGME GnuPG cryptography library', + # TODO: add a long description + # long_description=long_description, + author='The GnuPG hackers', + author_email='gnupg-devel at gnupg.org', + url='https://www.gnupg.org', + ext_modules=[swige], + packages=[ + 'gpg', 'gpg.constants', 'gpg.constants.data', 'gpg.constants.keylist', + 'gpg.constants.sig', 'gpg.constants.tofu' + ], + license="LGPL2.1+ (the library), GPL2+ (tests and examples)", + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', + 'Topic :: Communications :: Email', + 'Topic :: Security :: Cryptography', + ], ) diff --git a/lang/python/version.py.in b/lang/python/version.py.in index 1a1baf0..ad76eda 100644 --- a/lang/python/version.py.in +++ b/lang/python/version.py.in @@ -1,4 +1,6 @@ -# Copyright (C) 2016 g10 Code GmbH +# -*- coding: utf-8 -*- + +# Copyright (C) 2016-2018 g10 Code GmbH # Copyright (C) 2015 Ben McGinnes # Copyright (C) 2004 Igor Belyi # @@ -17,10 +19,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function -del absolute_import, print_function from . import gpgme +del absolute_import, print_function + productname = 'gpg' versionstr = "@VERSION@" gpgme_versionstr = gpgme.GPGME_VERSION @@ -32,8 +35,8 @@ minor = versionlist[1] patch = versionlist[2] copyright = """\ -Copyright (C) 2016 g10 Code GmbH -Copyright (C) 2015 Ben McGinnes +Copyright (C) 2016-2018 g10 Code GmbH +Copyright (C) 2015 Benjamin D. McGinnes Copyright (C) 2014-2015 Martin Albrecht Copyright (C) 2004-2008 Igor Belyi Copyright (C) 2002 John Goerzen""" @@ -44,8 +47,8 @@ author_email = "gnupg-devel at gnupg.org" description = "Python support for GPGME GnuPG cryptography library" homepage = "https://gnupg.org" -license = """Copyright (C) 2016 g10 Code GmbH -Copyright (C) 2015 Ben McGinnes +license = """Copyright (C) 2016-2018 g10 Code GmbH +Copyright (C) 2015 Benjamin D. McGinnes Copyright (C) 2014, 2015 Martin Albrecht Copyright (C) 2004, 2008 Igor Belyi Copyright (C) 2002 John Goerzen ----------------------------------------------------------------------- Summary of changes: lang/python/setup.py.in | 193 ++++++++++++++++++++++++++-------------------- lang/python/version.py.in | 15 ++-- 2 files changed, 119 insertions(+), 89 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Sat Aug 18 10:48:15 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Sat, 18 Aug 2018 10:48:15 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-123-gb5fbe90 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via b5fbe90676f46b9615919133753a65b20318fe63 (commit) from fc55caccfc87253e1703df66b21917cc399fba62 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b5fbe90676f46b9615919133753a65b20318fe63 Author: Ben McGinnes Date: Sat Aug 18 18:46:47 2018 +1000 Python bindings examples: PEP8 conpliance * Appears to be complete compliance. diff --git a/lang/python/examples/assuan.py b/lang/python/examples/assuan.py index dd42ad4..6784c9e 100644 --- a/lang/python/examples/assuan.py +++ b/lang/python/examples/assuan.py @@ -14,14 +14,14 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, see . - """Demonstrate the use of the Assuan protocol engine""" from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg +del absolute_import, print_function, unicode_literals + with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: # Invoke the pinentry to get a confirmation. err = c.assuan_transact(['GET_CONFIRMATION', 'Hello there']) diff --git a/lang/python/examples/decryption-filter.py b/lang/python/examples/decryption-filter.py index 987dfd1..4d99330 100644 --- a/lang/python/examples/decryption-filter.py +++ b/lang/python/examples/decryption-filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (C) 2016 g10 Code GmbH +# Copyright (C) 2016, 2018 g10 Code GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,6 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, see . - """A decryption filter This demonstrates decryption using gpg3 in three lines of code. To @@ -25,8 +24,10 @@ be used like this: """ from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg + +del absolute_import, print_function, unicode_literals + gpg.Context().decrypt(sys.stdin, sink=sys.stdout) diff --git a/lang/python/examples/delkey.py b/lang/python/examples/delkey.py index 12510f3..30b3145 100755 --- a/lang/python/examples/delkey.py +++ b/lang/python/examples/delkey.py @@ -20,10 +20,11 @@ # It deletes keys for joe at example.org generated by genkey.py script from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg +del absolute_import, print_function, unicode_literals + with gpg.Context() as c: # Note: We must not modify the key store during iteration, # therefore, we explicitly make a list. diff --git a/lang/python/examples/exportimport.py b/lang/python/examples/exportimport.py index d84a01c..36ced57 100755 --- a/lang/python/examples/exportimport.py +++ b/lang/python/examples/exportimport.py @@ -20,12 +20,13 @@ # It uses keys for joe+gpg at example.org generated by genkey.py script from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import os import gpg +del absolute_import, print_function, unicode_literals + user = "joe+gpg at example.org" with gpg.Context(armor=True) as c, gpg.Data() as expkey: diff --git a/lang/python/examples/genkey.py b/lang/python/examples/genkey.py index a043500..710a530 100755 --- a/lang/python/examples/genkey.py +++ b/lang/python/examples/genkey.py @@ -18,10 +18,11 @@ # along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg +del absolute_import, print_function, unicode_literals + # This is the example from the GPGME manual. parms = """ diff --git a/lang/python/examples/inter-edit.py b/lang/python/examples/inter-edit.py index ed0d8c4..5b58c97 100644 --- a/lang/python/examples/inter-edit.py +++ b/lang/python/examples/inter-edit.py @@ -15,15 +15,15 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, see . - """Simple interactive editor to test editor scripts""" from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg +del absolute_import, print_function, unicode_literals + if len(sys.argv) != 2: sys.exit("Usage: %s \n" % sys.argv[0]) @@ -40,10 +40,12 @@ with gpg.Context() as c: print("Editing key {} ({}):".format(key.uids[0].uid, key.subkeys[0].fpr)) def edit_fnc(keyword, args): - print("Status: {}, args: {} > ".format( - keyword, args), end='', flush=True) + print( + "Status: {}, args: {} > ".format(keyword, args), + end='', + flush=True) - if not 'GET' in keyword: + if 'GET' not in keyword: # no prompt print() return None diff --git a/lang/python/examples/low_level-encrypt_to_all.py b/lang/python/examples/low_level-encrypt_to_all.py index bad4220..5c10d3d 100755 --- a/lang/python/examples/low_level-encrypt_to_all.py +++ b/lang/python/examples/low_level-encrypt_to_all.py @@ -16,18 +16,18 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, see . - """ This program will try to encrypt a simple message to each key on your keyring. If your keyring has any invalid keys on it, those keys will be skipped and it will re-try the encryption.""" from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg +del absolute_import, print_function, unicode_literals + with gpg.Context(armor=True) as c: recipients = list() for key in c.keylist(): @@ -40,14 +40,15 @@ with gpg.Context(armor=True) as c: while not ciphertext: print("Encrypting to %d recipients" % len(recipients)) try: - ciphertext, _, _ = c.encrypt(b'This is my message.', - recipients=recipients) + ciphertext, _, _ = c.encrypt( + b'This is my message.', recipients=recipients) except gpg.errors.InvalidRecipients as e: print("Encryption failed for these keys:\n{0!s}".format(e)) # filter out the bad keys bad_keys = {bad.fpr for bad in e.recipients} - recipients = [r for r in recipients - if not r.subkeys[0].fpr in bad_keys] + recipients = [ + r for r in recipients if not r.subkeys[0].fpr in bad_keys + ] sys.stdout.buffer.write(ciphertext) diff --git a/lang/python/examples/sign.py b/lang/python/examples/sign.py index 16c2256..5b90b4b 100755 --- a/lang/python/examples/sign.py +++ b/lang/python/examples/sign.py @@ -17,12 +17,13 @@ # along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg from gpg.constants.sig import mode +del absolute_import, print_function, unicode_literals + with gpg.Context() as c: signed, _ = c.sign(b"Test message", mode=mode.CLEAR) sys.stdout.buffer.write(signed) diff --git a/lang/python/examples/signverify.py b/lang/python/examples/signverify.py index 5870ca9..2df7275 100755 --- a/lang/python/examples/signverify.py +++ b/lang/python/examples/signverify.py @@ -20,12 +20,13 @@ # It uses keys for joe+gpg at example.org generated by genkey.py script from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg from gpg.constants.sig import mode +del absolute_import, print_function, unicode_literals + user = "joe+gpg" with gpg.Context(pinentry_mode=gpg.constants.PINENTRY_MODE_LOOPBACK) as c: diff --git a/lang/python/examples/simple.py b/lang/python/examples/simple.py index 8f451d7..17c3eba 100755 --- a/lang/python/examples/simple.py +++ b/lang/python/examples/simple.py @@ -18,11 +18,12 @@ # along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg +del absolute_import, print_function, unicode_literals + with gpg.Context(armor=True) as c: recipients = [] print("Enter name of your recipient(s), end with a blank line.") @@ -40,8 +41,8 @@ with gpg.Context(armor=True) as c: if not recipients: sys.exit("No recipients.") - print("Encrypting for {}.".format(", ".join(k.uids[0].name - for k in recipients))) + print("Encrypting for {}.".format(", ".join( + k.uids[0].name for k in recipients))) ciphertext, _, _ = c.encrypt(b"This is my message,", recipients) sys.stdout.buffer.write(ciphertext) diff --git a/lang/python/examples/testCMSgetkey.py b/lang/python/examples/testCMSgetkey.py index d4c0884..f1cdb2c 100644 --- a/lang/python/examples/testCMSgetkey.py +++ b/lang/python/examples/testCMSgetkey.py @@ -15,15 +15,15 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, see . - """A test applicaton for the CMS protocol.""" from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg +del absolute_import, print_function, unicode_literals + if len(sys.argv) != 2: sys.exit("fingerprint or unique key ID for gpgme_get_key()") diff --git a/lang/python/examples/verifydetails.py b/lang/python/examples/verifydetails.py index b3ca133..dc0e7d3 100755 --- a/lang/python/examples/verifydetails.py +++ b/lang/python/examples/verifydetails.py @@ -18,11 +18,13 @@ # along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg +del absolute_import, print_function, unicode_literals + + def print_engine_infos(): print("gpgme version:", gpg.core.check_version(None)) print("engines:") @@ -31,8 +33,9 @@ def print_engine_infos(): print(engine.file_name, engine.version) for proto in [gpg.constants.protocol.OpenPGP, gpg.constants.protocol.CMS]: - print("Have {}? {}".format(gpg.core.get_protocol_name(proto), - gpg.core.engine_check_version(proto))) + print("Have {}? {}".format( + gpg.core.get_protocol_name(proto), + gpg.core.engine_check_version(proto))) def verifyprintdetails(filename, detached_sig_filename=None): @@ -40,9 +43,9 @@ def verifyprintdetails(filename, detached_sig_filename=None): with gpg.Context() as c: # Verify. - data, result = c.verify(open(filename), - open(detached_sig_filename) - if detached_sig_filename else None) + data, result = c.verify( + open(filename), + open(detached_sig_filename) if detached_sig_filename else None) # List results for all signatures. Status equal 0 means "Ok". for index, sign in enumerate(result.signatures): @@ -57,15 +60,15 @@ def verifyprintdetails(filename, detached_sig_filename=None): if data: sys.stdout.buffer.write(data) + def main(): print_engine_infos() print() argc = len(sys.argv) if argc < 2 or argc > 3: - sys.exit( - "Usage: {} [ ]".format( - sys.argv[0])) + sys.exit("Usage: {} [ ]".format( + sys.argv[0])) if argc == 2: print("trying to verify file {}.".format(sys.argv[1])) @@ -74,5 +77,6 @@ def main(): print("trying to verify signature {1} for file {0}.".format(*sys.argv)) verifyprintdetails(sys.argv[1], sys.argv[2]) + if __name__ == "__main__": main() ----------------------------------------------------------------------- Summary of changes: lang/python/examples/assuan.py | 4 ++-- lang/python/examples/decryption-filter.py | 7 ++++--- lang/python/examples/delkey.py | 3 ++- lang/python/examples/exportimport.py | 3 ++- lang/python/examples/genkey.py | 3 ++- lang/python/examples/inter-edit.py | 12 +++++++----- lang/python/examples/low_level-encrypt_to_all.py | 13 +++++++------ lang/python/examples/sign.py | 3 ++- lang/python/examples/signverify.py | 3 ++- lang/python/examples/simple.py | 7 ++++--- lang/python/examples/testCMSgetkey.py | 4 ++-- lang/python/examples/verifydetails.py | 22 +++++++++++++--------- 12 files changed, 49 insertions(+), 35 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Sat Aug 18 12:30:41 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Sat, 18 Aug 2018 12:30:41 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-124-g5facba4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 5facba45c83f7daaacc49e66306e13a35aeb74be (commit) from b5fbe90676f46b9615919133753a65b20318fe63 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5facba45c83f7daaacc49e66306e13a35aeb74be Author: Ben McGinnes Date: Sat Aug 18 20:29:14 2018 +1000 Python bindings tests: Near PEP8 compliance * PEP8 compliance for the vast majoeity of the tests. diff --git a/lang/python/tests/final.py b/lang/python/tests/final.py index 65375cb..d0d52dc 100755 --- a/lang/python/tests/final.py +++ b/lang/python/tests/final.py @@ -18,12 +18,15 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import os import subprocess import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals -subprocess.check_call([os.path.join(os.getenv('top_srcdir'), - "tests", "start-stop-agent"), "--stop"]) +subprocess.check_call([ + os.path.join(os.getenv('top_srcdir'), "tests", "start-stop-agent"), + "--stop" +]) diff --git a/lang/python/tests/initial.py b/lang/python/tests/initial.py index 49e4f82..30a8de7 100755 --- a/lang/python/tests/initial.py +++ b/lang/python/tests/initial.py @@ -18,17 +18,20 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import os import subprocess import gpg import support +del absolute_import, print_function, unicode_literals + print("Using gpg module from {0!r}.".format(os.path.dirname(gpg.__file__))) -subprocess.check_call([os.path.join(os.getenv('top_srcdir'), - "tests", "start-stop-agent"), "--start"]) +subprocess.check_call([ + os.path.join(os.getenv('top_srcdir'), "tests", "start-stop-agent"), + "--start" +]) with gpg.Context() as c: alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False) diff --git a/lang/python/tests/run-tests.py b/lang/python/tests/run-tests.py index 95df197..cec13b5 100644 --- a/lang/python/tests/run-tests.py +++ b/lang/python/tests/run-tests.py @@ -17,10 +17,8 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, see . -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals +from __future__ import absolute_import, division +from __future__ import print_function, unicode_literals import argparse import glob @@ -28,34 +26,50 @@ import os import subprocess import sys +del absolute_import, division, print_function, unicode_literals + + class SplitAndAccumulate(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): current = getattr(namespace, self.dest, list()) current.extend(values.split()) setattr(namespace, self.dest, current) + parser = argparse.ArgumentParser(description='Run tests.') -parser.add_argument('tests', metavar='TEST', type=str, nargs='+', - help='A test to run') -parser.add_argument('-v', '--verbose', action="store_true", default=False, - help='Be verbose.') -parser.add_argument('-q', '--quiet', action="store_true", default=False, - help='Be quiet.') -parser.add_argument('--interpreters', metavar='PYTHON', type=str, - default=[], action=SplitAndAccumulate, - help='Use these interpreters to run the tests, ' + - 'separated by spaces.') -parser.add_argument('--srcdir', type=str, - default=os.environ.get("srcdir", ""), - help='Location of the tests.') -parser.add_argument('--builddir', type=str, - default=os.environ.get("abs_builddir", ""), - help='Location of the tests.') -parser.add_argument('--python-libdir', type=str, - default=None, - help='Optional location of the in-tree module lib directory.') -parser.add_argument('--parallel', action="store_true", default=False, - help='Ignored. For compatibility with run-tests.scm.') +parser.add_argument( + 'tests', metavar='TEST', type=str, nargs='+', help='A test to run') +parser.add_argument( + '-v', '--verbose', action="store_true", default=False, help='Be verbose.') +parser.add_argument( + '-q', '--quiet', action="store_true", default=False, help='Be quiet.') +parser.add_argument( + '--interpreters', + metavar='PYTHON', + type=str, + default=[], + action=SplitAndAccumulate, + help='Use these interpreters to run the tests, ' + 'separated by spaces.') +parser.add_argument( + '--srcdir', + type=str, + default=os.environ.get("srcdir", ""), + help='Location of the tests.') +parser.add_argument( + '--builddir', + type=str, + default=os.environ.get("abs_builddir", ""), + help='Location of the tests.') +parser.add_argument( + '--python-libdir', + type=str, + default=None, + help='Optional location of the in-tree module lib directory.') +parser.add_argument( + '--parallel', + action="store_true", + default=False, + help='Ignored. For compatibility with run-tests.scm.') args = parser.parse_args() if not args.interpreters: @@ -64,26 +78,31 @@ if not args.interpreters: out = sys.stdout if args.verbose else None err = sys.stderr if args.verbose else None + def status_to_str(code): return {0: "PASS", 77: "SKIP", 99: "ERROR"}.get(code, "FAIL") + results = list() for interpreter in args.interpreters: - version = subprocess.check_output( - [interpreter, "-c", "import sys; print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"]).strip().decode() + version = subprocess.check_output([ + interpreter, "-c", + "import sys; print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))" + ]).strip().decode() if args.python_libdir: python_libdir = args.python_libdir else: - pattern = os.path.join(args.builddir, "..", - "{0}-gpg".format(os.path.basename(interpreter)), - "lib*") + pattern = os.path.join(args.builddir, "..", "{0}-gpg".format( + os.path.basename(interpreter)), "lib*") libdirs = glob.glob(pattern) if len(libdirs) == 0: - sys.exit("Build directory matching {0!r} not found.".format(pattern)) + sys.exit( + "Build directory matching {0!r} not found.".format(pattern)) elif len(libdirs) > 1: - sys.exit("Multiple build directories matching {0!r} found: {1}".format( - pattern, libdirs)) + sys.exit( + "Multiple build directories matching {0!r} found: {1}".format( + pattern, libdirs)) python_libdir = libdirs[0] env = dict(os.environ) @@ -95,16 +114,22 @@ for interpreter in args.interpreters: for test in args.tests: status = subprocess.call( [interpreter, os.path.join(args.srcdir, test)], - env=env, stdout=out, stderr=err) + env=env, + stdout=out, + stderr=err) if not args.quiet: print("{0}: {1}".format(status_to_str(status), test)) results.append(status) + def count(status): return len(list(filter(lambda x: x == status, results))) + + def failed(): return len(list(filter(lambda x: x not in (0, 77, 99), results))) + if not args.quiet: print("{0} tests run, {1} succeeded, {2} failed, {3} skipped.".format( len(results), count(0), failed(), count(77))) diff --git a/lang/python/tests/support.py b/lang/python/tests/support.py index efccf31..e6b3d8b 100644 --- a/lang/python/tests/support.py +++ b/lang/python/tests/support.py @@ -16,7 +16,6 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import contextlib import shutil @@ -27,20 +26,28 @@ import tempfile import time import gpg +del absolute_import, print_function, unicode_literals + + def assert_gpg_version(version=(2, 1, 0)): with gpg.Context() as c: - clean_version = re.match(r'\d+\.\d+\.\d+', c.engine_info.version).group(0) + clean_version = re.match(r'\d+\.\d+\.\d+', + c.engine_info.version).group(0) if tuple(map(int, clean_version.split('.'))) < version: print("GnuPG too old: have {0}, need {1}.".format( c.engine_info.version, '.'.join(map(str, version)))) sys.exit(77) + def have_tofu_support(ctx, some_uid): - keys = list(ctx.keylist(some_uid, - mode=(gpg.constants.keylist.mode.LOCAL - |gpg.constants.keylist.mode.WITH_TOFU))) + keys = list( + ctx.keylist( + some_uid, + mode=(gpg.constants.keylist.mode.LOCAL | + gpg.constants.keylist.mode.WITH_TOFU))) return len(keys) > 0 + # Skip the Python tests for GnuPG < 2.1.12. Prior versions do not # understand the command line flags that we assume exist. C.f. issue # 3008. @@ -53,13 +60,18 @@ encrypt_only = "F52770D5C4DB41408D918C9F920572769B9FE19C" sign_only = "7CCA20CCDE5394CEE71C9F0BFED153F12F18F45D" no_such_key = "A" * 40 + def make_filename(name): return os.path.join(os.environ['top_srcdir'], 'tests', 'gpg', name) + def in_srcdir(name): return os.path.join(os.environ['srcdir'], name) + verbose = int(os.environ.get('verbose', 0)) > 1 + + def print_data(data): if verbose: try: @@ -75,10 +87,12 @@ def print_data(data): else: sys.stdout.write(data) + def mark_key_trusted(ctx, key): class Editor(object): def __init__(self): self.steps = ["trust", "save"] + def edit(self, status, args, out): if args == "keyedit.prompt": result = self.steps.pop(0) @@ -91,6 +105,7 @@ def mark_key_trusted(ctx, key): else: result = None return result + with gpg.Data() as sink: ctx.op_edit(key, Editor().edit, sink, sink) @@ -103,9 +118,11 @@ class TemporaryDirectory(object): def __enter__(self): self.path = tempfile.mkdtemp() return self.path + def __exit__(self, *args): shutil.rmtree(self.path, ignore_errors=True) + @contextlib.contextmanager def EphemeralContext(): with TemporaryDirectory() as tmp: @@ -124,7 +141,7 @@ def EphemeralContext(): ctx.assuan_transact(["KILLAGENT"]) except gpg.errors.GPGMEError as e: if e.getcode() == gpg.errors.ASS_CONNECT_FAILED: - pass # the agent was not running + pass # the agent was not running else: raise diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py index b311e3d..25a1c23 100755 --- a/lang/python/tests/t-callbacks.py +++ b/lang/python/tests/t-callbacks.py @@ -18,12 +18,13 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import os import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals c = gpg.Context() c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) @@ -33,6 +34,7 @@ sink = gpg.Data() # Valid passphrases, both as string and bytes. for passphrase in ('foo', b'foo'): + def passphrase_cb(hint, desc, prev_bad, hook=None): assert hook == passphrase return hook @@ -40,10 +42,12 @@ for passphrase in ('foo', b'foo'): c.set_passphrase_cb(passphrase_cb, passphrase) c.op_encrypt([], 0, source, sink) + # Returning an invalid type. def passphrase_cb(hint, desc, prev_bad, hook=None): return 0 + c.set_passphrase_cb(passphrase_cb, None) try: c.op_encrypt([], 0, source, sink) @@ -55,9 +59,12 @@ else: # Raising an exception inside callback. myException = Exception() + + def passphrase_cb(hint, desc, prev_bad, hook=None): raise myException + c.set_passphrase_cb(passphrase_cb, None) try: c.op_encrypt([], 0, source, sink) @@ -66,10 +73,12 @@ except Exception as e: else: assert False, "Expected an error, got none" + # Wrong kind of callback function. def bad_passphrase_cb(): pass + c.set_passphrase_cb(bad_passphrase_cb, None) try: c.op_encrypt([], 0, source, sink) @@ -78,8 +87,6 @@ except Exception as e: else: assert False, "Expected an error, got none" - - # Test the progress callback. parms = """ Key-Type: RSA @@ -93,21 +100,26 @@ Expire-Date: 2099-12-31 """ messages = [] + + def progress_cb(what, typ, current, total, hook=None): assert hook == messages messages.append( "PROGRESS UPDATE: what = {}, type = {}, current = {}, total = {}" .format(what, typ, current, total)) + c = gpg.Context() c.set_progress_cb(progress_cb, messages) c.op_genkey(parms, None, None) assert len(messages) > 0 + # Test exception handling. def progress_cb(what, typ, current, total, hook=None): raise myException + c = gpg.Context() c.set_progress_cb(progress_cb, None) try: @@ -117,7 +129,6 @@ except Exception as e: else: assert False, "Expected an error, got none" - # Test the edit callback. c = gpg.Context() c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) @@ -127,11 +138,15 @@ alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False) cookie = object() edit_cb_called = False + + def edit_cb(status, args, hook): global edit_cb_called edit_cb_called = True assert hook == cookie return "quit" if args == "keyedit.prompt" else None + + c.op_edit(alpha, edit_cb, cookie, sink) assert edit_cb_called @@ -141,8 +156,11 @@ c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) c.set_passphrase_cb(lambda *args: "abc") sink = gpg.Data() + def edit_cb(status, args): raise myException + + try: c.op_edit(alpha, edit_cb, None, sink) except Exception as e: @@ -150,18 +168,19 @@ except Exception as e: else: assert False, "Expected an error, got none" - - # Test the status callback. source = gpg.Data("Hallo Leute\n") sink = gpg.Data() status_cb_called = False + + def status_cb(keyword, args, hook=None): global status_cb_called status_cb_called = True assert hook == cookie + c = gpg.Context() c.set_status_cb(status_cb, cookie) c.set_ctx_flag("full-status", "1") @@ -172,9 +191,11 @@ assert status_cb_called source = gpg.Data("Hallo Leute\n") sink = gpg.Data() + def status_cb(keyword, args): raise myException + c = gpg.Context() c.set_status_cb(status_cb, None) c.set_ctx_flag("full-status", "1") @@ -186,13 +207,16 @@ else: assert False, "Expected an error, got none" - # Test the data callbacks. def read_cb(amount, hook=None): assert hook == cookie return 0 + + def release_cb(hook=None): assert hook == cookie + + data = gpg.Data(cbs=(read_cb, None, None, release_cb, cookie)) try: data.read() @@ -201,8 +225,11 @@ except Exception as e: else: assert False, "Expected an error, got none" + def read_cb(amount): raise myException + + data = gpg.Data(cbs=(read_cb, None, None, lambda: None)) try: data.read() @@ -215,6 +242,8 @@ else: def write_cb(what, hook=None): assert hook == cookie return "wrong type" + + data = gpg.Data(cbs=(None, write_cb, None, release_cb, cookie)) try: data.write(b'stuff') @@ -223,8 +252,11 @@ except Exception as e: else: assert False, "Expected an error, got none" + def write_cb(what): raise myException + + data = gpg.Data(cbs=(None, write_cb, None, lambda: None)) try: data.write(b'stuff') @@ -237,6 +269,8 @@ else: def seek_cb(offset, whence, hook=None): assert hook == cookie return "wrong type" + + data = gpg.Data(cbs=(None, None, seek_cb, release_cb, cookie)) try: data.seek(0, os.SEEK_SET) @@ -245,8 +279,11 @@ except Exception as e: else: assert False, "Expected an error, got none" + def seek_cb(offset, whence): raise myException + + data = gpg.Data(cbs=(None, None, seek_cb, lambda: None)) try: data.seek(0, os.SEEK_SET) diff --git a/lang/python/tests/t-data.py b/lang/python/tests/t-data.py index 5cf074c..006c11f 100755 --- a/lang/python/tests/t-data.py +++ b/lang/python/tests/t-data.py @@ -18,14 +18,15 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import io import os import tempfile import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals data = gpg.Data('Hello world!') assert data.read() == b'Hello world!' @@ -94,7 +95,8 @@ with tempfile.NamedTemporaryFile() as tmp: # Open using name, offset, and length. data = gpg.Data(file=tmp.name, offset=23, length=42) - assert data.read() == binjunk[23:23+42] + assert data.read() == binjunk[23:23 + 42] + # Test callbacks. class DataObject(object): @@ -118,6 +120,7 @@ class DataObject(object): assert not self.released self.released = True + do = DataObject() cookie = object() data = gpg.Data(cbs=(do.read, do.write, do.seek, do.release, cookie)) diff --git a/lang/python/tests/t-decrypt-verify.py b/lang/python/tests/t-decrypt-verify.py index 03bbc4b..fcaa134 100755 --- a/lang/python/tests/t-decrypt-verify.py +++ b/lang/python/tests/t-decrypt-verify.py @@ -18,11 +18,13 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support +del absolute_import, print_function, unicode_literals + + def check_verify_result(result, summary, fpr, status): assert len(result.signatures) == 1, "Unexpected number of signatures" sig = result.signatures[0] @@ -32,7 +34,9 @@ def check_verify_result(result, summary, fpr, status): assert len(sig.notations) == 0 assert not sig.wrong_key_usage assert sig.validity == gpg.constants.validity.FULL - assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR + assert gpg.errors.GPGMEError( + sig.validity_reason).getcode() == gpg.errors.NO_ERROR + c = gpg.Context() @@ -47,10 +51,9 @@ assert not result.unsupported_algorithm, \ support.print_data(sink) verify_result = c.op_verify_result() -check_verify_result(verify_result, - gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, - "A0FF4590BB6122EDEF6E3C542D727CC768697734", - gpg.errors.NO_ERROR) +check_verify_result( + verify_result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, + "A0FF4590BB6122EDEF6E3C542D727CC768697734", gpg.errors.NO_ERROR) # Idiomatic interface. with gpg.Context() as c: @@ -60,14 +63,13 @@ with gpg.Context() as c: c.decrypt(open(support.make_filename("cipher-2.asc")), verify=[alpha]) assert plaintext.find(b'Wenn Sie dies lesen k') >= 0, \ 'Plaintext not found' - check_verify_result(verify_result, - gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, - "A0FF4590BB6122EDEF6E3C542D727CC768697734", - gpg.errors.NO_ERROR) + check_verify_result( + verify_result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, + "A0FF4590BB6122EDEF6E3C542D727CC768697734", gpg.errors.NO_ERROR) try: - c.decrypt(open(support.make_filename("cipher-2.asc")), - verify=[alpha, bob]) + c.decrypt( + open(support.make_filename("cipher-2.asc")), verify=[alpha, bob]) except gpg.errors.MissingSignatures as e: assert len(e.missing) == 1 assert e.missing[0] == bob diff --git a/lang/python/tests/t-decrypt.py b/lang/python/tests/t-decrypt.py index 05b6d8b..f2417c9 100755 --- a/lang/python/tests/t-decrypt.py +++ b/lang/python/tests/t-decrypt.py @@ -18,11 +18,12 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support +del absolute_import, print_function, unicode_literals + c = gpg.Context() source = gpg.Data(file=support.make_filename("cipher-1.asc")) diff --git a/lang/python/tests/t-edit.py b/lang/python/tests/t-edit.py index b1075a9..cbc17d9 100755 --- a/lang/python/tests/t-edit.py +++ b/lang/python/tests/t-edit.py @@ -19,13 +19,15 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import os import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals + class KeyEditor(object): def __init__(self): @@ -47,11 +49,12 @@ class KeyEditor(object): result = None if self.verbose: - sys.stderr.write("Code: {}, args: {!r}, Returning: {!r}\n" - .format(status, args, result)) + sys.stderr.write("Code: {}, args: {!r}, Returning: {!r}\n".format( + status, args, result)) return result + c = gpg.Context() c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) c.set_passphrase_cb(lambda *args: "abc") @@ -59,13 +62,15 @@ c.set_armor(True) # The deprecated interface. editor = KeyEditor() -c.interact(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False), - editor.edit_fnc) +c.interact( + c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False), + editor.edit_fnc) assert editor.done # The deprecated interface. sink = gpg.Data() editor = KeyEditor() -c.op_edit(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False), - editor.edit_fnc, sink, sink) +c.op_edit( + c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False), + editor.edit_fnc, sink, sink) assert editor.done diff --git a/lang/python/tests/t-encrypt-large.py b/lang/python/tests/t-encrypt-large.py index 5646085..18576ac 100755 --- a/lang/python/tests/t-encrypt-large.py +++ b/lang/python/tests/t-encrypt-large.py @@ -18,13 +18,14 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import random import gpg import support +del absolute_import, print_function, unicode_literals + if len(sys.argv) == 2: nbytes = int(sys.argv[1]) else: @@ -33,6 +34,8 @@ else: c = gpg.Context() ntoread = nbytes + + def read_cb(amount): global ntoread chunk = ntoread if ntoread < amount else amount @@ -41,12 +44,16 @@ def read_cb(amount): assert chunk >= 0 return bytes(bytearray(random.randrange(256) for i in range(chunk))) + nwritten = 0 + + def write_cb(data): global nwritten nwritten += len(data) return len(data) + source = gpg.Data(cbs=(read_cb, None, None, lambda: None)) sink = gpg.Data(cbs=(None, write_cb, None, lambda: None)) @@ -61,5 +68,5 @@ assert not result.invalid_recipients, \ assert ntoread == 0 if support.verbose: - sys.stderr.write( - "plaintext={} bytes, ciphertext={} bytes\n".format(nbytes, nwritten)) + sys.stderr.write("plaintext={} bytes, ciphertext={} bytes\n".format( + nbytes, nwritten)) diff --git a/lang/python/tests/t-encrypt-sign.py b/lang/python/tests/t-encrypt-sign.py index f04783f..84d1abb 100755 --- a/lang/python/tests/t-encrypt-sign.py +++ b/lang/python/tests/t-encrypt-sign.py @@ -18,15 +18,17 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import gpg import support +del absolute_import, print_function, unicode_literals + c = gpg.Context() c.set_armor(True) + def check_result(r, typ): if r.invalid_signers: sys.exit("Invalid signer found: {}".format(r.invalid_signers.fpr)) @@ -42,7 +44,8 @@ def check_result(r, typ): sys.exit("Wrong pubkey algorithm reported: {}".format( signature.pubkey_algo)) - if signature.hash_algo not in (gpg.constants.md.SHA1, gpg.constants.md.RMD160): + if signature.hash_algo not in (gpg.constants.md.SHA1, + gpg.constants.md.RMD160): sys.exit("Wrong hash algorithm reported: {}".format( signature.hash_algo)) @@ -53,6 +56,7 @@ def check_result(r, typ): if signature.fpr != "A0FF4590BB6122EDEF6E3C542D727CC768697734": sys.exit("Wrong fingerprint reported: {}".format(signature.fpr)) + keys = [] keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)) keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)) @@ -61,7 +65,8 @@ for recipients in (keys, []): source = gpg.Data("Hallo Leute\n") sink = gpg.Data() - c.op_encrypt_sign(recipients, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink) + c.op_encrypt_sign(recipients, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, + sink) result = c.op_encrypt_result() assert not result.invalid_recipients, \ "Invalid recipient encountered: {}".format( @@ -72,13 +77,11 @@ for recipients in (keys, []): support.print_data(sink) - # Idiomatic interface. with gpg.Context(armor=True) as c: message = "Hallo Leute\n".encode() - ciphertext, _, sig_result = c.encrypt(message, - recipients=keys, - always_trust=True) + ciphertext, _, sig_result = c.encrypt( + message, recipients=keys, always_trust=True) assert len(ciphertext) > 0 assert ciphertext.find(b'BEGIN PGP MESSAGE') > 0, 'Marker not found' check_result(sig_result, gpg.constants.sig.mode.NORMAL) diff --git a/lang/python/tests/t-encrypt-sym.py b/lang/python/tests/t-encrypt-sym.py index 8299293..9b099fe 100755 --- a/lang/python/tests/t-encrypt-sym.py +++ b/lang/python/tests/t-encrypt-sym.py @@ -18,12 +18,13 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import os import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals for passphrase in ("abc", b"abc"): c = gpg.Context() @@ -34,6 +35,7 @@ for passphrase in ("abc", b"abc"): cipher = gpg.Data() passphrase_cb_called = 0 + def passphrase_cb(hint, desc, prev_bad, hook=None): global passphrase_cb_called passphrase_cb_called += 1 @@ -55,7 +57,7 @@ for passphrase in ("abc", b"abc"): c.op_decrypt(cipher, plain) # Seems like the passphrase is cached. - #assert passphrase_cb_called == 2, \ + # assert passphrase_cb_called == 2, \ # "Callback called {} times".format(passphrase_cb_called) support.print_data(plain) @@ -70,12 +72,12 @@ for passphrase in ("abc", b"abc"): # Check that the passphrase callback is not altered. def f(*args): assert False + c.set_passphrase_cb(f) message = "Hallo Leute\n".encode() - ciphertext, _, _ = c.encrypt(message, - passphrase=passphrase, - sign=False) + ciphertext, _, _ = c.encrypt( + message, passphrase=passphrase, sign=False) assert ciphertext.find(b'BEGIN PGP MESSAGE') > 0, 'Marker not found' plaintext, _, _ = c.decrypt(ciphertext, passphrase=passphrase) diff --git a/lang/python/tests/t-encrypt.py b/lang/python/tests/t-encrypt.py index 921502a..e702daa 100755 --- a/lang/python/tests/t-encrypt.py +++ b/lang/python/tests/t-encrypt.py @@ -18,11 +18,12 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support +del absolute_import, print_function, unicode_literals + c = gpg.Context() c.set_armor(True) @@ -41,36 +42,37 @@ support.print_data(sink) # Idiomatic interface. with gpg.Context(armor=True) as c: - ciphertext, _, _ = c.encrypt("Hallo Leute\n".encode(), - recipients=keys, - sign=False, - always_trust=True) + ciphertext, _, _ = c.encrypt( + "Hallo Leute\n".encode(), + recipients=keys, + sign=False, + always_trust=True) assert len(ciphertext) > 0 assert ciphertext.find(b'BEGIN PGP MESSAGE') > 0, 'Marker not found' - c.encrypt("Hallo Leute\n".encode(), - recipients=[c.get_key(support.encrypt_only, False)], - sign=False, always_trust=True) + c.encrypt( + "Hallo Leute\n".encode(), + recipients=[c.get_key(support.encrypt_only, False)], + sign=False, + always_trust=True) try: - c.encrypt("Hallo Leute\n".encode(), - recipients=[c.get_key(support.sign_only, False)], - sign=False, always_trust=True) + c.encrypt( + "Hallo Leute\n".encode(), + recipients=[c.get_key(support.sign_only, False)], + sign=False, + always_trust=True) except gpg.errors.InvalidRecipients as e: assert len(e.recipients) == 1 assert support.sign_only.endswith(e.recipients[0].fpr) else: assert False, "Expected an InvalidRecipients error, got none" - - try: # People might be tempted to provide strings. # We should raise something useful. - ciphertext, _, _ = c.encrypt("Hallo Leute\n", - recipients=keys, - sign=False, - always_trust=True) + ciphertext, _, _ = c.encrypt( + "Hallo Leute\n", recipients=keys, sign=False, always_trust=True) except TypeError as e: # This test is a bit fragile, because the message # may very well change. So if the behaviour will change diff --git a/lang/python/tests/t-export.py b/lang/python/tests/t-export.py index b9d5204..6d771dd 100755 --- a/lang/python/tests/t-export.py +++ b/lang/python/tests/t-export.py @@ -18,11 +18,12 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support +del absolute_import, print_function, unicode_literals + c = gpg.Context() c.set_armor(True) @@ -32,8 +33,8 @@ support.print_data(sink) # Again. Now using a key array. keys = [] -keys.append(c.get_key("0x68697734", False)) # Alpha -keys.append(c.get_key("0xA9E3B0B2", False)) # Bob +keys.append(c.get_key("0x68697734", False)) # Alpha +keys.append(c.get_key("0xA9E3B0B2", False)) # Bob sink = gpg.Data() c.op_export_keys(keys, 0, sink) support.print_data(sink) diff --git a/lang/python/tests/t-file-name.py b/lang/python/tests/t-file-name.py index 32fe84a..d9c226f 100755 --- a/lang/python/tests/t-file-name.py +++ b/lang/python/tests/t-file-name.py @@ -18,12 +18,13 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import os import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals testname = "abcde12345" diff --git a/lang/python/tests/t-idiomatic.py b/lang/python/tests/t-idiomatic.py index b7ae4eb..238bbf3 100755 --- a/lang/python/tests/t-idiomatic.py +++ b/lang/python/tests/t-idiomatic.py @@ -18,7 +18,6 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import io @@ -26,7 +25,9 @@ import os import tempfile import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals # Both Context and Data can be used as context manager: with gpg.Context() as c, gpg.Data() as d: @@ -34,8 +35,9 @@ with gpg.Context() as c, gpg.Data() as d: d.write(b"Halloechen") leak_c = c leak_d = d -assert leak_c.wrapped == None -assert leak_d.wrapped == None +assert leak_c.wrapped is None +assert leak_d.wrapped is None + def sign_and_verify(source, signed, sink): with gpg.Context() as c: @@ -53,6 +55,7 @@ def sign_and_verify(source, signed, sink): sink.seek(0, os.SEEK_SET) assert sink.read() == b"Hallo Leute\n" + # Demonstrate automatic wrapping of file-like objects with 'fileno' # method. with tempfile.TemporaryFile() as source, \ @@ -73,7 +76,7 @@ if sys.version_info[0] == 3: bio.truncate(1) if len(bio.getvalue()) != 1: # This version of Python is affected, preallocate buffer. - preallocate = 128*b'\x00' + preallocate = 128 * b'\x00' else: preallocate = b'' diff --git a/lang/python/tests/t-import.py b/lang/python/tests/t-import.py index 44dc360..8d8a699 100755 --- a/lang/python/tests/t-import.py +++ b/lang/python/tests/t-import.py @@ -18,45 +18,47 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support +del absolute_import, print_function, unicode_literals + + def check_result(result, fpr, secret): assert result.considered == 1 or (secret and result.considered == 3) assert result.no_user_id == 0 - assert not ((secret and result.imported != 0) - or (not secret and (result.imported != 0 - and result.imported != 1))) + assert not ((secret and result.imported != 0) or + (not secret and + (result.imported != 0 and result.imported != 1))) assert result.imported_rsa == 0 - assert not ((secret and (result.unchanged != 0 and result.unchanged != 1)) - or (not secret and ((result.imported == 0 - and result.unchanged != 1) - or (result.imported == 1 - and result.unchanged != 0)))) + assert not ((secret and + (result.unchanged != 0 and result.unchanged != 1)) or + (not secret and + ((result.imported == 0 and result.unchanged != 1) or + (result.imported == 1 and result.unchanged != 0)))) assert result.new_user_ids == 0 assert result.new_sub_keys == 0 - assert not ((secret - and ((result.secret_imported == 0 - and result.new_signatures != 0) - or (result.secret_imported == 1 - and result.new_signatures > 1))) - or (not secret and result.new_signatures != 0)) + assert not ((secret and ( + (result.secret_imported == 0 and result.new_signatures != 0) or + (result.secret_imported == 1 and result.new_signatures > 1))) or + (not secret and result.new_signatures != 0)) assert result.new_revocations == 0 - assert not ((secret and result.secret_read != 1 and result.secret_read != 3) - or (not secret and result.secret_read != 0)) - assert not ((secret and result.secret_imported != 0 - and result.secret_imported != 1 - and result.secret_imported != 2) - or (not secret and result.secret_imported != 0)) - assert not ((secret - and ((result.secret_imported == 0 - and result.secret_unchanged != 1 - and result.secret_unchanged != 2) - or (result.secret_imported == 1 - and result.secret_unchanged != 0))) - or (not secret and result.secret_unchanged != 0)) + assert not ( + (secret and result.secret_read != 1 and result.secret_read != 3) or + (not secret and result.secret_read != 0)) + assert not ( + (secret and result.secret_imported != 0 and result. + secret_imported != 1 and result. + secret_imported != 2) or (not secret and result. + secret_imported != 0)) + assert not ((secret and + ((result.secret_imported == 0 and result. + secret_unchanged != 1 and result. + secret_unchanged != 2) or (result. + secret_imported == 1 and result. + secret_unchanged != 0))) or + (not secret and result.secret_unchanged != 0)) assert result.not_imported == 0 if secret: assert not (len(result.imports) in (0, 3)) @@ -67,6 +69,7 @@ def check_result(result, fpr, secret): assert len(result.imports) == 1 or fpr == result.imports[1].fpr assert result.imports[0].result == 0 + c = gpg.Context() result = c.key_import(open(support.make_filename("pubkey-1.asc"), 'rb').read()) diff --git a/lang/python/tests/t-keylist-from-data.py b/lang/python/tests/t-keylist-from-data.py index 6503eb7..f82ca84 100755 --- a/lang/python/tests/t-keylist-from-data.py +++ b/lang/python/tests/t-keylist-from-data.py @@ -18,87 +18,142 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support +del absolute_import, print_function, unicode_literals + support.assert_gpg_version((2, 1, 14)) + # Check expration of keys. This test assumes three subkeys of which # 2 are expired; it is used with the "Whisky" test key. It has # already been checked that these 3 subkeys are available. def check_whisky(name, key): - sub1 = key.subkeys[2] - sub2 = key.subkeys[3] + sub1 = key.subkeys[2] + sub2 = key.subkeys[3] + + assert sub1.expired and sub2.expired, \ + "Subkey of `{}' not flagged as expired".format(name) + assert sub1.expires == 1129636886 and sub2.expires == 1129636939, \ + "Subkey of `{}' has wrong expiration date".format(name) - assert sub1.expired and sub2.expired, \ - "Subkey of `{}' not flagged as expired".format(name) - assert sub1.expires == 1129636886 and sub2.expires == 1129636939, \ - "Subkey of `{}' has wrong expiration date".format(name) keys = [ - [ "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", - [ [ "Alfa Test", "demo key", "alfa at example.net" ], - [ "Alpha Test", "demo key", "alpha at example.net" ], - [ "Alice", "demo key", "" ] ], 1 ], - [ "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "5381EA4EE29BA37F", - [ [ "Bob", "demo key", "" ], - [ "Bravo Test", "demo key", "bravo at example.net" ] ], 1 ], - [ "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60", - [ [ "Charlie Test", "demo key", "charlie at example.net" ] ], 1 ], - [ "6560C59C43D031C54D7C588EEBA9F240EB9DC9E6", "06F22880B0C45424", - [ [ "Delta Test", "demo key", "delta at example.net" ] ], 1 ], - [ "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D", - [ [ "Echelon", "demo key", "" ], - [ "Echo Test", "demo key", "echo at example.net" ], - [ "Eve", "demo key", "" ] ], 1 ], - [ "56D33268F7FE693FBB594762D4BF57F37372E243", "0A32EE79EE45198E", - [ [ "Foxtrot Test", "demo key", "foxtrot at example.net" ] ], 1 ], - [ "C9C07DCC6621B9FB8D071B1D168410A48FC282E6", "247491CC9DCAD354", - [ [ "Golf Test", "demo key", "golf at example.net" ] ], 1 ], - [ "9E91CBB11E4D4135583EF90513DB965534C6E3F1", "76E26537D622AD0A", - [ [ "Hotel Test", "demo key", "hotel at example.net" ] ], 1 ], - [ "CD538D6CC9FB3D745ECDA5201FE8FC6F04259677", "C1C8EFDE61F76C73", - [ [ "India Test", "demo key", "india at example.net" ] ], 1 ], - [ "F8F1EDC73995AB739AD54B380C820C71D2699313", "BD0B108735F8F136", - [ [ "Juliet Test", "demo key", "juliet at example.net" ] ], 1 ], - [ "3FD11083779196C2ECDD9594AD1B0FAD43C2D0C7", "86CBB34A9AF64D02", - [ [ "Kilo Test", "demo key", "kilo at example.net" ] ], 1 ], - [ "1DDD28CEF714F5B03B8C246937CAB51FB79103F8", "0363B449FE56350C", - [ [ "Lima Test", "demo key", "lima at example.net" ] ], 1 ], - [ "2686AA191A278013992C72EBBE794852BE5CF886", "5F600A834F31EAE8", - [ [ "Mallory", "demo key", "" ], - [ "Mike Test", "demo key", "mike at example.net" ] ], 1 ], - [ "5AB9D6D7BAA1C95B3BAA3D9425B00FD430CEC684", "4C1D63308B70E472", - [ [ "November Test", "demo key", "november at example.net" ] ], 1 ], - [ "43929E89F8F79381678CAE515F6356BA6D9732AC", "FF0785712681619F", - [ [ "Oscar Test", "demo key", "oscar at example.net" ] ], 1 ], - [ "6FAA9C201E5E26DCBAEC39FD5D15E01D3FF13206", "2764E18263330D9C", - [ [ "Papa test", "demo key", "papa at example.net" ] ], 1 ], - [ "A7969DA1C3297AA96D49843F1C67EC133C661C84", "6CDCFC44A029ACF4", - [ [ "Quebec Test", "demo key", "quebec at example.net" ] ], 1 ], - [ "38FBE1E4BF6A5E1242C8F6A13BDBEDB1777FBED3", "9FAB805A11D102EA", - [ [ "Romeo Test", "demo key", "romeo at example.net" ] ], 1 ], - [ "045B2334ADD69FC221076841A5E67F7FA3AE3EA1", "93B88B0F0F1B50B4", - [ [ "Sierra Test", "demo key", "sierra at example.net" ] ], 1 ], - [ "ECAC774F4EEEB0620767044A58CB9A4C85A81F38", "97B60E01101C0402", - [ [ "Tango Test", "demo key", "tango at example.net" ] ], 1 ], - [ "0DBCAD3F08843B9557C6C4D4A94C0F75653244D6", "93079B915522BDB9", - [ [ "Uniform Test", "demo key", "uniform at example.net" ] ], 1 ], - [ "E8143C489C8D41124DC40D0B47AF4B6961F04784", "04071FB807287134", - [ [ "Victor Test", "demo key", "victor at example.org" ] ], 1 ], - [ "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE", "D7FBB421FD6E27F6", - [ [ "Whisky Test", "demo key", "whisky at example.net" ] ], 3, - check_whisky ], - [ "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", "5CC6F87F41E408BE", - [ [ "XRay Test", "demo key", "xray at example.net" ] ], 1 ], - [ "ED9B316F78644A58D042655A9EEF34CD4B11B25F", "5ADFD255F7B080AD", - [ [ "Yankee Test", "demo key", "yankee at example.net" ] ], 1 ], - [ "23FD347A419429BACCD5E72D6BC4778054ACD246", "EF9DC276A172C881", - [ [ "Zulu Test", "demo key", "zulu at example.net" ] ], 1 ], + [ + "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", + [["Alfa Test", "demo key", "alfa at example.net"], + ["Alpha Test", "demo key", "alpha at example.net"], + ["Alice", "demo key", ""]], 1 + ], + [ + "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "5381EA4EE29BA37F", + [["Bob", "demo key", ""], + ["Bravo Test", "demo key", "bravo at example.net"]], 1 + ], + [ + "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60", + [["Charlie Test", "demo key", "charlie at example.net"]], 1 + ], + [ + "6560C59C43D031C54D7C588EEBA9F240EB9DC9E6", "06F22880B0C45424", + [["Delta Test", "demo key", "delta at example.net"]], 1 + ], + [ + "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D", + [["Echelon", "demo key", + ""], ["Echo Test", "demo key", "echo at example.net"], + ["Eve", "demo key", ""]], 1 + ], + [ + "56D33268F7FE693FBB594762D4BF57F37372E243", "0A32EE79EE45198E", + [["Foxtrot Test", "demo key", "foxtrot at example.net"]], 1 + ], + [ + "C9C07DCC6621B9FB8D071B1D168410A48FC282E6", "247491CC9DCAD354", + [["Golf Test", "demo key", "golf at example.net"]], 1 + ], + [ + "9E91CBB11E4D4135583EF90513DB965534C6E3F1", "76E26537D622AD0A", + [["Hotel Test", "demo key", "hotel at example.net"]], 1 + ], + [ + "CD538D6CC9FB3D745ECDA5201FE8FC6F04259677", "C1C8EFDE61F76C73", + [["India Test", "demo key", "india at example.net"]], 1 + ], + [ + "F8F1EDC73995AB739AD54B380C820C71D2699313", "BD0B108735F8F136", + [["Juliet Test", "demo key", "juliet at example.net"]], 1 + ], + [ + "3FD11083779196C2ECDD9594AD1B0FAD43C2D0C7", "86CBB34A9AF64D02", + [["Kilo Test", "demo key", "kilo at example.net"]], 1 + ], + [ + "1DDD28CEF714F5B03B8C246937CAB51FB79103F8", "0363B449FE56350C", + [["Lima Test", "demo key", "lima at example.net"]], 1 + ], + [ + "2686AA191A278013992C72EBBE794852BE5CF886", "5F600A834F31EAE8", + [["Mallory", "demo key", ""], + ["Mike Test", "demo key", "mike at example.net"]], 1 + ], + [ + "5AB9D6D7BAA1C95B3BAA3D9425B00FD430CEC684", "4C1D63308B70E472", + [["November Test", "demo key", "november at example.net"]], 1 + ], + [ + "43929E89F8F79381678CAE515F6356BA6D9732AC", "FF0785712681619F", + [["Oscar Test", "demo key", "oscar at example.net"]], 1 + ], + [ + "6FAA9C201E5E26DCBAEC39FD5D15E01D3FF13206", "2764E18263330D9C", + [["Papa test", "demo key", "papa at example.net"]], 1 + ], + [ + "A7969DA1C3297AA96D49843F1C67EC133C661C84", "6CDCFC44A029ACF4", + [["Quebec Test", "demo key", "quebec at example.net"]], 1 + ], + [ + "38FBE1E4BF6A5E1242C8F6A13BDBEDB1777FBED3", "9FAB805A11D102EA", + [["Romeo Test", "demo key", "romeo at example.net"]], 1 + ], + [ + "045B2334ADD69FC221076841A5E67F7FA3AE3EA1", "93B88B0F0F1B50B4", + [["Sierra Test", "demo key", "sierra at example.net"]], 1 + ], + [ + "ECAC774F4EEEB0620767044A58CB9A4C85A81F38", "97B60E01101C0402", + [["Tango Test", "demo key", "tango at example.net"]], 1 + ], + [ + "0DBCAD3F08843B9557C6C4D4A94C0F75653244D6", "93079B915522BDB9", + [["Uniform Test", "demo key", "uniform at example.net"]], 1 + ], + [ + "E8143C489C8D41124DC40D0B47AF4B6961F04784", "04071FB807287134", + [["Victor Test", "demo key", "victor at example.org"]], 1 + ], + [ + "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE", "D7FBB421FD6E27F6", + [["Whisky Test", "demo key", "whisky at example.net"]], 3, check_whisky + ], + [ + "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", "5CC6F87F41E408BE", + [["XRay Test", "demo key", "xray at example.net"]], 1 + ], + [ + "ED9B316F78644A58D042655A9EEF34CD4B11B25F", "5ADFD255F7B080AD", + [["Yankee Test", "demo key", "yankee at example.net"]], 1 + ], + [ + "23FD347A419429BACCD5E72D6BC4778054ACD246", "EF9DC276A172C881", + [["Zulu Test", "demo key", "zulu at example.net"]], 1 + ], ] + def check_global(key, uids, n_subkeys): assert not key.revoked, "Key unexpectedly revoked" assert not key.expired, "Key unexpectedly expired" @@ -107,18 +162,18 @@ def check_global(key, uids, n_subkeys): assert key.can_sign, "Key unexpectedly unusable for signing" assert key.can_certify, "Key unexpectedly unusable for certifications" assert not key.secret, "Key unexpectedly secret" - assert not key.protocol != gpg.constants.protocol.OpenPGP, \ - "Key has unexpected protocol: {}".format(key.protocol) - assert not key.issuer_serial, \ - "Key unexpectedly carries issuer serial: {}".format(key.issuer_serial) - assert not key.issuer_name, \ - "Key unexpectedly carries issuer name: {}".format(key.issuer_name) - assert not key.chain_id, \ - "Key unexpectedly carries chain ID: {}".format(key.chain_id) - assert key.owner_trust == gpg.constants.validity.UNKNOWN, \ - "Key has unexpected owner trust: {}".format(key.owner_trust) - assert len(key.subkeys) - 1 == n_subkeys, \ - "Key `{}' has unexpected number of subkeys".format(uids[0][0]) + assert not key.protocol != gpg.constants.protocol. + OpenPGP, "Key has unexpected protocol: {}".format(key.protocol) + assert not key.issuer_serial, + "Key unexpectedly carries issuer serial: {}".format(key.issuer_serial) + assert not key.issuer_name, + "Key unexpectedly carries issuer name: {}".format(key.issuer_name) + assert not key.chain_id, + "Key unexpectedly carries chain ID: {}".format(key.chain_id) + assert key.owner_trust == gpg.constants.validity.UNKNOWN, + "Key has unexpected owner trust: {}".format(key.owner_trust) + assert len(key.subkeys) - 1 == n_subkeys, + "Key `{}' has unexpected number of subkeys".format(uids[0][0]) def check_subkey(fpr, which, subkey): @@ -128,54 +183,55 @@ def check_subkey(fpr, which, subkey): assert not subkey.invalid, which + " key unexpectedly invalid" if which == "Primary": - assert not subkey.can_encrypt, \ - which + " key unexpectedly usable for encryption" - assert subkey.can_sign, \ - which + " key unexpectedly unusable for signing" - assert subkey.can_certify, \ - which + " key unexpectedly unusable for certifications" + assert not subkey.can_encrypt, + which + " key unexpectedly usable for encryption" + assert subkey.can_sign, + which + " key unexpectedly unusable for signing" + assert subkey.can_certify, + which + " key unexpectedly unusable for certifications" else: - assert subkey.can_encrypt, \ - which + " key unexpectedly unusable for encryption" - assert not subkey.can_sign, \ - which + " key unexpectedly usable for signing" - assert not subkey.can_certify, \ - which + " key unexpectedly usable for certifications" + assert subkey.can_encrypt, + which + " key unexpectedly unusable for encryption" + assert not subkey.can_sign, + which + " key unexpectedly usable for signing" + assert not subkey.can_certify, + which + " key unexpectedly usable for certifications" assert not subkey.secret, which + " key unexpectedly secret" assert not subkey.is_cardkey, "Public key marked as card key" assert not subkey.card_number, "Public key with card number set" - assert not subkey.pubkey_algo != (gpg.constants.pk.DSA if which == "Primary" - else gpg.constants.pk.ELG_E), \ - which + " key has unexpected public key algo: {}".\ - format(subkey.pubkey_algo) - assert subkey.length == 1024, \ - which + " key has unexpected length: {}".format(subkey.length) - assert fpr.endswith(subkey.keyid), \ - which + " key has unexpected key ID: {}".format(subkey.keyid) - assert which == "Secondary" or subkey.fpr == fpr, \ - which + " key has unexpected fingerprint: {}".format(subkey.fpr) - assert not subkey.expires, \ - which + " key unexpectedly expires: {}".format(subkey.expires) + assert not subkey.pubkey_algo != + (gpg.constants.pk.DSA if which == "Primary" else gpg.constants.pk.ELG_E), + which + " key has unexpected public key algo: {}".format(subkey. + pubkey_algo) + assert subkey.length == 1024, + which + " key has unexpected length: {}".format(subkey.length) + assert fpr.endswith(subkey.keyid), + which + " key has unexpected key ID: {}".format(subkey.keyid) + assert which == "Secondary" or subkey.fpr == fpr, + which + " key has unexpected fingerprint: {}".format(subkey.fpr) + assert not subkey.expires, + which + " key unexpectedly expires: {}".format(subkey.expires) + def check_uid(which, ref, uid): assert not uid.revoked, which + " user ID unexpectedly revoked" assert not uid.invalid, which + " user ID unexpectedly invalid" - assert uid.validity == gpg.constants.validity.UNKNOWN, \ - which + " user ID has unexpected validity: {}".format(uid.validity) + assert uid.validity == gpg.constants.validity.UNKNOWN, + which + " user ID has unexpected validity: {}".format(uid.validity) assert not uid.signatures, which + " user ID unexpectedly signed" - assert uid.name == ref[0], \ - "Unexpected name in {} user ID: {!r}".format(which.lower(), uid.name) - assert uid.comment == ref[1], \ - "Unexpected comment in {} user ID: {!r}".format(which.lower(), - uid.comment) - assert uid.email == ref[2], \ - "Unexpected email in {} user ID: {!r}".format(which.lower(), uid.email) + assert uid.name == ref[0], + "Unexpected name in {} user ID: {!r}".format(which.lower(), uid.name) + assert uid.comment == ref[1], + "Unexpected comment in {} user ID: {!r}".format(which.lower(), uid.comment) + assert uid.email == ref[2], + "Unexpected email in {} user ID: {!r}".format(which.lower(), uid.email) + # Export all the data from our keyring... key_data = gpg.Data() with gpg.Context() as c: - c.op_export_keys([c.get_key(k[0]) for k in keys], 0, key_data) + c.op_export_keys([c.get_key(k[0]) for k in keys], 0, key_data) # ... rewind the tape... key_data.rewind() @@ -201,11 +257,11 @@ with support.EphemeralContext() as c: assert len(key.uids) == len(uids) check_uid("First", uids[0], key.uids[0]) if len(key.uids) > 1: - check_uid("Second", uids[1], key.uids[1]) + check_uid("Second", uids[1], key.uids[1]) if len(key.uids) > 2: - check_uid("Third", uids[2], key.uids[2]) + check_uid("Third", uids[2], key.uids[2]) if misc_check: - misc_check (uids[0][0], key) + misc_check(uids[0][0], key) assert len(list(c.keylist())) == 0, "Keys were imported" diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py index 4505d3c..b725fc3 100755 --- a/lang/python/tests/t-keylist.py +++ b/lang/python/tests/t-keylist.py @@ -18,87 +18,142 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support +del absolute_import, print_function, unicode_literals + c = gpg.Context() + # Check expration of keys. This test assumes three subkeys of which # 2 are expired; it is used with the "Whisky" test key. It has # already been checked that these 3 subkeys are available. def check_whisky(name, key): - sub1 = key.subkeys[2] - sub2 = key.subkeys[3] + sub1 = key.subkeys[2] + sub2 = key.subkeys[3] + + assert sub1.expired and sub2.expired, \ + "Subkey of `{}' not flagged as expired".format(name) + assert sub1.expires == 1129636886 and sub2.expires == 1129636939, \ + "Subkey of `{}' has wrong expiration date".format(name) - assert sub1.expired and sub2.expired, \ - "Subkey of `{}' not flagged as expired".format(name) - assert sub1.expires == 1129636886 and sub2.expires == 1129636939, \ - "Subkey of `{}' has wrong expiration date".format(name) keys = [ - [ "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", - [ [ "Alfa Test", "demo key", "alfa at example.net" ], - [ "Alpha Test", "demo key", "alpha at example.net" ], - [ "Alice", "demo key", "" ] ], 1 ], - [ "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "5381EA4EE29BA37F", - [ [ "Bob", "demo key", "" ], - [ "Bravo Test", "demo key", "bravo at example.net" ] ], 1 ], - [ "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60", - [ [ "Charlie Test", "demo key", "charlie at example.net" ] ], 1 ], - [ "6560C59C43D031C54D7C588EEBA9F240EB9DC9E6", "06F22880B0C45424", - [ [ "Delta Test", "demo key", "delta at example.net" ] ], 1 ], - [ "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D", - [ [ "Echelon", "demo key", "" ], - [ "Echo Test", "demo key", "echo at example.net" ], - [ "Eve", "demo key", "" ] ], 1 ], - [ "56D33268F7FE693FBB594762D4BF57F37372E243", "0A32EE79EE45198E", - [ [ "Foxtrot Test", "demo key", "foxtrot at example.net" ] ], 1 ], - [ "C9C07DCC6621B9FB8D071B1D168410A48FC282E6", "247491CC9DCAD354", - [ [ "Golf Test", "demo key", "golf at example.net" ] ], 1 ], - [ "9E91CBB11E4D4135583EF90513DB965534C6E3F1", "76E26537D622AD0A", - [ [ "Hotel Test", "demo key", "hotel at example.net" ] ], 1 ], - [ "CD538D6CC9FB3D745ECDA5201FE8FC6F04259677", "C1C8EFDE61F76C73", - [ [ "India Test", "demo key", "india at example.net" ] ], 1 ], - [ "F8F1EDC73995AB739AD54B380C820C71D2699313", "BD0B108735F8F136", - [ [ "Juliet Test", "demo key", "juliet at example.net" ] ], 1 ], - [ "3FD11083779196C2ECDD9594AD1B0FAD43C2D0C7", "86CBB34A9AF64D02", - [ [ "Kilo Test", "demo key", "kilo at example.net" ] ], 1 ], - [ "1DDD28CEF714F5B03B8C246937CAB51FB79103F8", "0363B449FE56350C", - [ [ "Lima Test", "demo key", "lima at example.net" ] ], 1 ], - [ "2686AA191A278013992C72EBBE794852BE5CF886", "5F600A834F31EAE8", - [ [ "Mallory", "demo key", "" ], - [ "Mike Test", "demo key", "mike at example.net" ] ], 1 ], - [ "5AB9D6D7BAA1C95B3BAA3D9425B00FD430CEC684", "4C1D63308B70E472", - [ [ "November Test", "demo key", "november at example.net" ] ], 1 ], - [ "43929E89F8F79381678CAE515F6356BA6D9732AC", "FF0785712681619F", - [ [ "Oscar Test", "demo key", "oscar at example.net" ] ], 1 ], - [ "6FAA9C201E5E26DCBAEC39FD5D15E01D3FF13206", "2764E18263330D9C", - [ [ "Papa test", "demo key", "papa at example.net" ] ], 1 ], - [ "A7969DA1C3297AA96D49843F1C67EC133C661C84", "6CDCFC44A029ACF4", - [ [ "Quebec Test", "demo key", "quebec at example.net" ] ], 1 ], - [ "38FBE1E4BF6A5E1242C8F6A13BDBEDB1777FBED3", "9FAB805A11D102EA", - [ [ "Romeo Test", "demo key", "romeo at example.net" ] ], 1 ], - [ "045B2334ADD69FC221076841A5E67F7FA3AE3EA1", "93B88B0F0F1B50B4", - [ [ "Sierra Test", "demo key", "sierra at example.net" ] ], 1 ], - [ "ECAC774F4EEEB0620767044A58CB9A4C85A81F38", "97B60E01101C0402", - [ [ "Tango Test", "demo key", "tango at example.net" ] ], 1 ], - [ "0DBCAD3F08843B9557C6C4D4A94C0F75653244D6", "93079B915522BDB9", - [ [ "Uniform Test", "demo key", "uniform at example.net" ] ], 1 ], - [ "E8143C489C8D41124DC40D0B47AF4B6961F04784", "04071FB807287134", - [ [ "Victor Test", "demo key", "victor at example.org" ] ], 1 ], - [ "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE", "D7FBB421FD6E27F6", - [ [ "Whisky Test", "demo key", "whisky at example.net" ] ], 3, - check_whisky ], - [ "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", "5CC6F87F41E408BE", - [ [ "XRay Test", "demo key", "xray at example.net" ] ], 1 ], - [ "ED9B316F78644A58D042655A9EEF34CD4B11B25F", "5ADFD255F7B080AD", - [ [ "Yankee Test", "demo key", "yankee at example.net" ] ], 1 ], - [ "23FD347A419429BACCD5E72D6BC4778054ACD246", "EF9DC276A172C881", - [ [ "Zulu Test", "demo key", "zulu at example.net" ] ], 1 ], + [ + "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", + [["Alfa Test", "demo key", + "alfa at example.net"], ["Alpha Test", "demo key", "alpha at example.net"], + ["Alice", "demo key", ""]], 1 + ], + [ + "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "5381EA4EE29BA37F", + [["Bob", "demo key", ""], + ["Bravo Test", "demo key", "bravo at example.net"]], 1 + ], + [ + "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60", + [["Charlie Test", "demo key", "charlie at example.net"]], 1 + ], + [ + "6560C59C43D031C54D7C588EEBA9F240EB9DC9E6", "06F22880B0C45424", + [["Delta Test", "demo key", "delta at example.net"]], 1 + ], + [ + "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D", + [["Echelon", "demo key", + ""], ["Echo Test", "demo key", "echo at example.net"], + ["Eve", "demo key", ""]], 1 + ], + [ + "56D33268F7FE693FBB594762D4BF57F37372E243", "0A32EE79EE45198E", + [["Foxtrot Test", "demo key", "foxtrot at example.net"]], 1 + ], + [ + "C9C07DCC6621B9FB8D071B1D168410A48FC282E6", "247491CC9DCAD354", + [["Golf Test", "demo key", "golf at example.net"]], 1 + ], + [ + "9E91CBB11E4D4135583EF90513DB965534C6E3F1", "76E26537D622AD0A", + [["Hotel Test", "demo key", "hotel at example.net"]], 1 + ], + [ + "CD538D6CC9FB3D745ECDA5201FE8FC6F04259677", "C1C8EFDE61F76C73", + [["India Test", "demo key", "india at example.net"]], 1 + ], + [ + "F8F1EDC73995AB739AD54B380C820C71D2699313", "BD0B108735F8F136", + [["Juliet Test", "demo key", "juliet at example.net"]], 1 + ], + [ + "3FD11083779196C2ECDD9594AD1B0FAD43C2D0C7", "86CBB34A9AF64D02", + [["Kilo Test", "demo key", "kilo at example.net"]], 1 + ], + [ + "1DDD28CEF714F5B03B8C246937CAB51FB79103F8", "0363B449FE56350C", + [["Lima Test", "demo key", "lima at example.net"]], 1 + ], + [ + "2686AA191A278013992C72EBBE794852BE5CF886", "5F600A834F31EAE8", + [["Mallory", "demo key", ""], + ["Mike Test", "demo key", "mike at example.net"]], 1 + ], + [ + "5AB9D6D7BAA1C95B3BAA3D9425B00FD430CEC684", "4C1D63308B70E472", + [["November Test", "demo key", "november at example.net"]], 1 + ], + [ + "43929E89F8F79381678CAE515F6356BA6D9732AC", "FF0785712681619F", + [["Oscar Test", "demo key", "oscar at example.net"]], 1 + ], + [ + "6FAA9C201E5E26DCBAEC39FD5D15E01D3FF13206", "2764E18263330D9C", + [["Papa test", "demo key", "papa at example.net"]], 1 + ], + [ + "A7969DA1C3297AA96D49843F1C67EC133C661C84", "6CDCFC44A029ACF4", + [["Quebec Test", "demo key", "quebec at example.net"]], 1 + ], + [ + "38FBE1E4BF6A5E1242C8F6A13BDBEDB1777FBED3", "9FAB805A11D102EA", + [["Romeo Test", "demo key", "romeo at example.net"]], 1 + ], + [ + "045B2334ADD69FC221076841A5E67F7FA3AE3EA1", "93B88B0F0F1B50B4", + [["Sierra Test", "demo key", "sierra at example.net"]], 1 + ], + [ + "ECAC774F4EEEB0620767044A58CB9A4C85A81F38", "97B60E01101C0402", + [["Tango Test", "demo key", "tango at example.net"]], 1 + ], + [ + "0DBCAD3F08843B9557C6C4D4A94C0F75653244D6", "93079B915522BDB9", + [["Uniform Test", "demo key", "uniform at example.net"]], 1 + ], + [ + "E8143C489C8D41124DC40D0B47AF4B6961F04784", "04071FB807287134", + [["Victor Test", "demo key", "victor at example.org"]], 1 + ], + [ + "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE", "D7FBB421FD6E27F6", + [["Whisky Test", "demo key", "whisky at example.net"]], 3, check_whisky + ], + [ + "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", "5CC6F87F41E408BE", + [["XRay Test", "demo key", "xray at example.net"]], 1 + ], + [ + "ED9B316F78644A58D042655A9EEF34CD4B11B25F", "5ADFD255F7B080AD", + [["Yankee Test", "demo key", "yankee at example.net"]], 1 + ], + [ + "23FD347A419429BACCD5E72D6BC4778054ACD246", "EF9DC276A172C881", + [["Zulu Test", "demo key", "zulu at example.net"]], 1 + ], ] + def check_global(key, uids, n_subkeys): assert not key.revoked, "Key unexpectedly revoked" assert not key.expired, "Key unexpectedly expired" @@ -107,25 +162,25 @@ def check_global(key, uids, n_subkeys): assert key.can_sign, "Key unexpectedly unusable for signing" assert key.can_certify, "Key unexpectedly unusable for certifications" assert not key.secret, "Key unexpectedly secret" - assert not key.protocol != gpg.constants.protocol.OpenPGP, \ - "Key has unexpected protocol: {}".format(key.protocol) - assert not key.issuer_serial, \ - "Key unexpectedly carries issuer serial: {}".format(key.issuer_serial) - assert not key.issuer_name, \ - "Key unexpectedly carries issuer name: {}".format(key.issuer_name) - assert not key.chain_id, \ - "Key unexpectedly carries chain ID: {}".format(key.chain_id) + assert not key.protocol != gpg.constants.protocol.OpenPGP, + "Key has unexpected protocol: {}".format(key.protocol) + assert not key.issuer_serial, + "Key unexpectedly carries issuer serial: {}".format(key.issuer_serial) + assert not key.issuer_name, + "Key unexpectedly carries issuer name: {}".format(key.issuer_name) + assert not key.chain_id, + "Key unexpectedly carries chain ID: {}".format(key.chain_id) # Only key Alfa is trusted - assert key.uids[0].name == 'Alfa Test' \ - or key.owner_trust == gpg.constants.validity.UNKNOWN, \ - "Key has unexpected owner trust: {}".format(key.owner_trust) - assert key.uids[0].name != 'Alfa Test' \ - or key.owner_trust == gpg.constants.validity.ULTIMATE, \ - "Key has unexpected owner trust: {}".format(key.owner_trust) + assert key.uids[0].name == 'Alfa Test' or + key.owner_trust == gpg.constants.validity.UNKNOWN, + "Key has unexpected owner trust: {}".format(key.owner_trust) + assert key.uids[0].name != 'Alfa Test' or key.owner_trust == gpg.constants. + validity.ULTIMATE, "Key has unexpected owner trust: {}". + format(key.owner_trust) - assert len(key.subkeys) - 1 == n_subkeys, \ - "Key `{}' has unexpected number of subkeys".format(uids[0][0]) + assert len(key.subkeys) - 1 == n_subkeys, + "Key `{}' has unexpected number of subkeys".format(uids[0][0]) def check_subkey(fpr, which, subkey): @@ -152,18 +207,19 @@ def check_subkey(fpr, which, subkey): assert not subkey.secret, which + " key unexpectedly secret" assert not subkey.is_cardkey, "Public key marked as card key" assert not subkey.card_number, "Public key with card number set" - assert not subkey.pubkey_algo != (gpg.constants.pk.DSA if which == "Primary" - else gpg.constants.pk.ELG_E), \ - which + " key has unexpected public key algo: {}".\ - format(subkey.pubkey_algo) - assert subkey.length == 1024, \ - which + " key has unexpected length: {}".format(subkey.length) - assert fpr.endswith(subkey.keyid), \ - which + " key has unexpected key ID: {}".format(subkey.keyid) - assert which == "Secondary" or subkey.fpr == fpr, \ - which + " key has unexpected fingerprint: {}".format(subkey.fpr) - assert not subkey.expires, \ - which + " key unexpectedly expires: {}".format(subkey.expires) + assert not subkey.pubkey_algo != + (gpg.constants.pk.DSA if which == "Primary" else gpg.constants.pk.ELG_E), + which + " key has unexpected public key algo: {}".format(subkey. + pubkey_algo) + assert subkey.length == 1024, + which + " key has unexpected length: {}".format(subkey.length) + assert fpr.endswith(subkey.keyid), + which + " key has unexpected key ID: {}".format(subkey.keyid) + assert which == "Secondary" or subkey.fpr == fpr, + which + " key has unexpected fingerprint: {}".format(subkey.fpr) + assert not subkey.expires, + which + " key unexpectedly expires: {}".format(subkey.expires) + def check_uid(which, ref, uid): assert not uid.revoked, which + " user ID unexpectedly revoked" @@ -171,20 +227,21 @@ def check_uid(which, ref, uid): assert uid.validity == (gpg.constants.validity.UNKNOWN if uid.name.split()[0] not in {'Alfa', 'Alpha', 'Alice'} else - gpg.constants.validity.ULTIMATE), \ - which + " user ID has unexpectedly validity: {}".format(uid.validity) + gpg.constants.validity.ULTIMATE), + which + " user ID has unexpectedly validity: {}".format(uid.validity) assert not uid.signatures, which + " user ID unexpectedly signed" - assert uid.name == ref[0], \ - "Unexpected name in {} user ID: {!r}".format(which.lower(), uid.name) - assert uid.comment == ref[1], \ - "Unexpected comment in {} user ID: {!r}".format(which.lower(), - uid.comment) - assert uid.email == ref[2], \ - "Unexpected email in {} user ID: {!r}".format(which.lower(), uid.email) + assert uid.name == ref[0], + "Unexpected name in {} user ID: {!r}".format(which.lower(), uid.name) + assert uid.comment == ref[1], + "Unexpected comment in {} user ID: {!r}".format(which.lower(), + uid.comment) + assert uid.email == ref[2], + "Unexpected email in {} user ID: {!r}".format(which.lower(), uid.email) + i = 0 c.op_keylist_start(None, False) -key = c.op_keylist_next () +key = c.op_keylist_next() while key: try: if len(keys[i]) == 4: @@ -204,20 +261,19 @@ while key: assert len(key.uids) == len(uids) check_uid("First", uids[0], key.uids[0]) if len(key.uids) > 1: - check_uid("Second", uids[1], key.uids[1]) + check_uid("Second", uids[1], key.uids[1]) if len(key.uids) > 2: - check_uid("Third", uids[2], key.uids[2]) + check_uid("Third", uids[2], key.uids[2]) if misc_check: - misc_check (uids[0][0], key) - key = c.op_keylist_next () + misc_check(uids[0][0], key) + key = c.op_keylist_next() i += 1 c.op_keylist_end() result = c.op_keylist_result() assert not result.truncated, "Key listing unexpectedly truncated" - # We test for a parameter-less keylist keyring_length = len(list(c.op_keylist_all())) assert keyring_length > 1,\ @@ -226,13 +282,12 @@ assert keyring_length > 1,\ # Then we do want to call with a pattern, only # i.e. without giving secret=0 alpha_keys = list(c.op_keylist_all(b"Alpha")) -assert len(alpha_keys) == 1, "Expected only one key for 'Alpha', got %r" % len(alpha_keys) - +assert len(alpha_keys) == 1, "Expected only one key for 'Alpha', got %r" % len( + alpha_keys) # Check negative result. assert len(list(c.keylist("no such key in sight"))) == 0 - for i, key in enumerate(c.keylist()): try: if len(keys[i]) == 4: @@ -252,31 +307,30 @@ for i, key in enumerate(c.keylist()): assert len(key.uids) == len(uids) check_uid("First", uids[0], key.uids[0]) if len(key.uids) > 1: - check_uid("Second", uids[1], key.uids[1]) + check_uid("Second", uids[1], key.uids[1]) if len(key.uids) > 2: - check_uid("Third", uids[2], key.uids[2]) + check_uid("Third", uids[2], key.uids[2]) if misc_check: - misc_check (uids[0][0], key) - + misc_check(uids[0][0], key) # check get_key() with gpg.Context() as c: - c.get_key(support.alpha) - c.get_key(support.alpha, secret=True) - - c.get_key(support.bob) - try: - c.get_key(support.bob, secret=True) - except KeyError: - pass - else: - assert False, "Expected KeyError" - - # Legacy error - try: - c.get_key(support.no_such_key) - except gpg.errors.GPGMEError: - pass - else: - assert False, "Expected GPGMEError" + c.get_key(support.alpha) + c.get_key(support.alpha, secret=True) + + c.get_key(support.bob) + try: + c.get_key(support.bob, secret=True) + except KeyError: + pass + else: + assert False, "Expected KeyError" + + # Legacy error + try: + c.get_key(support.no_such_key) + except gpg.errors.GPGMEError: + pass + else: + assert False, "Expected GPGMEError" diff --git a/lang/python/tests/t-protocol-assuan.py b/lang/python/tests/t-protocol-assuan.py index 8da5035..c337c3b 100755 --- a/lang/python/tests/t-protocol-assuan.py +++ b/lang/python/tests/t-protocol-assuan.py @@ -18,20 +18,21 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: # Do nothing. err = c.assuan_transact('nop') - assert err == None + assert err is None err = c.assuan_transact(b'NOP') - assert err == None + assert err is None err = c.assuan_transact(['NOP']) - assert err == None + assert err is None err = c.assuan_transact('idontexist') assert err.getsource() == gpg.errors.SOURCE_GPGAGENT @@ -41,6 +42,7 @@ with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: c.assuan_transact(['GET_CONFIRMATION', 'Hello there']) data = [] + def data_cb(line): data.append(line) @@ -57,6 +59,7 @@ with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: # XXX HELP sends status lines if we could use ASSUAN_CONVEY_COMMENTS. status = [] + def status_cb(line, args): status.append((line, args)) diff --git a/lang/python/tests/t-quick-key-creation.py b/lang/python/tests/t-quick-key-creation.py index 8b7372e..4720928 100755 --- a/lang/python/tests/t-quick-key-creation.py +++ b/lang/python/tests/t-quick-key-creation.py @@ -18,7 +18,6 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import itertools @@ -27,6 +26,8 @@ import time import support support.assert_gpg_version((2, 1, 2)) +del absolute_import, print_function, unicode_literals + alpha = "Alpha " with support.EphemeralContext() as ctx: @@ -51,14 +52,16 @@ with support.EphemeralContext() as ctx: res2 = ctx.create_key(alpha, force=True) assert res.fpr != res2.fpr - # From here on, we use one context, and create unique UIDs uid_counter = 0 + + def make_uid(): global uid_counter uid_counter += 1 return "user{0}@invalid.example.org".format(uid_counter) + with support.EphemeralContext() as ctx: # Check gpg.constants.create.NOEXPIRE... res = ctx.create_key(make_uid(), expires=False) @@ -77,10 +80,8 @@ with support.EphemeralContext() as ctx: "Primary keys expiration time is off" # Check capabilities - for sign, encrypt, certify, authenticate in itertools.product([False, True], - [False, True], - [False, True], - [False, True]): + for sign, encrypt, certify, authenticate in itertools. + product([False, True], [False, True], [False, True], [False, True]): # Filter some out if not (sign or encrypt or certify or authenticate): # This triggers the default capabilities tested before. @@ -89,9 +90,13 @@ with support.EphemeralContext() as ctx: # The primary key always certifies. continue - res = ctx.create_key(make_uid(), algorithm="rsa", - sign=sign, encrypt=encrypt, certify=certify, - authenticate=authenticate) + res = ctx.create_key( + make_uid(), + algorithm="rsa", + sign=sign, + encrypt=encrypt, + certify=certify, + authenticate=authenticate) key = ctx.get_key(res.fpr, secret=True) assert key.fpr == res.fpr assert len(key.subkeys) == 1, \ @@ -125,13 +130,16 @@ with support.EphemeralContext() as ctx: recipient = make_uid() passphrase = "streng geheim" res = ctx.create_key(recipient, passphrase=passphrase) - ciphertext, _, _ = ctx.encrypt(b"hello there", recipients=[ctx.get_key(res.fpr)]) + ciphertext, _, _ = ctx.encrypt( + b"hello there", recipients=[ctx.get_key(res.fpr)]) cb_called = False + def cb(*args): global cb_called cb_called = True return passphrase + ctx.pinentry_mode = gpg.constants.PINENTRY_MODE_LOOPBACK ctx.set_passphrase_cb(cb) diff --git a/lang/python/tests/t-quick-key-manipulation.py b/lang/python/tests/t-quick-key-manipulation.py index 37e05b3..ade171e 100755 --- a/lang/python/tests/t-quick-key-manipulation.py +++ b/lang/python/tests/t-quick-key-manipulation.py @@ -18,7 +18,6 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import os import gpg @@ -27,6 +26,8 @@ import sys import support support.assert_gpg_version((2, 1, 14)) +del absolute_import, print_function, unicode_literals + alpha = "Alpha " bravo = "Bravo " @@ -111,9 +112,11 @@ with support.EphemeralContext() as ctx: ctx.key_tofu_policy(key, policy) - keys = list(ctx.keylist(key.uids[0].uid, - mode=(gpg.constants.keylist.mode.LOCAL - |gpg.constants.keylist.mode.WITH_TOFU))) + keys = list( + ctx.keylist( + key.uids[0].uid, + mode=(gpg.constants.keylist.mode.LOCAL | + gpg.constants.keylist.mode.WITH_TOFU))) assert len(keys) == 1 if policy == gpg.constants.tofu.policy.AUTO: diff --git a/lang/python/tests/t-quick-key-signing.py b/lang/python/tests/t-quick-key-signing.py index 3d648c5..6f9b8a7 100755 --- a/lang/python/tests/t-quick-key-signing.py +++ b/lang/python/tests/t-quick-key-signing.py @@ -18,7 +18,6 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import itertools @@ -27,8 +26,11 @@ import time import support support.assert_gpg_version((2, 1, 1)) +del absolute_import, print_function, unicode_literals + with support.EphemeralContext() as ctx: uid_counter = 0 + def make_uid(): global uid_counter uid_counter += 1 @@ -43,10 +45,16 @@ with support.EphemeralContext() as ctx: return key, uids def check_sigs(key, expected_sigs): - keys = list(ctx.keylist(key.fpr, mode=(gpg.constants.keylist.mode.LOCAL - |gpg.constants.keylist.mode.SIGS))) + keys = list( + ctx.keylist( + key.fpr, + mode=(gpg.constants.keylist.mode.LOCAL | + gpg.constants.keylist.mode.SIGS))) assert len(keys) == 1 - key_uids = {uid.uid: [s for s in uid.signatures] for uid in keys[0].uids} + key_uids = { + uid.uid: [s for s in uid.signatures] + for uid in keys[0].uids + } expected = list(expected_sigs) while key_uids and expected: @@ -76,9 +84,12 @@ with support.EphemeralContext() as ctx: assert s.exportable assert s.expires == 0 - check_sigs(key_b, itertools.product(uids_b, [key_b], [exportable_non_expiring])) + check_sigs(key_b, + itertools.product(uids_b, [key_b], [exportable_non_expiring])) ctx.key_sign(key_b) - check_sigs(key_b, itertools.product(uids_b, [key_b, key_a], [exportable_non_expiring])) + check_sigs( + key_b, + itertools.product(uids_b, [key_b, key_a], [exportable_non_expiring])) # Create a non-exportable signature, and explicitly name all uids. key_c, uids_c = make_key() @@ -89,11 +100,12 @@ with support.EphemeralContext() as ctx: assert s.expires == 0 ctx.key_sign(key_c, local=True, uids=uids_c) - check_sigs(key_c, - list(itertools.product(uids_c, [key_c], - [exportable_non_expiring])) - + list(itertools.product(uids_c, [key_b, key_a], - [non_exportable_non_expiring]))) + check_sigs( + key_c, + list(itertools.product(uids_c, [key_c], [exportable_non_expiring])) + + list( + itertools.product(uids_c, [key_b, key_a], + [non_exportable_non_expiring]))) # Create a non-exportable, expiring signature for a single uid. key_d, uids_d = make_key() @@ -106,16 +118,16 @@ with support.EphemeralContext() as ctx: assert abs(time.time() + expires_in - s.expires) < slack ctx.key_sign(key_d, local=True, expires_in=expires_in, uids=uids_d[0]) - check_sigs(key_d, - list(itertools.product(uids_d, [key_d], - [exportable_non_expiring])) - + list(itertools.product(uids_d[:1], [key_c], - [non_exportable_expiring]))) + check_sigs( + key_d, + list(itertools.product(uids_d, [key_d], [exportable_non_expiring])) + + list( + itertools.product(uids_d[:1], [key_c], [non_exportable_expiring]))) # Now sign the second in the same fashion, but use a singleton list. ctx.key_sign(key_d, local=True, expires_in=expires_in, uids=uids_d[1:2]) - check_sigs(key_d, - list(itertools.product(uids_d, [key_d], - [exportable_non_expiring])) - + list(itertools.product(uids_d[:2], [key_c], - [non_exportable_expiring]))) + check_sigs( + key_d, + list(itertools.product(uids_d, [key_d], [exportable_non_expiring])) + + list( + itertools.product(uids_d[:2], [key_c], [non_exportable_expiring]))) diff --git a/lang/python/tests/t-quick-subkey-creation.py b/lang/python/tests/t-quick-subkey-creation.py index ad4f35c..30424c1 100755 --- a/lang/python/tests/t-quick-subkey-creation.py +++ b/lang/python/tests/t-quick-subkey-creation.py @@ -18,7 +18,6 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import itertools @@ -26,6 +25,8 @@ import time import support +del absolute_import, print_function, unicode_literals + alpha = "Alpha " bravo = "Bravo " @@ -59,16 +60,15 @@ with support.EphemeralContext() as ctx: "subkeys expiration time is off" # Check capabilities - for sign, encrypt, authenticate in itertools.product([False, True], - [False, True], - [False, True]): + for sign, encrypt, authenticate in itertools. + product([False, True], [False, True], [False, True]): # Filter some out if not (sign or encrypt or authenticate): # This triggers the default capabilities tested before. continue - res = ctx.create_subkey(key, sign=sign, encrypt=encrypt, - authenticate=authenticate) + res = ctx.create_subkey( + key, sign=sign, encrypt=encrypt, authenticate=authenticate) subkey = get_subkey(res.fpr) assert sign == subkey.can_sign assert encrypt == subkey.can_encrypt @@ -92,18 +92,21 @@ with support.EphemeralContext() as ctx: # so that we have a key with just one encryption subkey. bravo_res = ctx.create_key(bravo, certify=True) bravo_key = ctx.get_key(bravo_res.fpr) - assert len(bravo_key.subkeys) == 1, "Expected one primary key and no subkeys" + assert len( + bravo_key.subkeys) == 1, "Expected one primary key and no subkeys" passphrase = "streng geheim" res = ctx.create_subkey(bravo_key, passphrase=passphrase) - ciphertext, _, _ = ctx.encrypt(b"hello there", - recipients=[ctx.get_key(bravo_res.fpr)]) + ciphertext, _, _ = ctx.encrypt( + b"hello there", recipients=[ctx.get_key(bravo_res.fpr)]) cb_called = False + def cb(*args): global cb_called cb_called = True return passphrase + ctx.pinentry_mode = gpg.constants.PINENTRY_MODE_LOOPBACK ctx.set_passphrase_cb(cb) diff --git a/lang/python/tests/t-sig-notation.py b/lang/python/tests/t-sig-notation.py index bc8da2e..5960f44 100755 --- a/lang/python/tests/t-sig-notation.py +++ b/lang/python/tests/t-sig-notation.py @@ -18,29 +18,30 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import os import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals expected_notations = { - "laughing at me": ("Just Squeeze Me", gpg.constants.sig.notation.HUMAN_READABLE), - "preferred-email-encoding at pgp.com": ("pgpmime", - gpg.constants.sig.notation.HUMAN_READABLE - | gpg.constants.sig.notation.CRITICAL), + "laughing at me": ("Just Squeeze Me", + gpg.constants.sig.notation.HUMAN_READABLE), + "preferred-email-encoding at pgp.com": + ("pgpmime", gpg.constants.sig.notation.HUMAN_READABLE | + gpg.constants.sig.notation.CRITICAL), None: ("http://www.gnu.org/policy/", 0), } # GnuPG prior to 2.1.13 did not report the critical flag correctly. with gpg.Context() as c: version = c.engine_info.version - have_correct_sig_data = not (version.startswith("1.") - or version.startswith("2.0.") - or version == "2.1.1" - or (version.startswith("2.1.1") - and version[5] < '3')) + have_correct_sig_data = not ( + version.startswith("1.") or version.startswith("2.0.") or + (version.startswith("2.1.") and int(version[4:]) < 13)) + def check_result(result): assert len(result.signatures) == 1, "Unexpected number of signatures" @@ -48,8 +49,8 @@ def check_result(result): assert len(sig.notations) == len(expected_notations) for r in sig.notations: - assert not 'name_len' in dir(r) - assert not 'value_len' in dir(r) + assert 'name_len' not in dir(r) + assert 'value_len' not in dir(r) assert r.name in expected_notations value, flags = expected_notations.pop(r.name) @@ -63,6 +64,7 @@ def check_result(result): assert len(expected_notations) == 0 + source = gpg.Data("Hallo Leute\n") signed = gpg.Data() diff --git a/lang/python/tests/t-sign.py b/lang/python/tests/t-sign.py index d375729..3ad05e8 100755 --- a/lang/python/tests/t-sign.py +++ b/lang/python/tests/t-sign.py @@ -18,15 +18,18 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import os import gpg import support +del absolute_import, print_function, unicode_literals + + def fail(msg): raise RuntimeError(msg) + def check_result(r, typ): if r.invalid_signers: fail("Invalid signer found: {}".format(r.invalid_signers.fpr)) @@ -43,16 +46,15 @@ def check_result(r, typ): signature.pubkey_algo)) if signature.hash_algo != gpg.constants.md.SHA1: - fail("Wrong hash algorithm reported: {}".format( - signature.hash_algo)) + fail("Wrong hash algorithm reported: {}".format(signature.hash_algo)) if signature.sig_class != 1: - fail("Wrong signature class reported: {}".format( - signature.sig_class)) + fail("Wrong signature class reported: {}".format(signature.sig_class)) if signature.fpr != "A0FF4590BB6122EDEF6E3C542D727CC768697734": fail("Wrong fingerprint reported: {}".format(signature.fpr)) + c = gpg.Context() c.set_textmode(True) c.set_armor(True) diff --git a/lang/python/tests/t-signers.py b/lang/python/tests/t-signers.py index 5864ee5..119ab77 100755 --- a/lang/python/tests/t-signers.py +++ b/lang/python/tests/t-signers.py @@ -18,14 +18,17 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support +del absolute_import, print_function, unicode_literals + + def fail(msg): raise RuntimeError(msg) + def check_result(r, typ): if r.invalid_signers: fail("Invalid signer found: {}".format(r.invalid_signers.fpr)) @@ -53,6 +56,7 @@ def check_result(r, typ): "23FD347A419429BACCD5E72D6BC4778054ACD246"): fail("Wrong fingerprint reported: {}".format(signature.fpr)) + c = gpg.Context() c.set_textmode(True) c.set_armor(True) diff --git a/lang/python/tests/t-trustlist.py b/lang/python/tests/t-trustlist.py index 89524bb..ffa0b96 100755 --- a/lang/python/tests/t-trustlist.py +++ b/lang/python/tests/t-trustlist.py @@ -18,18 +18,21 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals c = gpg.Context() + def dump_item(item): - print("l={} k={} t={} o={} v={} u={}".format( - item.level, item.keyid, item.type, item.owner_trust, - item.validity, item.name)) + print("l={} k={} t={} o={} v={} u={}".format(item.level, item.keyid, + item.type, item.owner_trust, + item.validity, item.name)) + c.op_trustlist_start("alice", 0) while True: diff --git a/lang/python/tests/t-verify.py b/lang/python/tests/t-verify.py index 320dae6..70a6c1c 100755 --- a/lang/python/tests/t-verify.py +++ b/lang/python/tests/t-verify.py @@ -18,16 +18,17 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import os import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals test_text1 = b"Just GNU it!\n" -test_text1f= b"Just GNU it?\n" +test_text1f = b"Just GNU it?\n" test_sig1 = b"""-----BEGIN PGP SIGNATURE----- iN0EABECAJ0FAjoS+i9FFIAAAAAAAwA5YmFyw7bDpMO8w58gZGFzIHdhcmVuIFVt @@ -60,6 +61,7 @@ UqVooWlGXHwNw/xg/fVzt9VNbtjtJ/fhUqYo0/LyCGEA -----END PGP MESSAGE----- """ + def check_result(result, summary, validity, fpr, status, notation): assert len(result.signatures) == 1, "Unexpected number of signatures" sig = result.signatures[0] @@ -76,14 +78,16 @@ def check_result(result, summary, validity, fpr, status, notation): if sys.version_info[0] < 3 else b"\xc3\xb6\xc3\xa4\xc3\xbc\xc3\x9f".decode() + " das waren Umlaute und jetzt ein prozent%-Zeichen"), - "foobar.1": "this is a notation data with 2 lines", - None: "http://www.gu.org/policy/", + "foobar.1": + "this is a notation data with 2 lines", + None: + "http://www.gu.org/policy/", } assert len(sig.notations) == len(expected_notations) for r in sig.notations: - assert not 'name_len' in dir(r) - assert not 'value_len' in dir(r) + assert 'name_len' not in dir(r) + assert 'value_len' not in dir(r) assert r.name in expected_notations assert r.value == expected_notations[r.name], \ "Expected {!r}, got {!r}".format(expected_notations[r.name], @@ -96,7 +100,9 @@ def check_result(result, summary, validity, fpr, status, notation): assert sig.validity == validity, \ "Unexpected signature validity: {}, want: {}".format( sig.validity, validity) - assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR + assert gpg.errors.GPGMEError( + sig.validity_reason).getcode() == gpg.errors.NO_ERROR + c = gpg.Context() c.set_armor(True) @@ -108,9 +114,8 @@ c.op_verify(sig, text, None) result = c.op_verify_result() check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, gpg.constants.validity.FULL, - "A0FF4590BB6122EDEF6E3C542D727CC768697734", - gpg.errors.NO_ERROR, True) - + "A0FF4590BB6122EDEF6E3C542D727CC768697734", gpg.errors.NO_ERROR, + True) # Checking a manipulated message. text = gpg.Data(test_text1f) @@ -127,8 +132,8 @@ c.op_verify(sig, None, text) result = c.op_verify_result() check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, gpg.constants.validity.FULL, - "A0FF4590BB6122EDEF6E3C542D727CC768697734", - gpg.errors.NO_ERROR, False) + "A0FF4590BB6122EDEF6E3C542D727CC768697734", gpg.errors.NO_ERROR, + False) # Checking an invalid message. text = gpg.Data() @@ -141,33 +146,32 @@ except Exception as e: else: assert False, "Expected an error but got none." - # Idiomatic interface. with gpg.Context(armor=True) as c: # Checking a valid message. _, result = c.verify(test_text1, test_sig1) - check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, - gpg.constants.validity.FULL, - "A0FF4590BB6122EDEF6E3C542D727CC768697734", - gpg.errors.NO_ERROR, True) + check_result( + result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, + gpg.constants.validity.FULL, + "A0FF4590BB6122EDEF6E3C542D727CC768697734", gpg.errors.NO_ERROR, True) # Checking a manipulated message. try: c.verify(test_text1f, test_sig1) except gpg.errors.BadSignatures as e: check_result(e.result, gpg.constants.sigsum.RED, - gpg.constants.validity.UNKNOWN, - "2D727CC768697734", gpg.errors.BAD_SIGNATURE, False) + gpg.constants.validity.UNKNOWN, "2D727CC768697734", + gpg.errors.BAD_SIGNATURE, False) else: assert False, "Expected an error but got none." # Checking a normal signature. sig = gpg.Data(test_sig2) data, result = c.verify(test_sig2) - check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, - gpg.constants.validity.FULL, - "A0FF4590BB6122EDEF6E3C542D727CC768697734", - gpg.errors.NO_ERROR, False) + check_result( + result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, + gpg.constants.validity.FULL, + "A0FF4590BB6122EDEF6E3C542D727CC768697734", gpg.errors.NO_ERROR, False) assert data == test_text1 # Checking an invalid message. diff --git a/lang/python/tests/t-wait.py b/lang/python/tests/t-wait.py index 3101301..907f450 100755 --- a/lang/python/tests/t-wait.py +++ b/lang/python/tests/t-wait.py @@ -18,12 +18,13 @@ # License along with this program; if not, see . from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import time import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals c = gpg.Context() c.set_armor(True) diff --git a/lang/python/tests/t-wrapper.py b/lang/python/tests/t-wrapper.py index 08a320d..020e71e 100755 --- a/lang/python/tests/t-wrapper.py +++ b/lang/python/tests/t-wrapper.py @@ -19,9 +19,9 @@ import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. d0 = gpg.Data() -d0.seek # trigger on-demand-wrapping +d0.seek # trigger on-demand-wrapping assert d0.seek == d0.seek, "Generated wrapper functions are not cached" assert hasattr(gpg.Data, 'seek'), "Generated wrapper functions are not shared" ----------------------------------------------------------------------- Summary of changes: lang/python/tests/final.py | 11 +- lang/python/tests/initial.py | 9 +- lang/python/tests/run-tests.py | 93 +++++--- lang/python/tests/support.py | 29 ++- lang/python/tests/t-callbacks.py | 53 ++++- lang/python/tests/t-data.py | 9 +- lang/python/tests/t-decrypt-verify.py | 26 ++- lang/python/tests/t-decrypt.py | 3 +- lang/python/tests/t-edit.py | 21 +- lang/python/tests/t-encrypt-large.py | 13 +- lang/python/tests/t-encrypt-sign.py | 17 +- lang/python/tests/t-encrypt-sym.py | 14 +- lang/python/tests/t-encrypt.py | 36 +-- lang/python/tests/t-export.py | 7 +- lang/python/tests/t-file-name.py | 5 +- lang/python/tests/t-idiomatic.py | 13 +- lang/python/tests/t-import.py | 59 ++--- lang/python/tests/t-keylist-from-data.py | 286 ++++++++++++++--------- lang/python/tests/t-keylist.py | 322 +++++++++++++++----------- lang/python/tests/t-protocol-assuan.py | 13 +- lang/python/tests/t-quick-key-creation.py | 28 ++- lang/python/tests/t-quick-key-manipulation.py | 11 +- lang/python/tests/t-quick-key-signing.py | 54 +++-- lang/python/tests/t-quick-subkey-creation.py | 21 +- lang/python/tests/t-sig-notation.py | 28 +-- lang/python/tests/t-sign.py | 12 +- lang/python/tests/t-signers.py | 6 +- lang/python/tests/t-trustlist.py | 13 +- lang/python/tests/t-verify.py | 52 +++-- lang/python/tests/t-wait.py | 5 +- lang/python/tests/t-wrapper.py | 4 +- 31 files changed, 773 insertions(+), 500 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Sat Aug 18 16:23:52 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Sat, 18 Aug 2018 16:23:52 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-125-g03b899d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 03b899dbe14a3c32fd018c20c7d5156366fdcc3d (commit) from 5facba45c83f7daaacc49e66306e13a35aeb74be (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 03b899dbe14a3c32fd018c20c7d5156366fdcc3d Author: Ben McGinnes Date: Sun Aug 19 00:21:47 2018 +1000 Python bindings setup file * Moved the build import back up where it belongs. * Included comments indicating how to build and install for multiple Python versions beyond the first 2 on the same system. diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index 4767e14..65a4be0 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -19,6 +19,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from distutils.core import setup, Extension +from distutils.command.build import build import glob import os @@ -146,8 +147,16 @@ def up_to_date(source, target): # https://bugs.python.org/issue2624 # Workaround: # https://stackoverflow.com/questions/12491328/python-distutils-not-include-the-swig-generated-module -from distutils.command.build import build - +# +# To install to multiple Python installations or to alternate ones run the +# following three commands (yes, run the build one twice): +# +# /path/to/pythonX.Y setup.py build +# /path/to/pythonX.Y setup.py build +# /path/to/pythonX.Y setup.py install +# +# It is highly likely that this will need to be run as root or with sudo (or +# sudo -H). It may or may not work with venv. and outside a virtualenv class BuildExtFirstHack(build): def _read_header(self, header, cflags): ----------------------------------------------------------------------- Summary of changes: lang/python/setup.py.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Sun Aug 19 06:35:40 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Sun, 19 Aug 2018 06:35:40 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-126-g75bc5e6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 75bc5e6356eca1b7fb76653e7c82c2477f8859b0 (commit) from 03b899dbe14a3c32fd018c20c7d5156366fdcc3d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 75bc5e6356eca1b7fb76653e7c82c2477f8859b0 Author: Ben McGinnes Date: Sun Aug 19 14:32:30 2018 +1000 Python bindings examples * import-key.py: fixed a minor typo. * pmkey-import.py: locates and imports keys from the ProtonMail keyserver. * pmkey-import-alt.py: the same as the previous except with setting an alternative $GNUPGHOME directory. diff --git a/lang/python/examples/howto/import-key.py b/lang/python/examples/howto/import-key.py index 464052d..2591378 100755 --- a/lang/python/examples/howto/import-key.py +++ b/lang/python/examples/howto/import-key.py @@ -7,6 +7,8 @@ import gpg import os.path import sys +del absolute_import, division, unicode_literals + # Copyright (C) 2018 Ben McGinnes # # This program is free software; you can redistribute it and/or modify it under @@ -29,7 +31,7 @@ import sys # . print(""" -This script exports one or more public keys. +This script imports one or more public keys from a single file. """) c = gpg.Context(armor=True) diff --git a/lang/python/examples/howto/pmkey-import-alt.py b/lang/python/examples/howto/pmkey-import-alt.py new file mode 100755 index 0000000..e9521b7 --- /dev/null +++ b/lang/python/examples/howto/pmkey-import-alt.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +from __future__ import absolute_import, division, unicode_literals + +import gpg +import os.path +import requests +import sys + +del absolute_import, division, unicode_literals + +# Copyright (C) 2018 Ben McGinnes +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU +# Lesser General Public Licensefor more details. +# +# You should have received a copy of the GNU General Public License and the GNU +# Lesser General Public along with this program; if not, see +# . + +print(""" +This script searches the ProtonMail key server for the specified key and +imports it. Optionally enables specifying a different GnuPG home directory. +""") + +c = gpg.Context(armor=True) +url = "https://api.protonmail.ch/pks/lookup" +ksearch = [] + +if len(sys.argv) >= 3: + keyterm = sys.argv[1] + homedir = sys.argv[2] +elif len(sys.argv) == 2: + keyterm = sys.argv[1] + homedir = input("Enter the GPG configuration directory path (optional): ") +else: + keyterm = input("Enter the key ID, UID or search string: ") + homedir = input("Enter the GPG configuration directory path (optional): ") + +if homedir.startswith("~"): + if os.path.exists(os.path.expanduser(homedir)) is True: + c.home_dir = os.path.expanduser(homedir) + else: + pass +elif os.path.exists(homedir) is True: + c.home_dir = homedir +else: + pass + +if keyterm.count("@") == 2 and keyterm.startswith("@") is True: + ksearch.append(keyterm[1:]) + ksearch.append(keyterm[1:]) + ksearch.append(keyterm[1:]) +elif keyterm.count("@") == 1 and keyterm.startswith("@") is True: + ksearch.append("{0}@protonmail.com".format(keyterm[1:])) + ksearch.append("{0}@protonmail.ch".format(keyterm[1:])) + ksearch.append("{0}@pm.me".format(keyterm[1:])) +elif keyterm.count("@") == 0: + ksearch.append("{0}@protonmail.com".format(keyterm)) + ksearch.append("{0}@protonmail.ch".format(keyterm)) + ksearch.append("{0}@pm.me".format(keyterm)) +elif keyterm.count("@") == 2 and keyterm.startswith("@") is False: + uidlist = keyterm.split("@") + for uid in uidlist: + ksearch.append("{0}@protonmail.com".format(uid)) + ksearch.append("{0}@protonmail.ch".format(uid)) + ksearch.append("{0}@pm.me".format(uid)) +elif keyterm.count("@") > 2: + uidlist = keyterm.split("@") + for uid in uidlist: + ksearch.append("{0}@protonmail.com".format(uid)) + ksearch.append("{0}@protonmail.ch".format(uid)) + ksearch.append("{0}@pm.me".format(uid)) +else: + ksearch.append(keyterm) + +for k in ksearch: + payload = {"op": "get", "search": k} + try: + r = requests.get(url, verify=True, params=payload) + if r.ok is True: + result = c.key_import(r.content) + elif r.ok is False: + result = r.content + except Exception as e: + result = None + + if result is not None and hasattr(result, "considered") is False: + print("{0} for {1}".format(result.decode(), k)) + elif result is not None and hasattr(result, "considered") is True: + num_keys = len(result.imports) + new_revs = result.new_revocations + new_sigs = result.new_signatures + new_subs = result.new_sub_keys + new_uids = result.new_user_ids + new_scrt = result.secret_imported + nochange = result.unchanged + print(""" +The total number of keys considered for import was: {0} + +With UIDs wholely or partially matching the following string: + + {1} + + Number of keys revoked: {2} + Number of new signatures: {3} + Number of new subkeys: {4} + Number of new user IDs: {5} +Number of new secret keys: {6} + Number of unchanged keys: {7} + +The key IDs for all considered keys were: +""".format(num_keys, k, new_revs, new_sigs, new_subs, new_uids, new_scrt, + nochange)) + for i in range(num_keys): + print(result.imports[i].fpr) + print("") + elif result is None: + print(e) diff --git a/lang/python/examples/howto/pmkey-import.py b/lang/python/examples/howto/pmkey-import.py new file mode 100755 index 0000000..edbd18e --- /dev/null +++ b/lang/python/examples/howto/pmkey-import.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +from __future__ import absolute_import, division, unicode_literals + +import gpg +import requests +import sys + +del absolute_import, division, unicode_literals + +# Copyright (C) 2018 Ben McGinnes +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU +# Lesser General Public Licensefor more details. +# +# You should have received a copy of the GNU General Public License and the GNU +# Lesser General Public along with this program; if not, see +# . + +print(""" +This script searches the ProtonMail key server for the specified key and +imports it. +""") + +c = gpg.Context(armor=True) +url = "https://api.protonmail.ch/pks/lookup" +ksearch = [] + +if len(sys.argv) >= 2: + keyterm = sys.argv[1] +else: + keyterm = input("Enter the key ID, UID or search string: ") + +if keyterm.count("@") == 2 and keyterm.startswith("@") is True: + ksearch.append(keyterm[1:]) + ksearch.append(keyterm[1:]) + ksearch.append(keyterm[1:]) +elif keyterm.count("@") == 1 and keyterm.startswith("@") is True: + ksearch.append("{0}@protonmail.com".format(keyterm[1:])) + ksearch.append("{0}@protonmail.ch".format(keyterm[1:])) + ksearch.append("{0}@pm.me".format(keyterm[1:])) +elif keyterm.count("@") == 0: + ksearch.append("{0}@protonmail.com".format(keyterm)) + ksearch.append("{0}@protonmail.ch".format(keyterm)) + ksearch.append("{0}@pm.me".format(keyterm)) +elif keyterm.count("@") == 2 and keyterm.startswith("@") is False: + uidlist = keyterm.split("@") + for uid in uidlist: + ksearch.append("{0}@protonmail.com".format(uid)) + ksearch.append("{0}@protonmail.ch".format(uid)) + ksearch.append("{0}@pm.me".format(uid)) +elif keyterm.count("@") > 2: + uidlist = keyterm.split("@") + for uid in uidlist: + ksearch.append("{0}@protonmail.com".format(uid)) + ksearch.append("{0}@protonmail.ch".format(uid)) + ksearch.append("{0}@pm.me".format(uid)) +else: + ksearch.append(keyterm) + +for k in ksearch: + payload = {"op": "get", "search": k} + try: + r = requests.get(url, verify=True, params=payload) + if r.ok is True: + result = c.key_import(r.content) + elif r.ok is False: + result = r.content + except Exception as e: + result = None + + if result is not None and hasattr(result, "considered") is False: + print("{0} for {1}".format(result.decode(), k)) + elif result is not None and hasattr(result, "considered") is True: + num_keys = len(result.imports) + new_revs = result.new_revocations + new_sigs = result.new_signatures + new_subs = result.new_sub_keys + new_uids = result.new_user_ids + new_scrt = result.secret_imported + nochange = result.unchanged + print(""" +The total number of keys considered for import was: {0} + +With UIDs wholely or partially matching the following string: + + {1} + + Number of keys revoked: {2} + Number of new signatures: {3} + Number of new subkeys: {4} + Number of new user IDs: {5} +Number of new secret keys: {6} + Number of unchanged keys: {7} + +The key IDs for all considered keys were: +""".format(num_keys, k, new_revs, new_sigs, new_subs, new_uids, new_scrt, + nochange)) + for i in range(num_keys): + print(result.imports[i].fpr) + print("") + elif result is None: + print(e) ----------------------------------------------------------------------- Summary of changes: lang/python/examples/howto/import-key.py | 4 +- lang/python/examples/howto/pmkey-import-alt.py | 132 +++++++++++++++++++++++++ lang/python/examples/howto/pmkey-import.py | 116 ++++++++++++++++++++++ 3 files changed, 251 insertions(+), 1 deletion(-) create mode 100755 lang/python/examples/howto/pmkey-import-alt.py create mode 100755 lang/python/examples/howto/pmkey-import.py hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 20 15:10:50 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Mon, 20 Aug 2018 15:10:50 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-103-gdd32daa Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via dd32daad0bb21e3d5567326d0b2e548ff8510431 (commit) from 1954d27be86b8e4eb801ca6ddcb670f8cfb149f5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dd32daad0bb21e3d5567326d0b2e548ff8510431 Author: Maximilian Krambach Date: Mon Aug 20 15:12:01 2018 +0200 js: add and apply eslint rules -- * mainly spacing, see .eslintrc.json for details diff --git a/lang/js/.eslintrc.json b/lang/js/.eslintrc.json index ad82400..dc3be2e 100644 --- a/lang/js/.eslintrc.json +++ b/lang/js/.eslintrc.json @@ -27,6 +27,23 @@ "no-var": [ "warn" ], - "max-len": 1 + "max-len": 1, + "default-case": 2, + "no-invalid-this": 2, + "no-lone-blocks": 1, + "no-self-compare": 2, + "radix": 2, + "no-use-before-define": ["error", { + "functions": false, + "classes": false, + "variables": true + }], + "no-useless-constructor": 1, + "space-before-function-paren": ["error", "always"], + "keyword-spacing": 2, + "spaced-comment": 1, + "space-unary-ops": 2, + "object-curly-spacing": ["error", "always"], + "array-bracket-spacing": ["error", "never"] } } \ No newline at end of file diff --git a/lang/js/BrowserTestExtension/tests/KeyImportExport.js b/lang/js/BrowserTestExtension/tests/KeyImportExport.js index 6d0ba10..f52b790 100644 --- a/lang/js/BrowserTestExtension/tests/KeyImportExport.js +++ b/lang/js/BrowserTestExtension/tests/KeyImportExport.js @@ -31,16 +31,16 @@ describe('Key importing', function () { const changedKey = ImportablePublicKey.keyChangedUserId; let context = null; - before(function(done){ + before(function (done){ const prm = Gpgmejs.init(); - prm.then(function(gpgmejs){ + prm.then(function (gpgmejs){ context = gpgmejs; context.Keyring.getKeys(fpr).then( - function(result){ + function (result){ if (result.length === 1) { - result[0].delete().then(function(){ + result[0].delete().then(function (){ done(); - },function(){ + },function (){ done(); }); } else { @@ -50,14 +50,14 @@ describe('Key importing', function () { }); }); - afterEach(function(done){ + afterEach(function (done){ // delete the test key if still present context.Keyring.getKeys(fpr).then( - function(result){ + function (result){ if (result.length === 1) { - result[0].delete().then(function(){ + result[0].delete().then(function (){ done(); - },function(){ + },function (){ done(); }); } else { @@ -67,10 +67,10 @@ describe('Key importing', function () { }); it('Importing Key', function (done) { - context.Keyring.getKeys(fpr).then(function(result){ + context.Keyring.getKeys(fpr).then(function (result){ expect(result).to.be.an('array'); expect(result.length).to.equal(0); - context.Keyring.importKey(pubKey).then(function(result){ + context.Keyring.importKey(pubKey).then(function (result){ expect(result.Keys).to.be.an('array'); expect(result.Keys[0]).to.not.be.undefined; expect(result.Keys[0].key).to.be.an('object'); @@ -83,12 +83,12 @@ describe('Key importing', function () { }); }); - it('Updating Key', function(done){ + it('Updating Key', function (done){ context.Keyring.importKey(pubKey) - .then(function(result){ + .then(function (result){ expect(result.Keys[0].key).to.not.be.undefined; expect(result.Keys[0].status).to.equal('newkey'); - context.Keyring.importKey(changedKey).then(function(res){ + context.Keyring.importKey(changedKey).then(function (res){ expect(res.Keys[0].key).to.be.an('object'); expect(res.Keys[0].key.fingerprint).to.equal(fpr); expect(res.Keys[0].status).to.equal('change'); @@ -101,24 +101,24 @@ describe('Key importing', function () { }); }); - it('Deleting Key', function(done) { - context.Keyring.importKey(pubKey).then(function(result){ + it('Deleting Key', function (done) { + context.Keyring.importKey(pubKey).then(function (result){ expect(result.Keys[0].key).to.be.an('object'); expect(result.Keys[0].key.fingerprint).to.equal(fpr); - result.Keys[0].key.delete().then(function(result){ + result.Keys[0].key.delete().then(function (result){ expect(result).to.be.true; done(); }); }); }); - it('Import result feedback', function(done){ - context.Keyring.importKey(pubKey, true).then(function(result){ + it('Import result feedback', function (done){ + context.Keyring.importKey(pubKey, true).then(function (result){ expect(result).to.be.an('object'); expect(result.Keys[0]).to.be.an('object'); expect(result.Keys[0].key.fingerprint).to.equal(fpr); expect(result.Keys[0].status).to.equal('newkey'); - result.Keys[0].key.getArmor().then(function(armor){ + result.Keys[0].key.getArmor().then(function (armor){ expect(armor).to.be.a('string'); done(); }); @@ -126,8 +126,8 @@ describe('Key importing', function () { }); it('exporting armored Key with getKeysArmored', function (done) { - context.Keyring.importKey(pubKey).then(function(){ - context.Keyring.getKeysArmored(fpr).then(function(result){ + context.Keyring.importKey(pubKey).then(function (){ + context.Keyring.getKeysArmored(fpr).then(function (result){ expect(result).to.be.an('object'); expect(result.armored).to.be.a('string'); expect(result.secret_fprs).to.be.undefined; @@ -138,7 +138,7 @@ describe('Key importing', function () { it('Exporting Key (including secret fingerprints)', function (done) { const key_secret = inputvalues.encrypt.good.fingerprint; - context.Keyring.getKeysArmored(key_secret, true).then(function(result){ + context.Keyring.getKeysArmored(key_secret, true).then(function (result){ expect(result).to.be.an('object'); expect(result.armored).to.be.a('string'); expect(result.secret_fprs).to.be.an('array'); diff --git a/lang/js/BrowserTestExtension/tests/KeyInfos.js b/lang/js/BrowserTestExtension/tests/KeyInfos.js index 1829f22..e1caabe 100644 --- a/lang/js/BrowserTestExtension/tests/KeyInfos.js +++ b/lang/js/BrowserTestExtension/tests/KeyInfos.js @@ -26,17 +26,17 @@ describe('Key information', function () { let context = null; - before(function(done){ + before(function (done){ const prm = Gpgmejs.init(); - prm.then(function(gpgmejs){ + prm.then(function (gpgmejs){ context = gpgmejs; done(); }); }); - it('A fingerprint is consistently returned upper case hex', function(done){ + it('A fingerprint is consistently returned upper case hex', function (done){ const mixedCase = inputvalues.encrypt.good.fingerprint_mixedcase; - context.Keyring.getKeys(mixedCase).then(function(result){ + context.Keyring.getKeys(mixedCase).then(function (result){ expect(result).to.be.an('array'); expect(result.length).to.equal(1); expect(result[0].fingerprint).to.equal(mixedCase.toUpperCase()); @@ -44,9 +44,9 @@ describe('Key information', function () { }); }); - it('A userId keeps their encoding', function(done){ + it('A userId keeps their encoding', function (done){ context.Keyring.importKey(inputvalues.publicKeyNonAscii.key, true) - .then(function(result){ + .then(function (result){ expect(result.Keys[0]).to.be.an('object'); const user = result.Keys[0].key.get('userids')[0]; expect(user.get('name')).to.equal( diff --git a/lang/js/BrowserTestExtension/tests/decryptTest.js b/lang/js/BrowserTestExtension/tests/decryptTest.js index c6b3a3c..a3f48da 100644 --- a/lang/js/BrowserTestExtension/tests/decryptTest.js +++ b/lang/js/BrowserTestExtension/tests/decryptTest.js @@ -28,9 +28,9 @@ describe('Decryption', function () { let context = null; const good_fpr = inputvalues.encrypt.good.fingerprint; - before(function(done){ + before(function (done){ const prm = Gpgmejs.init(); - prm.then(function(gpgmejs){ + prm.then(function (gpgmejs){ context = gpgmejs; done(); }); @@ -39,8 +39,8 @@ describe('Decryption', function () { it('Decryption of random string fails', function (done) { let data = bigString(20 * 1024); context.decrypt(data).then( - function(){}, - function(error){ + function (){}, + function (error){ expect(error).to.be.an('error'); expect(error.code).to.equal('GNUPG_ERROR'); done(); @@ -49,10 +49,10 @@ describe('Decryption', function () { it('Decryption of slightly corrupted message fails', function (done) { const data = bigString(10000); - context.encrypt(data, good_fpr).then(function(enc){ + context.encrypt(data, good_fpr).then(function (enc){ context.decrypt(sabotageMsg(enc.data)).then( - function(){}, - function(error){ + function (){}, + function (error){ expect(error).to.be.an('error'); expect(error.code).to.equal('GNUPG_ERROR'); done(); diff --git a/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js b/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js index 80b293d..28c98d9 100644 --- a/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js +++ b/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js @@ -24,13 +24,13 @@ /* global describe, it, expect, before, Gpgmejs */ /* global inputvalues, encryptedData, bigString, bigBoringString */ -describe('Encryption and Decryption', function () { +describe('Encryption and Decryption', function (){ let context = null; let good_fpr = inputvalues.encrypt.good.fingerprint; - before(function(done){ + before(function (done){ const prm = Gpgmejs.init(); - prm.then(function(gpgmejs){ + prm.then(function (gpgmejs){ context = gpgmejs; done(); }); diff --git a/lang/js/BrowserTestExtension/tests/encryptTest.js b/lang/js/BrowserTestExtension/tests/encryptTest.js index 3ead815..a242af5 100644 --- a/lang/js/BrowserTestExtension/tests/encryptTest.js +++ b/lang/js/BrowserTestExtension/tests/encryptTest.js @@ -27,9 +27,9 @@ describe('Encryption', function () { let context = null; const good_fpr = inputvalues.encrypt.good.fingerprint; - before(function(done){ + before(function (done){ const prm = Gpgmejs.init(); - prm.then(function(gpgmejs){ + prm.then(function (gpgmejs){ context = gpgmejs; done(); }); @@ -64,7 +64,7 @@ describe('Encryption', function () { const data = inputvalues.encrypt.good.data; context.encrypt(data,null).then(function (answer) { expect(answer).to.be.undefined; - }, function(error){ + }, function (error){ expect(error).to.be.an('Error'); expect(error.code).to.equal('MSG_INCOMPLETE'); done(); @@ -86,7 +86,7 @@ describe('Encryption', function () { const bad_fpr = inputvalues.encrypt.bad.fingerprint; context.encrypt(data, bad_fpr).then(function (answer) { expect(answer).to.be.undefined; - }, function(error){ + }, function (error){ expect(error).to.be.an('Error'); expect(error.code).to.not.be.undefined; expect(error.code).to.equal('GNUPG_ERROR'); @@ -98,7 +98,7 @@ describe('Encryption', function () { const data = fixedLengthString(65); context.encrypt(data, good_fpr).then(function (answer) { expect(answer).to.be.undefined; - }, function(error){ + }, function (error){ expect(error).to.be.an.instanceof(Error); // TODO: there is a 64 MB hard limit at least in chrome at: // chromium//extensions/renderer/messaging_util.cc: diff --git a/lang/js/BrowserTestExtension/tests/inputvalues.js b/lang/js/BrowserTestExtension/tests/inputvalues.js index b33d985..f84ac95 100644 --- a/lang/js/BrowserTestExtension/tests/inputvalues.js +++ b/lang/js/BrowserTestExtension/tests/inputvalues.js @@ -126,7 +126,7 @@ const inputvalues = {// eslint-disable-line no-unused-vars }; // (Pseudo-)Random String covering all of utf8. -function bigString(length){// eslint-disable-line no-unused-vars +function bigString (length){// eslint-disable-line no-unused-vars let arr = []; for (let i= 0; i < length; i++){ arr.push(String.fromCharCode( @@ -136,7 +136,7 @@ function bigString(length){// eslint-disable-line no-unused-vars return arr.join(''); } -function fixedLengthString(megabytes){// eslint-disable-line no-unused-vars +function fixedLengthString (megabytes){// eslint-disable-line no-unused-vars let maxlength = 1024 * 1024 * megabytes / 2; let uint = new Uint8Array(maxlength); for (let i = 0; i < maxlength; i++){ @@ -148,7 +148,7 @@ function fixedLengthString(megabytes){// eslint-disable-line no-unused-vars } // (Pseudo-)Random Uint8Array, given size in Megabytes -function bigUint8(megabytes){// eslint-disable-line no-unused-vars +function bigUint8 (megabytes){// eslint-disable-line no-unused-vars let maxlength = 1024 * 1024 * megabytes; let uint = new Uint8Array(maxlength); for (let i= 0; i < maxlength; i++){ @@ -159,7 +159,7 @@ function bigUint8(megabytes){// eslint-disable-line no-unused-vars // (Pseudo-)Random string with very limited charset // (ascii only, no control chars) -function bigBoringString(megabytes){// eslint-disable-line no-unused-vars +function bigBoringString (megabytes){// eslint-disable-line no-unused-vars let maxlength = 1024 * 1024 * megabytes; let string = []; let chars = @@ -173,7 +173,7 @@ function bigBoringString(megabytes){// eslint-disable-line no-unused-vars // Some String with simple chars, with different characteristics, but still // expected to occur in an averag message // eslint-disable-next-line no-unused-vars -function slightlyLessBoringString(megabytes, set){ +function slightlyLessBoringString (megabytes, set){ let maxlength = 1024 * 1024 * megabytes; let string = []; let chars = ''; @@ -291,13 +291,13 @@ const ImportablePublicKey = {// eslint-disable-line no-unused-vars * preserve) header/footer */ // eslint-disable-next-line no-unused-vars -function sabotageMsg(msg, rate = 0.01, p= [35,35]){ +function sabotageMsg (msg, rate = 0.01, p= [35,35]){ const iterations = Math.floor(Math.random() * msg.length * rate) + 1; const base64_set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/'; for (let i=0; i < iterations; i++){ let str0, str1, str2; - const chosePosition = function(){ + const chosePosition = function (){ let position = Math.floor( Math.random() * (msg.length - p[0] + p[1])) + p[0]; @@ -310,7 +310,7 @@ function sabotageMsg(msg, rate = 0.01, p= [35,35]){ } }; chosePosition(); - let new1 = function(){ + let new1 = function (){ let n = base64_set[Math.floor(Math.random() * 64)]; return (n === str1) ? new1() : n; }; diff --git a/lang/js/BrowserTestExtension/tests/longRunningTests.js b/lang/js/BrowserTestExtension/tests/longRunningTests.js index 03f0390..240a6b9 100644 --- a/lang/js/BrowserTestExtension/tests/longRunningTests.js +++ b/lang/js/BrowserTestExtension/tests/longRunningTests.js @@ -26,9 +26,9 @@ describe('Long running Encryption/Decryption', function () { let context = null; const good_fpr = inputvalues.encrypt.good.fingerprint; - before(function(done){ + before(function (done){ const prm = Gpgmejs.init(); - prm.then(function(gpgmejs){ + prm.then(function (gpgmejs){ context = gpgmejs; done(); }); @@ -43,7 +43,7 @@ describe('Long running Encryption/Decryption', function () { expect(answer.data).to.be.a('string'); expect(answer.data).to.include('BEGIN PGP MESSAGE'); expect(answer.data).to.include('END PGP MESSAGE'); - context.decrypt(answer.data).then(function(result){ + context.decrypt(answer.data).then(function (result){ expect(result).to.not.be.empty; expect(result.data).to.be.a('string'); expect(result.data).to.equal(data); diff --git a/lang/js/BrowserTestExtension/tests/signTest.js b/lang/js/BrowserTestExtension/tests/signTest.js index 2763dad..f5bd9c1 100644 --- a/lang/js/BrowserTestExtension/tests/signTest.js +++ b/lang/js/BrowserTestExtension/tests/signTest.js @@ -28,9 +28,9 @@ describe('Signing', function () { let context = null; const good_fpr = inputvalues.encrypt.good.fingerprint; - before(function(done){ + before(function (done){ const prm = Gpgmejs.init(); - prm.then(function(gpgmejs){ + prm.then(function (gpgmejs){ context = gpgmejs; done(); }); diff --git a/lang/js/BrowserTestExtension/tests/startup.js b/lang/js/BrowserTestExtension/tests/startup.js index 63358aa..cf5b099 100644 --- a/lang/js/BrowserTestExtension/tests/startup.js +++ b/lang/js/BrowserTestExtension/tests/startup.js @@ -23,12 +23,12 @@ /* global describe, it, expect, Gpgmejs, inputvalues */ -describe('GPGME context', function(){ - it('Starting a GpgME instance', function(done){ +describe('GPGME context', function (){ + it('Starting a GpgME instance', function (done){ let prm = Gpgmejs.init(); const input = inputvalues.someInputParameter; prm.then( - function(context){ + function (context){ expect(context).to.be.an('object'); expect(context.encrypt).to.be.a('function'); expect(context.decrypt).to.be.a('function'); diff --git a/lang/js/BrowserTestExtension/tests/verifyTest.js b/lang/js/BrowserTestExtension/tests/verifyTest.js index 1617e2d..82aaf56 100644 --- a/lang/js/BrowserTestExtension/tests/verifyTest.js +++ b/lang/js/BrowserTestExtension/tests/verifyTest.js @@ -27,16 +27,16 @@ describe('Verifying data', function () { let context = null; - before(function(done){ + before(function (done){ const prm = Gpgmejs.init(); - prm.then(function(gpgmejs){ + prm.then(function (gpgmejs){ context = gpgmejs; done(); }); }); it('Successful verify message', function (done) { const message = inputvalues.signedMessage.good; - context.verify(message).then(function(result){ + context.verify(message).then(function (result){ expect(result.data).to.be.a('string'); expect(result.all_valid).to.be.true; expect(result.count).to.equal(1); @@ -50,7 +50,7 @@ describe('Verifying data', function () { it('Successfully recognize changed cleartext', function (done) { const message = inputvalues.signedMessage.bad; - context.verify(message).then(function(result){ + context.verify(message).then(function (result){ expect(result.data).to.be.a('string'); expect(result.all_valid).to.be.false; expect(result.count).to.equal(1); @@ -65,9 +65,9 @@ describe('Verifying data', function () { it('Encrypt-Sign-Verify random message', function (done) { const message = bigString(2000); let fpr = inputvalues.encrypt.good.fingerprint; - context.encrypt(message, fpr).then(function(message_enc){ - context.sign(message_enc.data, fpr).then(function(message_encsign){ - context.verify(message_encsign.data).then(function(result){ + context.encrypt(message, fpr).then(function (message_enc){ + context.sign(message_enc.data, fpr).then(function (message_encsign){ + context.verify(message_encsign.data).then(function (result){ expect(result.data).to.equal(message_enc.data); expect(result.data).to.be.a('string'); expect(result.all_valid).to.be.true; diff --git a/lang/js/DemoExtension/entry.js b/lang/js/DemoExtension/entry.js index 77b96f9..fd261a0 100644 --- a/lang/js/DemoExtension/entry.js +++ b/lang/js/DemoExtension/entry.js @@ -23,7 +23,7 @@ /* global chrome */ -document.addEventListener('DOMContentLoaded', function() { +document.addEventListener('DOMContentLoaded', function () { chrome.tabs.create({ url: './mainui.html' }); diff --git a/lang/js/DemoExtension/maindemo.js b/lang/js/DemoExtension/maindemo.js index 4cae934..8d19085 100644 --- a/lang/js/DemoExtension/maindemo.js +++ b/lang/js/DemoExtension/maindemo.js @@ -23,67 +23,67 @@ /* global document, Gpgmejs */ -document.addEventListener('DOMContentLoaded', function() { - Gpgmejs.init().then(function(gpgmejs){ +document.addEventListener('DOMContentLoaded', function () { + Gpgmejs.init().then(function (gpgmejs){ document.getElementById('buttonencrypt').addEventListener('click', - function(){ + function (){ let data = document.getElementById('inputtext').value; let keyId = document.getElementById('pubkey').value; gpgmejs.encrypt(data, keyId).then( - function(answer){ + function (answer){ if (answer.data){ document.getElementById( 'answer').value = answer.data; } - }, function(errormsg){ + }, function (errormsg){ alert( errormsg.message); }); }); document.getElementById('buttondecrypt').addEventListener('click', - function(){ + function (){ let data = document.getElementById('inputtext').value; gpgmejs.decrypt(data).then( - function(answer){ + function (answer){ if (answer.data){ document.getElementById( 'answer').value = answer.data; } - }, function(errormsg){ + }, function (errormsg){ alert(errormsg.message); }); }); document.getElementById('getdefaultkey').addEventListener('click', - function(){ - gpgmejs.Keyring.getDefaultKey().then(function(answer){ + function (){ + gpgmejs.Keyring.getDefaultKey().then(function (answer){ document.getElementById('pubkey').value = answer.fingerprint; - }, function(errormsg){ + }, function (errormsg){ alert(errormsg.message); }); }); document.getElementById('signtext').addEventListener('click', - function(){ + function (){ let data = document.getElementById('inputtext').value; let keyId = document.getElementById('pubkey').value; gpgmejs.sign(data, keyId).then( - function(answer){ + function (answer){ if (answer.data){ document.getElementById( 'answer').value = answer.data; } - }, function(errormsg){ + }, function (errormsg){ alert( errormsg.message); }); }); document.getElementById('verifytext').addEventListener('click', - function(){ + function (){ let data = document.getElementById('inputtext').value; gpgmejs.verify(data).then( - function(answer){ + function (answer){ let vals = ''; if (answer.all_valid === true){ vals = 'Success! '; @@ -94,14 +94,14 @@ document.addEventListener('DOMContentLoaded', function() { + answer.count + ' signature(s) were successfully ' + 'verified.\n\n' + answer.data; document.getElementById('answer').value = vals; - }, function(errormsg){ + }, function (errormsg){ alert( errormsg.message); }); }); document.getElementById('searchkey').addEventListener('click', - function(){ + function (){ let data = document.getElementById('inputtext').value; - gpgmejs.Keyring.getKeys(data, true, true).then(function(keys){ + gpgmejs.Keyring.getKeys(data, true, true).then(function (keys){ if (keys.length === 1){ document.getElementById( 'pubkey').value = keys[0].fingerprint; @@ -111,7 +111,7 @@ document.addEventListener('DOMContentLoaded', function() { } else { alert('No keys found'); } - }, function(errormsg){ + }, function (errormsg){ alert( errormsg.message); }); }); diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index a60fd21..928ac68 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -38,14 +38,14 @@ import { decode } from './Helpers'; */ export class Connection{ - constructor(){ + constructor (){ this._connection = chrome.runtime.connectNative('gpgmejson'); } /** * Immediately closes an open port. */ - disconnect() { + disconnect () { if (this._connection){ this._connection.disconnect(); this._connection = null; @@ -81,17 +81,17 @@ export class Connection{ return this.post(msg); } else { let me = this; - return new Promise(function(resolve) { + return new Promise(function (resolve) { Promise.race([ me.post(msg), - new Promise(function(resolve, reject){ - setTimeout(function(){ + new Promise(function (resolve, reject){ + setTimeout(function (){ reject(gpgme_error('CONN_TIMEOUT')); }, 500); }) - ]).then(function(){ // success + ]).then(function (){ // success resolve(true); - }, function(){ // failure + }, function (){ // failure resolve(false); }); }); @@ -107,7 +107,7 @@ export class Connection{ * @returns {Promise} The collected answer * @async */ - post(message){ + post (message){ if (!message || !(message instanceof GPGME_Message)){ this.disconnect(); return Promise.reject(gpgme_error( @@ -119,9 +119,9 @@ export class Connection{ } let chunksize = message.chunksize; const me = this; - return new Promise(function(resolve, reject){ + return new Promise(function (resolve, reject){ let answer = new Answer(message); - let listener = function(msg) { + let listener = function (msg) { if (!msg){ me._connection.onMessage.removeListener(listener); me._connection.disconnect(); @@ -157,16 +157,16 @@ export class Connection{ } else { return Promise.race([ me._connection.postMessage(message.message), - function(resolve, reject){ - setTimeout(function(){ + function (resolve, reject){ + setTimeout(function (){ me._connection.disconnect(); reject(gpgme_error('CONN_TIMEOUT')); }, 5000); } - ]).then(function(result){ + ]).then(function (result){ return result; - }, function(reject){ - if(!(reject instanceof Error)) { + }, function (reject){ + if (!(reject instanceof Error)) { me._connection.disconnect(); return gpgme_error('GNUPG_ERROR', reject); } else { @@ -189,7 +189,7 @@ class Answer{ /** * @param {GPGME_Message} message */ - constructor(message){ + constructor (message){ this._operation = message.operation; this._expected = message.expected; this._response_b64 = null; @@ -211,7 +211,7 @@ class Answer{ * @private */ collect (msg){ - if (typeof(msg) !== 'object' || !msg.hasOwnProperty('response')) { + if (typeof (msg) !== 'object' || !msg.hasOwnProperty('response')) { return gpgme_error('CONN_UNEXPECTED_ANSWER'); } if (!this._response_b64){ @@ -226,7 +226,7 @@ class Answer{ * Returns the base64 encoded answer data with the content verified * against {@link permittedOperations}. */ - getMessage(){ + getMessage (){ if (this._response_b64 === null){ return gpgme_error('CONN_UNEXPECTED_ANSWER'); } @@ -259,7 +259,7 @@ class Answer{ if (!poa.data.hasOwnProperty(key)){ return gpgme_error('CONN_UNEXPECTED_ANSWER'); } - if( typeof(_decodedResponse[key]) !== poa.data[key] ){ + if ( typeof (_decodedResponse[key]) !== poa.data[key] ){ return gpgme_error('CONN_UNEXPECTED_ANSWER'); } if (_decodedResponse.base64 === true @@ -268,7 +268,7 @@ class Answer{ ){ _response[key] = decodeURIComponent( atob(_decodedResponse[key]).split('').map( - function(c) { + function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); diff --git a/lang/js/src/Errors.js b/lang/js/src/Errors.js index 2a35bc5..53e7bcd 100644 --- a/lang/js/src/Errors.js +++ b/lang/js/src/Errors.js @@ -120,7 +120,7 @@ const err_list = { * @param {*} info Error message passed through if code is 'GNUPG_ERROR' * @returns {GPGME_Error} */ -export function gpgme_error(code = 'GENERIC_ERROR', info){ +export function gpgme_error (code = 'GENERIC_ERROR', info){ if (err_list.hasOwnProperty(code)){ if (err_list[code].type === 'error'){ return new GPGME_Error(code); @@ -147,9 +147,9 @@ export function gpgme_error(code = 'GENERIC_ERROR', info){ * @extends Error */ class GPGME_Error extends Error{ - constructor(code = 'GENERIC_ERROR', msg=''){ + constructor (code = 'GENERIC_ERROR', msg=''){ - if (code === 'GNUPG_ERROR' && typeof(msg) === 'string'){ + if (code === 'GNUPG_ERROR' && typeof (msg) === 'string'){ super(msg); } else if (err_list.hasOwnProperty(code)){ if (msg){ @@ -163,7 +163,7 @@ class GPGME_Error extends Error{ this._code = code; } - get code(){ + get code (){ return this._code; } } \ No newline at end of file diff --git a/lang/js/src/Helpers.js b/lang/js/src/Helpers.js index 379015f..ba4277a 100644 --- a/lang/js/src/Helpers.js +++ b/lang/js/src/Helpers.js @@ -30,7 +30,7 @@ import { gpgme_error } from './Errors'; * @param {Object | Array | String | Array} input * @returns {Array} Array of fingerprints, or an empty array */ -export function toKeyIdArray(input){ +export function toKeyIdArray (input){ if (!input){ return []; } @@ -39,7 +39,7 @@ export function toKeyIdArray(input){ } let result = []; for (let i=0; i < input.length; i++){ - if (typeof(input[i]) === 'string'){ + if (typeof (input[i]) === 'string'){ if (isFingerprint(input[i]) === true){ result.push(input[i]); } else { @@ -47,7 +47,7 @@ export function toKeyIdArray(input){ // in src/Errors.js gpgme_error('MSG_NOT_A_FPR'); } - } else if (typeof(input[i]) === 'object'){ + } else if (typeof (input[i]) === 'object'){ let fpr = ''; if (input[i].hasOwnProperty('fingerprint')){ fpr = input[i].fingerprint; @@ -78,8 +78,8 @@ export function toKeyIdArray(input){ * @returns {Boolean} true if value passes test * @private */ -function hextest(key, len){ - if (!key || typeof(key) !== 'string'){ +function hextest (key, len){ + if (!key || typeof (key) !== 'string'){ return false; } if (key.length !== len){ @@ -95,7 +95,7 @@ function hextest(key, len){ * @param {String} value to check * @returns {Boolean} true if value passes test */ -export function isFingerprint(value){ +export function isFingerprint (value){ return hextest(value, 40); } @@ -105,7 +105,7 @@ export function isFingerprint(value){ * @param {String} value to check * @returns {Boolean} true if value passes test */ -export function isLongId(value){ +export function isLongId (value){ return hextest(value, 16); } @@ -113,7 +113,7 @@ export function isLongId(value){ * Recursively decodes input (utf8) to output (utf-16; javascript) strings * @param {Object | Array | String} property */ -export function decode(property){ +export function decode (property){ if (typeof property === 'string'){ return decodeURIComponent(escape(property)); } else if (Array.isArray(property)){ diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index 37ec7f9..2800ae9 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -35,8 +35,8 @@ import { createMessage } from './Message'; * a full object as delivered by gpgme-json * @returns {Object|GPGME_Error} The verified and updated data */ -export function createKey(fingerprint, async = false, data){ - if (!isFingerprint(fingerprint) || typeof(async) !== 'boolean'){ +export function createKey (fingerprint, async = false, data){ + if (!isFingerprint(fingerprint) || typeof (async) !== 'boolean'){ return gpgme_error('PARAM_WRONG'); } if (data !== undefined){ @@ -60,14 +60,14 @@ export function createKey(fingerprint, async = false, data){ */ class GPGME_Key { - constructor(fingerprint, async, data){ + constructor (fingerprint, async, data){ /** * @property {Boolean} If true, most answers will be asynchronous */ this._async = async; - this._data = {fingerprint: fingerprint.toUpperCase()}; + this._data = { fingerprint: fingerprint.toUpperCase() }; if (data !== undefined && data.fingerprint.toUpperCase() === this._data.fingerprint ) { @@ -84,7 +84,7 @@ class GPGME_Key { * async, the armored property is not available (it can still be * retrieved asynchronously by {@link Key.getArmor}) */ - get(property) { + get (property) { if (this._async === true) { switch (property){ case 'armored': @@ -98,6 +98,7 @@ class GPGME_Key { if (property === 'armored') { return gpgme_error('KEY_ASYNC_ONLY'); } + // eslint-disable-next-line no-use-before-define if (!validKeyProperties.hasOwnProperty(property)){ return gpgme_error('PARAM_WRONG'); } else { @@ -114,16 +115,16 @@ class GPGME_Key { * @returns {Promise} * @async */ - refreshKey() { + refreshKey () { let me = this; - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { if (!me._data.fingerprint){ reject(gpgme_error('KEY_INVALID')); } let msg = createMessage('keylist'); msg.setParameter('sigs', true); msg.setParameter('keys', me._data.fingerprint); - msg.post().then(function(result){ + msg.post().then(function (result){ if (result.keys.length === 1){ const newdata = validateKeyData( me._data.fingerprint, result.keys[0]); @@ -131,13 +132,13 @@ class GPGME_Key { reject(gpgme_error('KEY_INVALID')); } else { me._data = newdata; - me.getGnupgSecretState().then(function(){ - me.getArmor().then(function(){ + me.getGnupgSecretState().then(function (){ + me.getArmor().then(function (){ resolve(me); - }, function(error){ + }, function (error){ reject(error); }); - }, function(error){ + }, function (error){ reject(error); }); } @@ -157,18 +158,18 @@ class GPGME_Key { * @returns {Promise} * @async */ - getArmor() { + getArmor () { const me = this; - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { if (!me._data.fingerprint){ reject(gpgme_error('KEY_INVALID')); } let msg = createMessage('export'); msg.setParameter('armor', true); msg.setParameter('keys', me._data.fingerprint); - msg.post().then(function(result){ + msg.post().then(function (result){ resolve(result.data); - }, function(error){ + }, function (error){ reject(error); }); }); @@ -186,14 +187,14 @@ class GPGME_Key { */ getGnupgSecretState (){ const me = this; - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { if (!me._data.fingerprint){ reject(gpgme_error('KEY_INVALID')); } else { let msg = createMessage('keylist'); msg.setParameter('keys', me._data.fingerprint); msg.setParameter('secret', true); - msg.post().then(function(result){ + msg.post().then(function (result){ me._data.hasSecret = null; if ( result.keys && @@ -206,7 +207,7 @@ class GPGME_Key { me._data.hasSecret = false; resolve(false); } - }, function(error){ + }, function (error){ reject(error); }); } @@ -219,17 +220,17 @@ class GPGME_Key { * @returns {Promise} Success if key was deleted, * rejects with a GPG error otherwise. */ - delete(){ + delete (){ const me = this; - return new Promise(function(resolve, reject){ + return new Promise(function (resolve, reject){ if (!me._data.fingerprint){ reject(gpgme_error('KEY_INVALID')); } let msg = createMessage('delete'); msg.setParameter('key', me._data.fingerprint); - msg.post().then(function(result){ + msg.post().then(function (result){ resolve(result.success); - }, function(error){ + }, function (error){ reject(error); }); }); @@ -238,7 +239,7 @@ class GPGME_Key { /** * @returns {String} The fingerprint defining this Key. Convenience getter */ - get fingerprint(){ + get fingerprint (){ return this._data.fingerprint; } } @@ -255,7 +256,7 @@ class GPGME_Subkey { * @param {Object} data * @private */ - constructor(data){ + constructor (data){ this._data = {}; let keys = Object.keys(data); const me = this; @@ -268,7 +269,9 @@ class GPGME_Subkey { * @param private */ const setProperty = function (property, value){ + // eslint-disable-next-line no-use-before-define if (validSubKeyProperties.hasOwnProperty(property)){ + // eslint-disable-next-line no-use-before-define if (validSubKeyProperties[property](value) === true) { if (property === 'timestamp' || property === 'expires'){ me._data[property] = new Date(value * 1000); @@ -288,7 +291,7 @@ class GPGME_Subkey { * @param {String} property Information to request * @returns {String | Number | Date} */ - get(property) { + get (property) { if (this._data.hasOwnProperty(property)){ return (this._data[property]); } @@ -308,12 +311,14 @@ class GPGME_UserId { * @param {Object} data * @private */ - constructor(data){ + constructor (data){ this._data = {}; const me = this; let keys = Object.keys(data); - const setProperty = function(property, value){ + const setProperty = function (property, value){ + // eslint-disable-next-line no-use-before-define if (validUserIdProperties.hasOwnProperty(property)){ + // eslint-disable-next-line no-use-before-define if (validUserIdProperties[property](value) === true) { if (property === 'last_update'){ me._data[property] = new Date(value*1000); @@ -333,7 +338,7 @@ class GPGME_UserId { * @param {String} property Information to request * @returns {String | Number} */ - get(property) { + get (property) { if (this._data.hasOwnProperty(property)){ return (this._data[property]); } @@ -349,52 +354,52 @@ class GPGME_UserId { * @const */ const validUserIdProperties = { - 'revoked': function(value){ - return typeof(value) === 'boolean'; + 'revoked': function (value){ + return typeof (value) === 'boolean'; }, - 'invalid': function(value){ - return typeof(value) === 'boolean'; + 'invalid': function (value){ + return typeof (value) === 'boolean'; }, - 'uid': function(value){ - if (typeof(value) === 'string' || value === ''){ + 'uid': function (value){ + if (typeof (value) === 'string' || value === ''){ return true; } return false; }, - 'validity': function(value){ - if (typeof(value) === 'string'){ + 'validity': function (value){ + if (typeof (value) === 'string'){ return true; } return false; }, - 'name': function(value){ - if (typeof(value) === 'string' || value === ''){ + 'name': function (value){ + if (typeof (value) === 'string' || value === ''){ return true; } return false; }, - 'email': function(value){ - if (typeof(value) === 'string' || value === ''){ + 'email': function (value){ + if (typeof (value) === 'string' || value === ''){ return true; } return false; }, - 'address': function(value){ - if (typeof(value) === 'string' || value === ''){ + 'address': function (value){ + if (typeof (value) === 'string' || value === ''){ return true; } return false; }, - 'comment': function(value){ - if (typeof(value) === 'string' || value === ''){ + 'comment': function (value){ + if (typeof (value) === 'string' || value === ''){ return true; } return false; }, - 'origin': function(value){ + 'origin': function (value){ return Number.isInteger(value); }, - 'last_update': function(value){ + 'last_update': function (value){ return Number.isInteger(value); } }; @@ -406,54 +411,54 @@ const validUserIdProperties = { * @const */ const validSubKeyProperties = { - 'invalid': function(value){ - return typeof(value) === 'boolean'; + 'invalid': function (value){ + return typeof (value) === 'boolean'; }, - 'can_encrypt': function(value){ - return typeof(value) === 'boolean'; + 'can_encrypt': function (value){ + return typeof (value) === 'boolean'; }, - 'can_sign': function(value){ - return typeof(value) === 'boolean'; + 'can_sign': function (value){ + return typeof (value) === 'boolean'; }, - 'can_certify': function(value){ - return typeof(value) === 'boolean'; + 'can_certify': function (value){ + return typeof (value) === 'boolean'; }, - 'can_authenticate': function(value){ - return typeof(value) === 'boolean'; + 'can_authenticate': function (value){ + return typeof (value) === 'boolean'; }, - 'secret': function(value){ - return typeof(value) === 'boolean'; + 'secret': function (value){ + return typeof (value) === 'boolean'; }, - 'is_qualified': function(value){ - return typeof(value) === 'boolean'; + 'is_qualified': function (value){ + return typeof (value) === 'boolean'; }, - 'is_cardkey': function(value){ - return typeof(value) === 'boolean'; + 'is_cardkey': function (value){ + return typeof (value) === 'boolean'; }, - 'is_de_vs': function(value){ - return typeof(value) === 'boolean'; + 'is_de_vs': function (value){ + return typeof (value) === 'boolean'; }, - 'pubkey_algo_name': function(value){ - return typeof(value) === 'string'; + 'pubkey_algo_name': function (value){ + return typeof (value) === 'string'; // TODO: check against list of known?[''] }, - 'pubkey_algo_string': function(value){ - return typeof(value) === 'string'; + 'pubkey_algo_string': function (value){ + return typeof (value) === 'string'; // TODO: check against list of known?[''] }, - 'keyid': function(value){ + 'keyid': function (value){ return isLongId(value); }, - 'pubkey_algo': function(value) { + 'pubkey_algo': function (value) { return (Number.isInteger(value) && value >= 0); }, - 'length': function(value){ + 'length': function (value){ return (Number.isInteger(value) && value > 0); }, - 'timestamp': function(value){ + 'timestamp': function (value){ return (Number.isInteger(value) && value > 0); }, - 'expires': function(value){ + 'expires': function (value){ return (Number.isInteger(value) && value > 0); } }; @@ -489,73 +494,73 @@ const validSubKeyProperties = { * @const */ const validKeyProperties = { - 'fingerprint': function(value){ + 'fingerprint': function (value){ return isFingerprint(value); }, - 'revoked': function(value){ - return typeof(value) === 'boolean'; + 'revoked': function (value){ + return typeof (value) === 'boolean'; }, - 'expired': function(value){ - return typeof(value) === 'boolean'; + 'expired': function (value){ + return typeof (value) === 'boolean'; }, - 'disabled': function(value){ - return typeof(value) === 'boolean'; + 'disabled': function (value){ + return typeof (value) === 'boolean'; }, - 'invalid': function(value){ - return typeof(value) === 'boolean'; + 'invalid': function (value){ + return typeof (value) === 'boolean'; }, - 'can_encrypt': function(value){ - return typeof(value) === 'boolean'; + 'can_encrypt': function (value){ + return typeof (value) === 'boolean'; }, - 'can_sign': function(value){ - return typeof(value) === 'boolean'; + 'can_sign': function (value){ + return typeof (value) === 'boolean'; }, - 'can_certify': function(value){ - return typeof(value) === 'boolean'; + 'can_certify': function (value){ + return typeof (value) === 'boolean'; }, - 'can_authenticate': function(value){ - return typeof(value) === 'boolean'; + 'can_authenticate': function (value){ + return typeof (value) === 'boolean'; }, - 'secret': function(value){ - return typeof(value) === 'boolean'; + 'secret': function (value){ + return typeof (value) === 'boolean'; }, - 'is_qualified': function(value){ - return typeof(value) === 'boolean'; + 'is_qualified': function (value){ + return typeof (value) === 'boolean'; }, - 'protocol': function(value){ - return typeof(value) === 'string'; - //TODO check for implemented ones + 'protocol': function (value){ + return typeof (value) === 'string'; + // TODO check for implemented ones }, - 'issuer_serial': function(value){ - return typeof(value) === 'string'; + 'issuer_serial': function (value){ + return typeof (value) === 'string'; }, - 'issuer_name': function(value){ - return typeof(value) === 'string'; + 'issuer_name': function (value){ + return typeof (value) === 'string'; }, - 'chain_id': function(value){ - return typeof(value) === 'string'; + 'chain_id': function (value){ + return typeof (value) === 'string'; }, - 'owner_trust': function(value){ - return typeof(value) === 'string'; + 'owner_trust': function (value){ + return typeof (value) === 'string'; }, - 'last_update': function(value){ + 'last_update': function (value){ return (Number.isInteger(value)); - //TODO undefined/null possible? + // TODO undefined/null possible? }, - 'origin': function(value){ + 'origin': function (value){ return (Number.isInteger(value)); }, - 'subkeys': function(value){ + 'subkeys': function (value){ return (Array.isArray(value)); }, - 'userids': function(value){ + 'userids': function (value){ return (Array.isArray(value)); }, - 'tofu': function(value){ + 'tofu': function (value){ return (Array.isArray(value)); }, - 'hasSecret': function(value){ - return typeof(value) === 'boolean'; + 'hasSecret': function (value){ + return typeof (value) === 'boolean'; } }; @@ -570,9 +575,9 @@ const validKeyProperties = { * an error if something went wrong. * @private */ -function validateKeyData(fingerprint, data){ +function validateKeyData (fingerprint, data){ const key = {}; - if (!fingerprint || typeof(data) !== 'object' || !data.fingerprint + if (!fingerprint || typeof (data) !== 'object' || !data.fingerprint || fingerprint !== data.fingerprint.toUpperCase() ){ return gpgme_error('KEY_INVALID'); @@ -619,13 +624,13 @@ function validateKeyData(fingerprint, data){ * @async */ function getGnupgState (fingerprint, property){ - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { if (!isFingerprint(fingerprint)) { reject(gpgme_error('KEY_INVALID')); } else { let msg = createMessage('keylist'); msg.setParameter('keys', fingerprint); - msg.post().then(function(res){ + msg.post().then(function (res){ if (!res.keys || res.keys.length !== 1){ reject(gpgme_error('KEY_INVALID')); } else { @@ -675,7 +680,7 @@ function getGnupgState (fingerprint, property){ break; } } - }, function(error){ + }, function (error){ reject(gpgme_error(error)); }); } diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index de21736..90d267d 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -22,8 +22,8 @@ */ -import {createMessage} from './Message'; -import {createKey} from './Key'; +import { createMessage } from './Message'; +import { createKey } from './Key'; import { isFingerprint } from './Helpers'; import { gpgme_error } from './Errors'; @@ -31,8 +31,6 @@ import { gpgme_error } from './Errors'; * This class offers access to the gnupg keyring */ export class GPGME_Keyring { - constructor(){ - } /** * Queries Keys (all Keys or a subset) from gnupg. @@ -51,7 +49,7 @@ export class GPGME_Keyring { * @async */ getKeys (pattern, prepare_sync=false, search=false){ - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { let msg = createMessage('keylist'); if (pattern !== undefined && pattern !== null){ msg.setParameter('keys', pattern); @@ -60,25 +58,25 @@ export class GPGME_Keyring { if (search === true){ msg.setParameter('locate', true); } - msg.post().then(function(result){ + msg.post().then(function (result){ let resultset = []; if (result.keys.length === 0){ resolve([]); } else { let secondrequest; if (prepare_sync === true) { - secondrequest = function() { + secondrequest = function () { let msg2 = createMessage('keylist'); msg2.setParameter('keys', pattern); msg2.setParameter('secret', true); return msg2.post(); }; } else { - secondrequest = function() { + secondrequest = function () { return Promise.resolve(true); }; } - secondrequest().then(function(answer) { + secondrequest().then(function (answer) { for (let i=0; i < result.keys.length; i++){ if (prepare_sync === true){ if (answer && answer.keys) { @@ -104,7 +102,7 @@ export class GPGME_Keyring { resultset.push(k); } resolve(resultset); - }, function(error){ + }, function (error){ reject(error); }); } @@ -136,7 +134,7 @@ export class GPGME_Keyring { * @async */ getKeysArmored (pattern, with_secret_fpr) { - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { let msg = createMessage('export'); msg.setParameter('armor', true); if (with_secret_fpr === true) { @@ -145,15 +143,15 @@ export class GPGME_Keyring { if (pattern !== undefined && pattern !== null){ msg.setParameter('keys', pattern); } - msg.post().then(function(answer){ - const result = {armored: answer.data}; + msg.post().then(function (answer){ + const result = { armored: answer.data }; if (with_secret_fpr === true && answer.hasOwnProperty('sec-fprs') ) { result.secret_fprs = answer['sec-fprs']; } resolve(result); - }, function(error){ + }, function (error){ reject(error); }); }); @@ -169,32 +167,32 @@ export class GPGME_Keyring { * @async * @static */ - getDefaultKey(prepare_sync = false) { + getDefaultKey (prepare_sync = false) { let me = this; - return new Promise(function(resolve, reject){ + return new Promise(function (resolve, reject){ let msg = createMessage('config_opt'); msg.setParameter('component', 'gpg'); msg.setParameter('option', 'default-key'); - msg.post().then(function(resp){ + msg.post().then(function (resp){ if (resp.option !== undefined && resp.option.hasOwnProperty('value') && resp.option.value.length === 1 && resp.option.value[0].hasOwnProperty('string') - && typeof(resp.option.value[0].string) === 'string'){ + && typeof (resp.option.value[0].string) === 'string'){ me.getKeys(resp.option.value[0].string, true).then( - function(keys){ - if(keys.length === 1){ + function (keys){ + if (keys.length === 1){ resolve(keys[0]); } else { reject(gpgme_error('KEY_NO_DEFAULT')); } - }, function(error){ + }, function (error){ reject(error); }); } else { let msg = createMessage('keylist'); msg.setParameter('secret', true); - msg.post().then(function(result){ + msg.post().then(function (result){ if (result.keys.length === 0){ reject(gpgme_error('KEY_NO_DEFAULT')); } else { @@ -211,11 +209,11 @@ export class GPGME_Keyring { } } } - }, function(error){ + }, function (error){ reject(error); }); } - }, function(error){ + }, function (error){ reject(error); }); }); @@ -264,14 +262,14 @@ export class GPGME_Keyring { 'new_signatures', 'new_revocations', 'secret_read', 'secret_imported', 'secret_unchanged', 'skipped_new_keys', 'not_imported', 'skipped_v3_keys']; - if (!armored || typeof(armored) !== 'string'){ + if (!armored || typeof (armored) !== 'string'){ return Promise.reject(gpgme_error('PARAM_WRONG')); } let me = this; - return new Promise(function(resolve, reject){ + return new Promise(function (resolve, reject){ let msg = createMessage('import'); msg.setParameter('data', armored); - msg.post().then(function(response){ + msg.post().then(function (response){ let infos = {}; let fprs = []; let summary = {}; @@ -282,7 +280,7 @@ export class GPGME_Keyring { if (!response.result.hasOwnProperty('imports') || response.result.imports.length === 0 ){ - resolve({Keys:[],summary: summary}); + resolve({ Keys:[],summary: summary }); return; } for (let res=0; res} * @async */ - generateKey(userId, algo = 'default', expires){ + generateKey (userId, algo = 'default', expires){ if ( - typeof(userId) !== 'string' || + typeof (userId) !== 'string' || + // eslint-disable-next-line no-use-before-define supportedKeyAlgos.indexOf(algo) < 0 || (expires && !(expires instanceof Date)) ){ return Promise.reject(gpgme_error('PARAM_WRONG')); } let me = this; - return new Promise(function(resolve, reject){ + return new Promise(function (resolve, reject){ let msg = createMessage('createkey'); msg.setParameter('userid', userId); msg.setParameter('algo', algo ); @@ -394,15 +393,15 @@ export class GPGME_Keyring { } else { msg.setParameter('expires', 0); } - msg.post().then(function(response){ + msg.post().then(function (response){ me.getKeys(response.fingerprint, true).then( // TODO prepare_sync? - function(result){ + function (result){ resolve(result); - }, function(error){ + }, function (error){ reject(error); }); - }, function(error) { + }, function (error) { reject(error); }); }); diff --git a/lang/js/src/Message.js b/lang/js/src/Message.js index 2134fe9..1ba2b65 100644 --- a/lang/js/src/Message.js +++ b/lang/js/src/Message.js @@ -31,8 +31,8 @@ import { Connection } from './Connection'; * @param {String} operation * @returns {GPGME_Message|GPGME_Error} The Message object */ -export function createMessage(operation){ - if (typeof(operation) !== 'string'){ +export function createMessage (operation){ + if (typeof (operation) !== 'string'){ return gpgme_error('PARAM_WRONG'); } if (permittedOperations.hasOwnProperty(operation)){ @@ -51,7 +51,7 @@ export function createMessage(operation){ */ export class GPGME_Message { - constructor(operation){ + constructor (operation){ this._msg = { op: operation, chunksize: 1023* 1024 @@ -59,7 +59,7 @@ export class GPGME_Message { this._expected = null; } - get operation(){ + get operation (){ return this._msg.op; } @@ -69,7 +69,7 @@ export class GPGME_Message { } } - get expected() { + get expected () { return this._expected; } /** @@ -81,7 +81,7 @@ export class GPGME_Message { * will not encounter problems, larger messages will be received in * chunks. If the value is not explicitly specified, 1023 KB is used. */ - set chunksize(value){ + set chunksize (value){ if ( Number.isInteger(value) && value > 10 * 1024 && @@ -91,7 +91,7 @@ export class GPGME_Message { } } - get chunksize(){ + get chunksize (){ return this._msg.chunksize; } @@ -100,7 +100,7 @@ export class GPGME_Message { * @returns {Object|null} Object to be posted to gnupg, or null if * incomplete */ - get message() { + get message () { if (this.isComplete() === true){ return this._msg; } else { @@ -116,7 +116,7 @@ export class GPGME_Message { * @returns {Boolean} If the parameter was set successfully */ setParameter ( param,value ){ - if (!param || typeof(param) !== 'string'){ + if (!param || typeof (param) !== 'string'){ return gpgme_error('PARAM_WRONG'); } let po = permittedOperations[this._msg.op]; @@ -132,10 +132,10 @@ export class GPGME_Message { return gpgme_error('PARAM_WRONG'); } // check incoming value for correctness - let checktype = function(val){ - switch(typeof(val)){ + let checktype = function (val){ + switch (typeof (val)){ case 'string': - if (poparam.allowed.indexOf(typeof(val)) >= 0 + if (poparam.allowed.indexOf(typeof (val)) >= 0 && val.length > 0) { return true; } @@ -199,7 +199,7 @@ export class GPGME_Message { * all 'required' parameters according to {@link permittedOperations}. * @returns {Boolean} true if message is complete. */ - isComplete(){ + isComplete (){ if (!this._msg.op){ return false; } @@ -220,13 +220,13 @@ export class GPGME_Message { */ post (){ let me = this; - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { if (me.isComplete() === true) { let conn = new Connection; - conn.post(me).then(function(response) { + conn.post(me).then(function (response) { resolve(response); - }, function(reason) { + }, function (reason) { reject(reason); }); } diff --git a/lang/js/src/Signature.js b/lang/js/src/Signature.js index 6536577..a653904 100644 --- a/lang/js/src/Signature.js +++ b/lang/js/src/Signature.js @@ -30,25 +30,27 @@ import { gpgme_error } from './Errors'; * {@link expNote}. * @returns {GPGME_Signature|GPGME_Error} Signature Object */ -export function createSignature(sigObject){ +export function createSignature (sigObject){ if ( - typeof(sigObject) !=='object' || + typeof (sigObject) !=='object' || !sigObject.hasOwnProperty('summary') || !sigObject.hasOwnProperty('fingerprint') || !sigObject.hasOwnProperty('timestamp') - //TODO check if timestamp is mandatory in specification + // TODO check if timestamp is mandatory in specification ){ return gpgme_error('SIG_WRONG'); } let keys = Object.keys(sigObject); for (let i=0; i< keys.length; i++){ - if ( typeof(sigObject[keys[i]]) !== expKeys[keys[i]] ){ + // eslint-disable-next-line no-use-before-define + if ( typeof (sigObject[keys[i]]) !== expKeys[keys[i]] ){ return gpgme_error('SIG_WRONG'); } } let sumkeys = Object.keys(sigObject.summary); for (let i=0; i< sumkeys.length; i++){ - if ( typeof(sigObject.summary[sumkeys[i]]) !== expSum[sumkeys[i]] ){ + // eslint-disable-next-line no-use-before-define + if ( typeof (sigObject.summary[sumkeys[i]]) !== expSum[sumkeys[i]] ){ return gpgme_error('SIG_WRONG'); } } @@ -60,7 +62,8 @@ export function createSignature(sigObject){ let notation = sigObject.notations[i]; let notekeys = Object.keys(notation); for (let j=0; j < notekeys.length; j++){ - if ( typeof(notation[notekeys[j]]) !== expNote[notekeys[j]] ){ + // eslint-disable-next-line no-use-before-define + if ( typeof (notation[notekeys[j]]) !== expNote[notekeys[j]] ){ return gpgme_error('SIG_WRONG'); } } @@ -81,10 +84,10 @@ export function createSignature(sigObject){ */ class GPGME_Signature { - constructor(sigObject){ + constructor (sigObject){ this._rawSigObject = sigObject; } - get fingerprint(){ + get fingerprint (){ if (!this._rawSigObject.fingerprint){ return gpgme_error('SIG_WRONG'); } else { @@ -97,7 +100,7 @@ class GPGME_Signature { * signature does not expire * @returns {Date | null} */ - get expiration(){ + get expiration (){ if (!this._rawSigObject.exp_timestamp){ return null; } @@ -130,7 +133,7 @@ class GPGME_Signature { * for details on the values. * @returns {Object} Object with boolean properties */ - get errorDetails(){ + get errorDetails (){ let properties = ['revoked', 'key-expired', 'sig-expired', 'key-missing', 'crl-missing', 'crl-too-old', 'bad-policy', 'sys-error']; diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 4aa5175..9a0925b 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -84,7 +84,7 @@ import { createSignature } from './Signature'; */ export class GpgME { - constructor(){ + constructor (){ this._Keyring = null; } @@ -92,7 +92,7 @@ export class GpgME { * setter for {@link setKeyring}. * @param {GPGME_Keyring} keyring A Keyring to use */ - set Keyring(keyring){ + set Keyring (keyring){ if (keyring && keyring instanceof GPGME_Keyring){ this._Keyring = keyring; } @@ -100,7 +100,7 @@ export class GpgME { /** * Accesses the {@link GPGME_Keyring}. */ - get Keyring(){ + get Keyring (){ if (!this._Keyring){ this._Keyring = new GPGME_Keyring; } @@ -188,9 +188,9 @@ export class GpgME { if (base64 === true){ msg.setParameter('base64', true); } - return new Promise(function(resolve, reject){ - msg.post().then(function(result){ - let _result = {data: result.data}; + return new Promise(function (resolve, reject){ + msg.post().then(function (result){ + let _result = { data: result.data }; _result.base64 = result.base64 ? true: false; _result.is_mime = result.is_mime ? true: false; if (result.file_name){ @@ -206,7 +206,7 @@ export class GpgME { result.signatures); } resolve(_result); - }, function(error){ + }, function (error){ reject(error); }); }); @@ -240,14 +240,14 @@ export class GpgME { } msg.setParameter('mode', mode); putData(msg, data); - return new Promise(function(resolve,reject) { + return new Promise(function (resolve,reject) { if (mode ==='detached'){ msg.expected ='base64'; } - msg.post().then( function(message) { + msg.post().then( function (message) { if (mode === 'clearsign'){ resolve({ - data: message.data} + data: message.data } ); } else if (mode === 'detached') { resolve({ @@ -255,7 +255,7 @@ export class GpgME { signature: message.data }); } - }, function(error){ + }, function (error){ reject(error); }); }); @@ -278,7 +278,7 @@ export class GpgME { return Promise.reject(dt); } if (signature){ - if (typeof(signature)!== 'string'){ + if (typeof (signature)!== 'string'){ return Promise.reject(gpgme_error('PARAM_WRONG')); } else { msg.setParameter('signature', signature); @@ -287,7 +287,7 @@ export class GpgME { if (base64 === true){ msg.setParameter('base64', true); } - return new Promise(function(resolve, reject){ + return new Promise(function (resolve, reject){ msg.post().then(function (message){ if (!message.info || !message.info.signatures){ reject(gpgme_error('SIG_NO_SIGS')); @@ -301,7 +301,7 @@ export class GpgME { _result.data = message.data; resolve(_result); } - }, function(error){ + }, function (error){ reject(error); }); }); @@ -316,20 +316,20 @@ export class GpgME { * @returns {undefined| GPGME_Error} Error if not successful, nothing otherwise * @private */ -function putData(message, data){ +function putData (message, data){ if (!message || !(message instanceof GPGME_Message)) { return gpgme_error('PARAM_WRONG'); } if (!data){ return gpgme_error('PARAM_WRONG'); - } else if (typeof(data) === 'string') { + } else if (typeof (data) === 'string') { message.setParameter('data', data); } else if ( - typeof(data) === 'object' && - typeof(data.getText) === 'function' + typeof (data) === 'object' && + typeof (data.getText) === 'function' ){ let txt = data.getText(); - if (typeof(txt) === 'string'){ + if (typeof (txt) === 'string'){ message.setParameter('data', txt); } else { return gpgme_error('PARAM_WRONG'); @@ -345,7 +345,7 @@ function putData(message, data){ * @param {Array} sigs * @returns {signatureDetails} Details about the signatures */ -function collectSignatures(sigs){ +function collectSignatures (sigs){ if (!Array.isArray(sigs)){ return gpgme_error('SIG_NO_SIGS'); } diff --git a/lang/js/src/index.js b/lang/js/src/index.js index ad4b05b..cf6e2d0 100644 --- a/lang/js/src/index.js +++ b/lang/js/src/index.js @@ -32,21 +32,21 @@ import { Connection } from './Connection'; * * @async */ -function init(){ - return new Promise(function(resolve, reject){ +function init (){ + return new Promise(function (resolve, reject){ const connection = new Connection; connection.checkConnection(false).then( - function(result){ + function (result){ if (result === true) { resolve(new GpgME()); } else { reject(gpgme_error('CONN_NO_CONNECT')); } - }, function(){ //unspecific connection error. Should not happen + }, function (){ // unspecific connection error. Should not happen reject(gpgme_error('CONN_NO_CONNECT')); }); }); } -const exportvalue = {init:init}; +const exportvalue = { init:init }; export default exportvalue; \ No newline at end of file diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js index f9145da..48ff7fa 100644 --- a/lang/js/src/permittedOperations.js +++ b/lang/js/src/permittedOperations.js @@ -48,7 +48,7 @@ */ export const permittedOperations = { encrypt: { - pinentry: true, //TODO only with signing_keys + pinentry: true, // TODO only with signing_keys required: { 'keys': { allowed: ['string'], @@ -137,7 +137,7 @@ export const permittedOperations = { pinentry: true, required: { 'data': { - allowed: ['string']}, + allowed: ['string'] }, 'keys': { allowed: ['string'], array_allowed: true @@ -337,7 +337,7 @@ export const permittedOperations = { }, answer: { type: [''], - data: {'fingerprint': 'string'} + data: { 'fingerprint': 'string' } } }, @@ -365,9 +365,9 @@ export const permittedOperations = { data: 'string', base64:'boolean', info: 'object' - // file_name: Optional string of the plaintext file name. - // is_mime: Boolean if the messages claims it is MIME. - // signatures: Array of signatures + // info.file_name: Optional string of the plaintext file name. + // info.is_mime: Boolean if the messages claims it is MIME. + // info.signatures: Array of signatures } } }, diff --git a/lang/js/unittest_inputvalues.js b/lang/js/unittest_inputvalues.js index 02bb532..659ef85 100644 --- a/lang/js/unittest_inputvalues.js +++ b/lang/js/unittest_inputvalues.js @@ -1,4 +1,4 @@ -import {createKey} from './src/Key'; +import { createKey } from './src/Key'; export const helper_params = { validLongId: '0A0A0A0A0A0A0A0A', @@ -9,8 +9,8 @@ export const helper_params = { validFingerprints: ['9A9A7A7A8A9A9A7A7A8A9A9A7A7A8A9A9A7A7A8A', '9AAE7A338A9A9A7A7A8A9A9A7A7A8A9A9A7A7DDA'], invalidLongId: '9A9A7A7A8A9A9A7A7A8A', - invalidFingerprints: [{hello:'World'}, ['kekekeke'], new Uint32Array(40)], - invalidKeyArray: {curiosity:'uncat'}, + invalidFingerprints: [{ hello:'World' }, ['kekekeke'], new Uint32Array(40)], + invalidKeyArray: { curiosity:'uncat' }, invalidKeyArray_OneBad: [ createKey('D41735B91236FDB882048C5A2301635EEFF0CB05'), 'E1D18E6E994FA9FE9360Bx0E687B940FEFEB095A', @@ -18,7 +18,7 @@ export const helper_params = { invalidErrorCode: 'Please type in all your passwords.', validGPGME_Key: createKey('D41735B91236FDB882048C5A2301635EEFF0CB05', true), valid_openpgplike: { primaryKey: { - getFingerprint: function(){ + getFingerprint: function (){ return '85DE2A8BA5A5AB3A8A7BE2000B8AED24D7534BC2';} } } diff --git a/lang/js/unittests.js b/lang/js/unittests.js index 47eeabf..0abc106 100644 --- a/lang/js/unittests.js +++ b/lang/js/unittests.js @@ -18,8 +18,8 @@ * SPDX-License-Identifier: LGPL-2.1+ */ -import './node_modules/mocha/mocha'; /*global mocha, it, describe*/ -import './node_modules/chai/chai';/*global chai*/ +import './node_modules/mocha/mocha'; /* global mocha, it, describe*/ +import './node_modules/chai/chai';/* global chai*/ import { helper_params as hp } from './unittest_inputvalues'; import { message_params as mp } from './unittest_inputvalues'; import { whatever_params as wp } from './unittest_inputvalues'; @@ -29,18 +29,18 @@ import { gpgme_error } from './src/Errors'; import { toKeyIdArray , isFingerprint } from './src/Helpers'; import { createKey } from './src/Key'; import { GPGME_Keyring } from './src/Keyring'; -import {GPGME_Message, createMessage} from './src/Message'; +import { GPGME_Message, createMessage } from './src/Message'; mocha.setup('bdd'); const expect = chai.expect; chai.config.includeStack = true; function unittests (){ - describe('Connection testing', function(){ + describe('Connection testing', function (){ - it('Connecting', function(done) { + it('Connecting', function (done) { let conn0 = new Connection; - conn0.checkConnection().then(function(answer) { + conn0.checkConnection().then(function (answer) { expect(answer).to.not.be.empty; expect(answer.gpgme).to.not.be.undefined; expect(answer.gpgme).to.be.a('string'); @@ -52,12 +52,12 @@ function unittests (){ }); - it('Disconnecting', function(done) { + it('Disconnecting', function (done) { let conn0 = new Connection; - conn0.checkConnection(false).then(function(answer) { + conn0.checkConnection(false).then(function (answer) { expect(answer).to.be.true; conn0.disconnect(); - conn0.checkConnection(false).then(function(result) { + conn0.checkConnection(false).then(function (result) { expect(result).to.be.false; done(); }); @@ -65,9 +65,9 @@ function unittests (){ }); }); - describe('Error Object handling', function(){ + describe('Error Object handling', function (){ // TODO: new GPGME_Error codes - it('check the Timeout error', function(){ + it('check the Timeout error', function (){ let test0 = gpgme_error('CONN_TIMEOUT'); expect(test0).to.be.an.instanceof(Error); @@ -75,7 +75,7 @@ function unittests (){ }); it('Error Object returns generic code if code is not listed', - function(){ + function (){ let test0 = gpgme_error(hp.invalidErrorCode); expect(test0).to.be.an.instanceof(Error); @@ -83,22 +83,22 @@ function unittests (){ } ); - it('Warnings like PARAM_IGNORED should not return errors', function(){ + it('Warnings like PARAM_IGNORED should not return errors', function (){ let test0 = gpgme_error('PARAM_IGNORED'); expect(test0).to.be.null; }); }); - describe('Fingerprint checking', function(){ + describe('Fingerprint checking', function (){ - it('isFingerprint(): valid Fingerprint', function(){ + it('isFingerprint(): valid Fingerprint', function (){ let test0 = isFingerprint(hp.validFingerprint); expect(test0).to.be.true; }); - it('isFingerprint(): invalid Fingerprints', function(){ + it('isFingerprint(): invalid Fingerprints', function (){ for (let i=0; i < hp.invalidFingerprints.length; i++){ let test0 = isFingerprint(hp.invalidFingerprints[i]); @@ -107,16 +107,16 @@ function unittests (){ }); }); - describe('toKeyIdArray() (converting input to fingerprint)', function(){ + describe('toKeyIdArray() (converting input to fingerprint)', function (){ - it('Correct fingerprint string', function(){ + it('Correct fingerprint string', function (){ let test0 = toKeyIdArray(hp.validFingerprint); expect(test0).to.be.an('array'); expect(test0).to.include(hp.validFingerprint); }); - it('openpgpjs-like object', function(){ + it('openpgpjs-like object', function (){ let test0 = toKeyIdArray(hp.valid_openpgplike); expect(test0).to.be.an('array').with.lengthOf(1); @@ -124,33 +124,33 @@ function unittests (){ hp.valid_openpgplike.primaryKey.getFingerprint()); }); - it('Array of valid inputs', function(){ + it('Array of valid inputs', function (){ let test0 = toKeyIdArray(hp.validKeys); expect(test0).to.be.an('array'); expect(test0).to.have.lengthOf(hp.validKeys.length); }); - it('Incorrect inputs', function(){ + it('Incorrect inputs', function (){ - it('valid Long ID', function(){ + it('valid Long ID', function (){ let test0 = toKeyIdArray(hp.validLongId); expect(test0).to.be.empty; }); - it('invalidFingerprint', function(){ + it('invalidFingerprint', function (){ let test0 = toKeyIdArray(hp.invalidFingerprint); expect(test0).to.be.empty; }); - it('invalidKeyArray', function(){ + it('invalidKeyArray', function (){ let test0 = toKeyIdArray(hp.invalidKeyArray); expect(test0).to.be.empty; }); - it('Partially invalid array', function(){ + it('Partially invalid array', function (){ let test0 = toKeyIdArray(hp.invalidKeyArray_OneBad); expect(test0).to.be.an('array'); @@ -160,10 +160,10 @@ function unittests (){ }); }); - describe('GPGME_Key', function(){ - it('Key has data after a first refresh', function(done) { + describe('GPGME_Key', function (){ + it('Key has data after a first refresh', function (done) { let key = createKey(kp.validKeyFingerprint); - key.refreshKey().then(function(key2){ + key.refreshKey().then(function (key2){ expect(key2.get).to.be.a('function'); for (let i=0; i < kp.validKeyProperties.length; i++) { let prop = key2.get(kp.validKeyProperties[i]); @@ -181,7 +181,7 @@ function unittests (){ it('Non-cached key async data retrieval', function (done){ let key = createKey(kp.validKeyFingerprint, true); - key.get('can_authenticate').then(function(result){ + key.get('can_authenticate').then(function (result){ expect(result).to.be.a('boolean'); done(); }); @@ -189,7 +189,7 @@ function unittests (){ it('Non-cached key async armored Key', function (done){ let key = createKey(kp.validKeyFingerprint, true); - key.get('armored').then(function(result){ + key.get('armored').then(function (result){ expect(result).to.be.a('string'); expect(result).to.include('KEY BLOCK-----'); done(); @@ -198,7 +198,7 @@ function unittests (){ it('Non-cached key async hasSecret', function (done){ let key = createKey(kp.validKeyFingerprint, true); - key.get('hasSecret').then(function(result){ + key.get('hasSecret').then(function (result){ expect(result).to.be.a('boolean'); done(); }); @@ -206,24 +206,24 @@ function unittests (){ it('Non-cached key async hasSecret (no secret in Key)', function (done){ let key = createKey(kp.validFingerprintNoSecret, true); - key.get('hasSecret').then(function(result){ + key.get('hasSecret').then(function (result){ expect(result).to.be.a('boolean'); expect(result).to.equal(false); done(); }); }); - it('Querying non-existing Key returns an error', function(done) { + it('Querying non-existing Key returns an error', function (done) { let key = createKey(kp.invalidKeyFingerprint); - key.refreshKey().then(function(){}, - function(error){ + key.refreshKey().then(function (){}, + function (error){ expect(error).to.be.an.instanceof(Error); expect(error.code).to.equal('KEY_NOKEY'); done(); }); }); - it('createKey returns error if parameters are wrong', function(){ + it('createKey returns error if parameters are wrong', function (){ for (let i=0; i< 4; i++){ let key0 = createKey(wp.four_invalid_params[i]); expect(key0).to.be.an.instanceof(Error); @@ -248,18 +248,18 @@ function unittests (){ // }); }); - describe('GPGME_Keyring', function(){ + describe('GPGME_Keyring', function (){ - it('correct Keyring initialization', function(){ + it('correct Keyring initialization', function (){ let keyring = new GPGME_Keyring; expect(keyring).to.be.an.instanceof(GPGME_Keyring); expect(keyring.getKeys).to.be.a('function'); }); it('Loading Keys from Keyring, to be used synchronously', - function(done){ + function (done){ let keyring = new GPGME_Keyring; - keyring.getKeys(null, true).then(function(result){ + keyring.getKeys(null, true).then(function (result){ expect(result).to.be.an('array'); expect(result[0].get('hasSecret')).to.be.a('boolean'); done(); @@ -268,10 +268,10 @@ function unittests (){ ); it('Loading specific Key from Keyring, to be used synchronously', - function(done){ + function (done){ let keyring = new GPGME_Keyring; keyring.getKeys(kp.validKeyFingerprint, true).then( - function(result){ + function (result){ expect(result).to.be.an('array'); expect(result[0].get('hasSecret')).to.be.a('boolean'); done(); @@ -280,10 +280,10 @@ function unittests (){ } ); - it('Querying non-existing Key from Keyring', function(done){ + it('Querying non-existing Key from Keyring', function (done){ let keyring = new GPGME_Keyring; keyring.getKeys(kp.invalidKeyFingerprint, true).then( - function(result){ + function (result){ expect(result).to.be.an('array'); expect(result.length).to.equal(0); done(); @@ -293,16 +293,16 @@ function unittests (){ }); - describe('GPGME_Message', function(){ + describe('GPGME_Message', function (){ - it('creating encrypt Message', function(){ + it('creating encrypt Message', function (){ let test0 = createMessage('encrypt'); expect(test0).to.be.an.instanceof(GPGME_Message); expect(test0.isComplete()).to.be.false; }); - it('Message is complete after setting mandatory data', function(){ + it('Message is complete after setting mandatory data', function (){ let test0 = createMessage('encrypt'); test0.setParameter('data', mp.valid_encrypt_data); test0.setParameter('keys', hp.validFingerprints); @@ -310,14 +310,14 @@ function unittests (){ expect(test0.isComplete()).to.be.true; }); - it('Message is not complete after mandatory data is empty', function(){ + it('Message is not complete after mandatory data is empty', function (){ let test0 = createMessage('encrypt'); test0.setParameter('data', ''); test0.setParameter('keys', hp.validFingerprints); expect(test0.isComplete()).to.be.false; }); - it('Complete Message contains the data that was set', function(){ + it('Complete Message contains the data that was set', function (){ let test0 = createMessage('encrypt'); test0.setParameter('data', mp.valid_encrypt_data); test0.setParameter('keys', hp.validFingerprints); @@ -330,20 +330,20 @@ function unittests (){ mp.valid_encrypt_data); }); - it ('Not accepting non-allowed operation', function(){ + it ('Not accepting non-allowed operation', function (){ let test0 = createMessage(mp.invalid_op_action); expect(test0).to.be.an.instanceof(Error); expect(test0.code).to.equal('MSG_WRONG_OP'); }); - it('Not accepting wrong parameter type', function(){ + it('Not accepting wrong parameter type', function (){ let test0 = createMessage(mp.invalid_op_type); expect(test0).to.be.an.instanceof(Error); expect(test0.code).to.equal('PARAM_WRONG'); }); - it('Not accepting wrong parameter name', function(){ + it('Not accepting wrong parameter name', function (){ let test0 = createMessage(mp.invalid_param_test.valid_op); for (let i=0; i < mp.invalid_param_test.invalid_param_names.length; i++){ @@ -356,7 +356,7 @@ function unittests (){ } }); - it('Not accepting wrong parameter value', function(){ + it('Not accepting wrong parameter value', function (){ let test0 = createMessage(mp.invalid_param_test.valid_op); for (let j=0; j < mp.invalid_param_test.invalid_values_0.length; j++){ @@ -372,4 +372,4 @@ function unittests (){ } -export default {unittests}; \ No newline at end of file +export default { unittests }; \ No newline at end of file ----------------------------------------------------------------------- Summary of changes: lang/js/.eslintrc.json | 19 +- .../BrowserTestExtension/tests/KeyImportExport.js | 46 ++-- lang/js/BrowserTestExtension/tests/KeyInfos.js | 12 +- lang/js/BrowserTestExtension/tests/decryptTest.js | 14 +- .../tests/encryptDecryptTest.js | 6 +- lang/js/BrowserTestExtension/tests/encryptTest.js | 10 +- lang/js/BrowserTestExtension/tests/inputvalues.js | 16 +- .../BrowserTestExtension/tests/longRunningTests.js | 6 +- lang/js/BrowserTestExtension/tests/signTest.js | 4 +- lang/js/BrowserTestExtension/tests/startup.js | 6 +- lang/js/BrowserTestExtension/tests/verifyTest.js | 14 +- lang/js/DemoExtension/entry.js | 2 +- lang/js/DemoExtension/maindemo.js | 40 ++-- lang/js/src/Connection.js | 40 ++-- lang/js/src/Errors.js | 8 +- lang/js/src/Helpers.js | 16 +- lang/js/src/Key.js | 243 +++++++++++---------- lang/js/src/Keyring.js | 83 ++++--- lang/js/src/Message.js | 32 +-- lang/js/src/Signature.js | 23 +- lang/js/src/gpgmejs.js | 40 ++-- lang/js/src/index.js | 10 +- lang/js/src/permittedOperations.js | 12 +- lang/js/unittest_inputvalues.js | 8 +- lang/js/unittests.js | 108 ++++----- 25 files changed, 421 insertions(+), 397 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 20 16:38:52 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 20 Aug 2018 16:38:52 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-127-g8103eeb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 8103eeba809b6e7156d861783309574b93909169 (commit) from 75bc5e6356eca1b7fb76653e7c82c2477f8859b0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8103eeba809b6e7156d861783309574b93909169 Author: Andre Heinecke Date: Mon Aug 20 16:38:36 2018 +0200 json: Add subkey_algo and defaults to createkey * src/gpgme-json.c (op_createkey, hlp_createkey): Add subkey_algo handling. (hlp_createkey): Fix documentation of expiry. -- Due to the funny quick-gen-key interface generating a key with an explicit algo would result in bad defaults (only an SC key), without a subkey. This adds handling that should probably be in GnuPG proper to fix the semantics of createkey by adding default subkey_algo handling. diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 5a9b9cf..99c6652 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -2878,8 +2878,15 @@ static const char hlp_createkey[] = "userid: The user id. E.g. \"Foo Bar \"\n" "\n" "Optional parameters:\n" - "algo: Algo of the key as string. See doc for gpg --quick-gen-key.\n" - "expires: Seconds since epoch to expiry as Number. 0 means no expiry.\n" + "algo: Algo of the key as string. See doc for gpg --quick-gen-key.\n" + "subkey-algo: Algo of the encryption subkey. If ommited the same as algo\n" + " is used.\n" + " Except for dsa and ed25519 where the according\n" + " elg / cv25519 algo will be used as subkey-algo.\n" + "\n" + " If algo is omitted or default or future-default subkey-algo\n" + " is ignored.\n" + "expires: Seconds from now to expiry as Number. 0 means no expiry.\n" "\n" "Response on success:\n" "fingerprint: The fingerprint of the created key.\n" @@ -2891,12 +2898,14 @@ op_createkey (cjson_t request, cjson_t result) { gpg_error_t err; gpgme_ctx_t ctx = NULL; - unsigned int flags = 0; + unsigned int flags = GPGME_CREATE_FORCE; /* Always force as the GUI should + handle checks, if required. */ unsigned long expires = 0; cjson_t j_tmp; const char *algo = "default"; const char *userid; gpgme_genkey_result_t res; + char *new_fpr = NULL; #ifdef GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER /* GnuPG forbids keygen through the browser socket so for @@ -2950,9 +2959,58 @@ op_createkey (cjson_t request, cjson_t result) goto leave; } - xjson_AddStringToObject0 (result, "fingerprint", res->fpr); + /* Dup the fpr as the result might become invalid after context reuse. */ + new_fpr = xstrdup (res->fpr); + + if (algo && strcmp ("default", algo) && strcmp ("future-default", algo)) + { + /* We need to add the encryption subkey manually */ + gpgme_ctx_t keylistctx = create_onetime_context (GPGME_PROTOCOL_OpenPGP); + gpgme_key_t new_key = NULL; + char *subkey_algo = NULL; + + j_tmp = cJSON_GetObjectItem (request, "subkey_algo"); + if (j_tmp && cjson_is_string (j_tmp)) + { + subkey_algo = xstrdup (j_tmp->valuestring); + } + + if (!subkey_algo) + { + subkey_algo = strdup (algo); + if (!strncmp ("dsa", subkey_algo, 3)) + { + subkey_algo[0] = 'e'; + subkey_algo[1] = 'l'; + subkey_algo[2] = 'g'; + } + if (!strcmp ("ed25519", subkey_algo)) + { + strcpy (subkey_algo, "cv25519"); + } + } + + err = gpgme_get_key (keylistctx, new_fpr, &new_key, 1); + release_onetime_context (keylistctx); + if (err) + { + gpg_error_object (result, err, "Error finding created key: %s", + gpg_strerror (err)); + xfree (subkey_algo); + goto leave; + } + + err = gpgme_op_createsubkey (ctx, new_key, subkey_algo, + 0, expires, flags |= GPGME_CREATE_ENCR); + xfree (subkey_algo); + if (err) + goto leave; + } + + xjson_AddStringToObject0 (result, "fingerprint", new_fpr); leave: + xfree (new_fpr); #ifdef GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER release_context (ctx); #else ----------------------------------------------------------------------- Summary of changes: src/gpgme-json.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 4 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 20 17:46:05 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Mon, 20 Aug 2018 17:46:05 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-104-g91c2362 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 91c2362550f787cc28d764c0e571e911c740f74f (commit) from dd32daad0bb21e3d5567326d0b2e548ff8510431 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 91c2362550f787cc28d764c0e571e911c740f74f Author: Maximilian Krambach Date: Mon Aug 20 17:46:29 2018 +0200 js: set expiry date on generateKey -- * on the javascript side a Date is expected, gpggme-json expects seconds from 'now' diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 90d267d..7d9b370 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -388,8 +388,9 @@ export class GPGME_Keyring { msg.setParameter('userid', userId); msg.setParameter('algo', algo ); if (expires){ + const now = new Date(); msg.setParameter('expires', - Math.floor(expires.valueOf()/1000)); + Math.floor((expires - now) /1000)); } else { msg.setParameter('expires', 0); } ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 20 18:04:27 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Mon, 20 Aug 2018 18:04:27 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-105-gd77a1c8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via d77a1c887d6a5e892329534c94f95eaf8bb88492 (commit) from 91c2362550f787cc28d764c0e571e911c740f74f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d77a1c887d6a5e892329534c94f95eaf8bb88492 Author: Maximilian Krambach Date: Mon Aug 20 18:05:34 2018 +0200 js: add option "subkey-algo" to generateKey -- * The option was recently added to gpgme-json; this reflects this on javascript side diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 7d9b370..81a047c 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -366,14 +366,16 @@ export class GPGME_Keyring { * @param {String} userId The user Id, e.g. 'Foo Bar ' * @param {String} algo (optional) algorithm (and optionally key size) * to be used. See {@link supportedKeyAlgos} below for supported - * values. + * values. If ommitted, 'default' is used. * @param {Date} expires (optional) Expiration date. If not set, * expiration will be set to 'never' + * @param {String} subkey_algo (optional) algorithm of the encryption + * subkey. If ommited the same as algo is used. * * @return {Promise} * @async */ - generateKey (userId, algo = 'default', expires){ + generateKey (userId, algo = 'default', expires, subkey_algo){ if ( typeof (userId) !== 'string' || // eslint-disable-next-line no-use-before-define @@ -382,11 +384,18 @@ export class GPGME_Keyring { ){ return Promise.reject(gpgme_error('PARAM_WRONG')); } + // eslint-disable-next-line no-use-before-define + if (subkey_algo && supportedKeyAlgos.indexOf(subkey_algo) < 0 ){ + return Promise.reject(gpgme_error('PARAM_WRONG')); + } let me = this; return new Promise(function (resolve, reject){ let msg = createMessage('createkey'); msg.setParameter('userid', userId); msg.setParameter('algo', algo ); + if (subkey_algo) { + msg.setParameter('subkey-algo', subkey_algo ); + } if (expires){ const now = new Date(); msg.setParameter('expires', diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js index 48ff7fa..3142725 100644 --- a/lang/js/src/permittedOperations.js +++ b/lang/js/src/permittedOperations.js @@ -331,6 +331,9 @@ export const permittedOperations = { algo: { allowed: ['string'] }, + 'subkey-algo': { + allowed: ['string'] + }, expires: { allowed: ['number'], } ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 13 +++++++++++-- lang/js/src/permittedOperations.js | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 21 11:42:55 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Tue, 21 Aug 2018 11:42:55 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-106-g8b8c009 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 8b8c009dee8ae5493e7f888ee518468dbfcf5375 (commit) from d77a1c887d6a5e892329534c94f95eaf8bb88492 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8b8c009dee8ae5493e7f888ee518468dbfcf5375 Author: Maximilian Krambach Date: Tue Aug 21 11:42:11 2018 +0200 js: set expiry of generatedKey to seconds from now -- * src/Keyring.js: Changed key ecpiration from Date to seconds from creation, as in gpgme. The Date parameter used before was due to a misunderstanding in documentation and requests from potential users. diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 81a047c..ab0144e 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -367,8 +367,8 @@ export class GPGME_Keyring { * @param {String} algo (optional) algorithm (and optionally key size) * to be used. See {@link supportedKeyAlgos} below for supported * values. If ommitted, 'default' is used. - * @param {Date} expires (optional) Expiration date. If not set, - * expiration will be set to 'never' + * @param {Number} expires (optional) Expiration time in seconds from now. + * If not set or set to 0, expiration will be 'never' * @param {String} subkey_algo (optional) algorithm of the encryption * subkey. If ommited the same as algo is used. * @@ -380,7 +380,7 @@ export class GPGME_Keyring { typeof (userId) !== 'string' || // eslint-disable-next-line no-use-before-define supportedKeyAlgos.indexOf(algo) < 0 || - (expires && !(expires instanceof Date)) + (expires && !( Number.isInteger(expires) || expires < 0 )) ){ return Promise.reject(gpgme_error('PARAM_WRONG')); } @@ -397,9 +397,7 @@ export class GPGME_Keyring { msg.setParameter('subkey-algo', subkey_algo ); } if (expires){ - const now = new Date(); - msg.setParameter('expires', - Math.floor((expires - now) /1000)); + msg.setParameter('expires', expires); } else { msg.setParameter('expires', 0); } ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 21 13:58:55 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 21 Aug 2018 13:58:55 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-111-g0036b9b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 0036b9bc493f0482cc7c4619867649481393163e (commit) via 738a8e6f950af08305c082d59a91d3d5d45800fa (commit) via 9608996d88549b60da490e5eeb41db023f97a038 (commit) via 605eb8a8bfcb12141d7cc5626e75af812cda6c75 (commit) via fe3de5b86b4a25f5b23cf1af2fd1809ef6c087a0 (commit) from 8b8c009dee8ae5493e7f888ee518468dbfcf5375 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0036b9bc493f0482cc7c4619867649481393163e Author: Andre Heinecke Date: Tue Aug 21 13:58:06 2018 +0200 js: Fix library name mentioned in js Makefiles -- diff --git a/lang/js/BrowserTestExtension/Makefile.am b/lang/js/BrowserTestExtension/Makefile.am index 6153f7d..8f0a4f9 100644 --- a/lang/js/BrowserTestExtension/Makefile.am +++ b/lang/js/BrowserTestExtension/Makefile.am @@ -1,14 +1,14 @@ -# Makefile.am for GPGME-JS. +# Makefile.am for gpgme.js. # Copyright (C) 2018 Intevation GmbH # # This file is part of GPGME. # -# GPGME-CL is free software; you can redistribute it and/or modify it +# gpgme.js is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# GPGME-CL is distributed in the hope that it will be useful, +# gpgme.js is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. diff --git a/lang/js/DemoExtension/Makefile.am b/lang/js/DemoExtension/Makefile.am index e93d0f6..d6e87fd 100644 --- a/lang/js/DemoExtension/Makefile.am +++ b/lang/js/DemoExtension/Makefile.am @@ -1,14 +1,14 @@ -# Makefile.am for GPGME-JS. +# Makefile.am for gpgme.js. # Copyright (C) 2018 Intevation GmbH # -# This file is part of GPGME-CL. +# This file is part of gpgme.js. # -# GPGME-CL is free software; you can redistribute it and/or modify it +# gpgme.js is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# GPGME-CL is distributed in the hope that it will be useful, +# gpgme.js is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. diff --git a/lang/js/Makefile.am b/lang/js/Makefile.am index daa3d1e..40a1c4f 100644 --- a/lang/js/Makefile.am +++ b/lang/js/Makefile.am @@ -1,14 +1,14 @@ -# Makefile.am for GPGME-JS. -# Copyright (C) 2018 2018 Bundesamt f?r Sicherheit in der Informationstechnik +# Makefile.am for gpgme.js. +# Copyright (C) 2018 Bundesamt f?r Sicherheit in der Informationstechnik # -# This file is part of GPGME-JS. +# This file is part of gpgme.js. # -# GPGME-JS is free software; you can redistribute it and/or modify it +# gpgme.js is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# GPGME-JS is distributed in the hope that it will be useful, +# gpgme.js is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. diff --git a/lang/js/src/Makefile.am b/lang/js/src/Makefile.am index dd330d5..dc58fd3 100644 --- a/lang/js/src/Makefile.am +++ b/lang/js/src/Makefile.am @@ -1,14 +1,14 @@ -# Makefile.am for GPGME-JS. +# Makefile.am for gpgme.js. # Copyright (C) 2018 Intevation GmbH # # This file is part of GPGME. # -# GPGME-CL is free software; you can redistribute it and/or modify it +# gpgme.js is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# GPGME-CL is distributed in the hope that it will be useful, +# gpgme.js is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. commit 738a8e6f950af08305c082d59a91d3d5d45800fa Author: Andre Heinecke Date: Tue Aug 21 13:56:45 2018 +0200 js: Update extra_dist files * lang/js/BrowserTestExtension/Makefile.am, lang/js/Makefile.am (EXTRA_DIST): Update. diff --git a/lang/js/BrowserTestExtension/Makefile.am b/lang/js/BrowserTestExtension/Makefile.am index 340d7ad..6153f7d 100644 --- a/lang/js/BrowserTestExtension/Makefile.am +++ b/lang/js/BrowserTestExtension/Makefile.am @@ -32,11 +32,14 @@ EXTRA_DIST = browsertest.html \ testkey2.pub \ testkey.pub \ testkey.sec \ + tests/decryptTest.js \ tests/encryptDecryptTest.js \ tests/encryptTest.js \ tests/inputvalues.js \ tests/KeyImportExport.js \ + tests/KeyInfos.js \ tests/longRunningTests.js \ tests/signTest.js \ tests/startup.js \ + tests/verifyTest.js \ unittests.html diff --git a/lang/js/Makefile.am b/lang/js/Makefile.am index 4b5c717..daa3d1e 100644 --- a/lang/js/Makefile.am +++ b/lang/js/Makefile.am @@ -23,11 +23,10 @@ SUBDIRS = src BrowserTestExtension DemoExtension EXTRA_DIST = build_extensions.sh \ CHECKLIST \ CHECKLIST_build \ + jsdoc.conf \ .eslintrc.json \ - Makefile.am \ package.json \ README \ - README_testing \ unittest_inputvalues.js \ unittests.js \ webpack.conf.js \ commit 9608996d88549b60da490e5eeb41db023f97a038 Author: Andre Heinecke Date: Tue Aug 21 13:24:08 2018 +0200 Add example manifests for gpgme-json * doc/examples/gpgme-chrome.json, doc/examples/gpgme-mozilla.json: New. * doc/Makefile.am (EXTRA_DIST): Include them. -- The id contained in the examples is the ID of Mailvelope. diff --git a/doc/Makefile.am b/doc/Makefile.am index 905f953..a592f79 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -23,7 +23,8 @@ DISTCLEANFILES = gpgme.tmp CLEANFILES = mkdefsinc defs.inc EXTRA_DIST = module-overview.sk HACKING DCO ChangeLog-2011 \ - mkdefsinc.c defsincdate + mkdefsinc.c defsincdate \ + examples/gpgme-mozilla.json examples/gpgme-chrome.json BUILT_SOURCES = defsincdate defs.inc diff --git a/doc/examples/gpgme-chrome.json b/doc/examples/gpgme-chrome.json new file mode 100644 index 0000000..d250ecb --- /dev/null +++ b/doc/examples/gpgme-chrome.json @@ -0,0 +1,9 @@ +{ + "name": "gpgmejson", + "description": "Integration with GnuPG", + "path": "/usr/bin/gpgme-json", + "type": "stdio", + "allowed_origins": [ + "chrome-extension://kajibbejlbohfaggdiogboambcijhkke/" + ] +} diff --git a/doc/examples/gpgme-mozilla.json b/doc/examples/gpgme-mozilla.json new file mode 100644 index 0000000..493b398 --- /dev/null +++ b/doc/examples/gpgme-mozilla.json @@ -0,0 +1,9 @@ +{ + "name": "gpgmejson", + "description": "Integration with GnuPG", + "path": "/usr/bin/gpgme-json", + "type": "stdio", + "allowed_extensions": [ + "jid1-AQqSMBYb0a8ADg at jetpack" + ] +} commit 605eb8a8bfcb12141d7cc5626e75af812cda6c75 Author: Andre Heinecke Date: Tue Aug 21 13:26:01 2018 +0200 js: Improve README * lang/js/README: Clarify structure at the beginning. diff --git a/lang/js/README b/lang/js/README index b7cd3d7..fd95cc4 100644 --- a/lang/js/README +++ b/lang/js/README @@ -1,16 +1,41 @@ -gpgme.js, as contained in this directory, is a javascript library for direct use -of gnupg in browsers, with the help of nativeMessaging. +gpgme.js - JavaScript for GPGME +------------------------------- +Initially developed for integration with the Mailvelope Web Extension. + +Overview +-------- + +gpgme.js is a javascript library for direct use of GnuPG in browsers. +It interacts with GPGME through nativeMessaging and gpgme-json. + +It is meant to be distributed directly by its downstream users in +their extension package. As such it is not integrated in the +autotools build system. See build instructions below. + + +gpgme-json +---------- + +gpgme-json (see core src/gpgme-json.c) the json to GPGME bridge is +required as native messaging backend for gpgme.js to work. +It needs to be installed and registered as native messaging +backend with the browser. + +See gpgme-mozilla.json and gpgme-chrome.json examples in +the top level doc/examples as example manifests. + +Any web extension using gpgme.js will need to be whitelisted in the manifest +file by its id. + +Distributors are encouraged to create manifest packages for their +distributions. -Prerequisites: --------------- -gpgme.js will make use of the application gpgme-json, which is distributed with -gpgme. Gpgme-json needs to be installed; it will further need to accept the -browser extension in the manifest file. Building gpgme.js ----------------- -gpgme.js uses webpack, and thus depends on nodejs for building. All -dependencies will be installed (in a local subdirectory) with the command + +gpgme.js uses webpack, and thus depends on Node.js for building. +All dependencies will be installed (in a local subdirectory) with the command `npm install`. To create a current version of the package, the command is @@ -18,6 +43,7 @@ To create a current version of the package, the command is If you want a more debuggable (i.e. not minified) build, just change the mode in webpack.conf.js. + Demo and Test WebExtension: --------------------------- @@ -82,6 +108,7 @@ is needed, with the following content: The manifest for linux is usually placed at: `~/.mozilla/native-messaging-hosts/gpgmejson.json` + Documentation ------------- commit fe3de5b86b4a25f5b23cf1af2fd1809ef6c087a0 Author: Andre Heinecke Date: Tue Aug 21 12:49:22 2018 +0200 Remove js as language from configure.ac * configure.ac: Remove js language. -- It does not make much sense to integrate gpgme-js into the GPGME build system. gpgme-js will be distrbuted by it's users as part of the web extensions / their distribution as that is the JavaScript way. So they can use their tools etc. to compile gpgme-js JavaScript style, which is documented in the lang/js folder. diff --git a/configure.ac b/configure.ac index 69d7132..65f1ef9 100644 --- a/configure.ac +++ b/configure.ac @@ -187,7 +187,7 @@ have_w64_system=no have_macos_system=no build_w32_glib=no build_w32_qt=no -available_languages="cl cpp python python2 python3 qt js" +available_languages="cl cpp python python2 python3 qt" default_languages="cl cpp python qt" case "${host}" in x86_64-*mingw32*) @@ -479,28 +479,6 @@ fi AC_SUBST(ENABLED_LANGUAGES, $enabled_languages) -# The javascript bindings -LIST_MEMBER("js", $enabled_languages) -if test "$found" = "1"; then - AC_CHECK_PROGS([NPX], [npx]) - if test -z "$NPX"; then - if test "$explicit_languages" = "1"; then - AC_MSG_ERROR([[ -*** -*** Node.js (npx) is required for the JavaScript binding. -***]]) - else - AC_MSG_WARN([ -*** -*** Node.js (npx) not found - JavaScript binding will not be built. -***]) - enabled_languages=$(echo $enabled_languages | sed 's/js//') - fi - fi -fi -AM_CONDITIONAL([BUILD_JS_BINDINGS], - [test -n "$NPX"]) - # # Provide information about the build. # ----------------------------------------------------------------------- Summary of changes: configure.ac | 24 +---------------- doc/Makefile.am | 3 ++- doc/examples/gpgme-chrome.json | 9 +++++++ doc/examples/gpgme-mozilla.json | 9 +++++++ lang/js/BrowserTestExtension/Makefile.am | 9 ++++--- lang/js/DemoExtension/Makefile.am | 8 +++--- lang/js/Makefile.am | 13 +++++---- lang/js/README | 45 +++++++++++++++++++++++++------- lang/js/src/Makefile.am | 6 ++--- 9 files changed, 76 insertions(+), 50 deletions(-) create mode 100644 doc/examples/gpgme-chrome.json create mode 100644 doc/examples/gpgme-mozilla.json hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 21 14:36:58 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Tue, 21 Aug 2018 14:36:58 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-112-g9dd6c67 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 9dd6c67cd5ae8bf394c4c257d6d16907018761c2 (commit) from 0036b9bc493f0482cc7c4619867649481393163e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9dd6c67cd5ae8bf394c4c257d6d16907018761c2 Author: Maximilian Krambach Date: Tue Aug 21 14:37:50 2018 +0200 js: remove outdated checklists -- * They are heavily outdated and offer no more useful information diff --git a/lang/js/CHECKLIST b/lang/js/CHECKLIST deleted file mode 100644 index 2e70dff..0000000 --- a/lang/js/CHECKLIST +++ /dev/null @@ -1,31 +0,0 @@ -NativeConnection: - - [X] nativeConnection: successfully sending an encrypt request, -receiving an answer - [X] nativeConnection successfull on Chromium, chrome and firefox - [*] nativeConnection successfull on Windows, macOS, Linux - [X] nativeConnection with delayed, multipart (> 1MB) answer - - [x] Message handling (encrypt, decrypt verify, sign) - [x] encrypt, decrypt - [x] verify - [x] sign - [*] Key handling (import/export, modifying, status queries) - [x] Import (not importing secret) - [x] Export (not exporting secret) - [*] status queries - [ ] getHasSecret - [ ] key generation - [ ] modification - [x] Configuration handling - [ ] check for completeness - -Communication with other implementations - [-] option to export SECRET Key into localstore used by e.g. mailvelope? - current discussion states that this won't be possible due to security - concerns -Management: - [*] Define the gpgme interface - [x] check Permissions (e.g. csp) for the different envs - [x] agree on license - [*] tests diff --git a/lang/js/CHECKLIST_build b/lang/js/CHECKLIST_build deleted file mode 100644 index a7c8d08..0000000 --- a/lang/js/CHECKLIST_build +++ /dev/null @@ -1,3 +0,0 @@ -- Checklist for build/install: - -browsers' manifests (see README) need allowedextension added, and the path set diff --git a/lang/js/Makefile.am b/lang/js/Makefile.am index 40a1c4f..4464730 100644 --- a/lang/js/Makefile.am +++ b/lang/js/Makefile.am @@ -21,8 +21,6 @@ SUBDIRS = src BrowserTestExtension DemoExtension EXTRA_DIST = build_extensions.sh \ - CHECKLIST \ - CHECKLIST_build \ jsdoc.conf \ .eslintrc.json \ package.json \ ----------------------------------------------------------------------- Summary of changes: lang/js/CHECKLIST | 31 ------------------------------- lang/js/CHECKLIST_build | 3 --- lang/js/Makefile.am | 2 -- 3 files changed, 36 deletions(-) delete mode 100644 lang/js/CHECKLIST delete mode 100644 lang/js/CHECKLIST_build hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 21 14:39:03 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 21 Aug 2018 14:39:03 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-128-g263dadb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 263dadb04aed4f973248b32c52af6ca59bcb7c1f (commit) from 8103eeba809b6e7156d861783309574b93909169 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 263dadb04aed4f973248b32c52af6ca59bcb7c1f Author: Andre Heinecke Date: Tue Aug 21 14:36:42 2018 +0200 json: Add proper decrypt_result_t handling * src/gpgme-json.c (recipient_to_json, decrypt_result_to_json): New. (op_decrypt, hlp_decrypt): Update. -- The op_decrypt as one of the first operations did not yet match the current 1 <> 1 mapping of gpgme types to json dictonaries. info and dec_info are bad names but used for compatibility reasons. diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 99c6652..d636ddb 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -1154,6 +1154,55 @@ verify_result_to_json (gpgme_verify_result_t verify_result) return result; } +/* Create a recipient json object */ +static cjson_t +recipient_to_json (gpgme_recipient_t recp) +{ + cjson_t result = xjson_CreateObject (); + + xjson_AddStringToObject0 (result, "keyid", recp->keyid); + xjson_AddStringToObject0 (result, "pubkey_algo_name", + gpgme_pubkey_algo_name (recp->pubkey_algo)); + xjson_AddStringToObject0 (result, "status_string", + gpgme_strerror (recp->status)); + + xjson_AddNumberToObject (result, "status_code", recp->status); + + return result; +} + + +/* Create a JSON object from a gpgme_decrypt result */ +static cjson_t +decrypt_result_to_json (gpgme_decrypt_result_t decrypt_result) +{ + cjson_t result = xjson_CreateObject (); + + xjson_AddStringToObject0 (result, "file_name", decrypt_result->file_name); + xjson_AddStringToObject0 (result, "symkey_algo", + decrypt_result->symkey_algo); + + xjson_AddBoolToObject (result, "wrong_key_usage", + decrypt_result->wrong_key_usage); + xjson_AddBoolToObject (result, "is_de_vs", + decrypt_result->is_de_vs); + xjson_AddBoolToObject (result, "is_mime", decrypt_result->is_mime); + xjson_AddBoolToObject (result, "legacy_cipher_nomdc", + decrypt_result->legacy_cipher_nomdc); + + if (decrypt_result->recipients) + { + cjson_t array = xjson_CreateArray (); + gpgme_recipient_t recp; + + for (recp = decrypt_result->recipients; recp; recp = recp->next) + cJSON_AddItemToArray (array, recipient_to_json (recp)); + xjson_AddItemToObject (result, "recipients", array); + } + + return result; +} + /* Create a JSON object from an engine_info */ static cjson_t @@ -1737,13 +1786,34 @@ static const char hlp_decrypt[] = "base64: Input data is base64 encoded.\n" "\n" "Response on success:\n" - "type: \"plaintext\"\n" - "data: The decrypted data. This may be base64 encoded.\n" - "base64: Boolean indicating whether data is base64 encoded.\n" - "mime: A Boolean indicating whether the data is a MIME object.\n" - "info: An object with verification information. (gpgme_verify_result_t)\n" - " file_name: Optional string of the plaintext file name.\n" - " is_mime: Boolean that is true if the messages claims it is MIME.\n" + "type: \"plaintext\"\n" + "data: The decrypted data. This may be base64 encoded.\n" + "base64: Boolean indicating whether data is base64 encoded.\n" + "mime: deprecated - use dec_info is_mime instead\n" + "dec_info: An object with decryption information. (gpgme_decrypt_result_t)\n" + " Boolean values:\n" + " wrong_key_usage: Key should not have been used for encryption.\n" + " is_de_vs: Message was encrypted in compliance to the de-vs\n" + " mode.\n" + " is_mime: Message claims that the content is a MIME Message.\n" + " legacy_cipher_nomdc: The message was made by a legacy algorithm\n" + " without integrity protection.\n" + " String values:\n" + " file_name: The filename contained in the decrypt result.\n" + " symkey_algo: A string with the symmetric encryption algorithm and\n" + " mode using the format \".\".\n" + " Array values:\n" + " recipients: The list of recipients (gpgme_recipient_t).\n" + " String values:\n" + " keyid: The keyid of the recipient.\n" + " pubkey_algo_name: gpgme_pubkey_algo_name of used algo.\n" + " status_string: The status code as localized gpg-error string\n" + " Number values:\n" + " status_code: The status as a number. (gpg_error_t)\n" + "info: Optional an object with verification information.\n" + " (gpgme_verify_result_t)\n" + " file_name: The filename contained in the verify result.\n" + " is_mime: The is_mime info contained in the verify result.\n" " signatures: Array of signatures\n" " summary: Object containing summary information.\n" " Boolean values: (Check gpgme_sigsum_t doc for meaning)\n" @@ -1831,6 +1901,9 @@ op_decrypt (cjson_t request, cjson_t result) if (decrypt_result->is_mime) xjson_AddBoolToObject (result, "mime", 1); + xjson_AddItemToObject (result, "dec_info", + decrypt_result_to_json (decrypt_result)); + verify_result = gpgme_op_verify_result (ctx); if (verify_result && verify_result->signatures) { ----------------------------------------------------------------------- Summary of changes: src/gpgme-json.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 80 insertions(+), 7 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 21 15:26:51 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Tue, 21 Aug 2018 15:26:51 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-113-g6d72013 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 6d720137dd9564931bf313a7e7078e63fb00287c (commit) from 9dd6c67cd5ae8bf394c4c257d6d16907018761c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6d720137dd9564931bf313a7e7078e63fb00287c Author: Maximilian Krambach Date: Tue Aug 21 15:26:17 2018 +0200 js: update decrypt/verify results -- * src/gpgmejs.js: Decrypt now parses additional optional dec_info information, as well as any verify information, if present * src/permittedOperations: Now decrypt also expect the new return object dec_inf (containing info such as is_mime and file_name) diff --git a/lang/js/BrowserTestExtension/tests/decryptTest.js b/lang/js/BrowserTestExtension/tests/decryptTest.js index a3f48da..ea88749 100644 --- a/lang/js/BrowserTestExtension/tests/decryptTest.js +++ b/lang/js/BrowserTestExtension/tests/decryptTest.js @@ -59,4 +59,20 @@ describe('Decryption', function () { }); }); }).timeout(5000); + + + it('decrypt/verify operations return proper information', function (done){ + const data = inputvalues.encryptSignedMessage; + context.decrypt(data).then(function (result){ + expect(result).to.be.an('object'); + expect(result.signatures).to.be.an('object'); + expect(result.signatures.all_valid).to.be.true; + expect(result.signatures.count).to.equal(1); + expect(result.signatures.signatures.good).to.be.an('array'); + expect( + result.signatures.signatures.good[0].fingerprint).to.equal( + good_fpr); + done(); + }); + }); }); \ No newline at end of file diff --git a/lang/js/BrowserTestExtension/tests/inputvalues.js b/lang/js/BrowserTestExtension/tests/inputvalues.js index f84ac95..5c2abf3 100644 --- a/lang/js/BrowserTestExtension/tests/inputvalues.js +++ b/lang/js/BrowserTestExtension/tests/inputvalues.js @@ -86,9 +86,27 @@ const inputvalues = {// eslint-disable-line no-unused-vars 'CfhY40nMXSYdfl8mDOhvnKcCvy8qxetFv9uCX06OqepAamu/bvxslrzocRyJ/eq0\n' + 'T2JfzEN+E7Y3PB8UwLgp/ZRmG8zRrQ==\n' + '=ioB6\n' + - '-----END PGP SIGNATURE-----\n', + '-----END PGP SIGNATURE-----\n' }, - + encryptSignedMessage: '-----BEGIN PGP MESSAGE-----\n'+ + '\n'+ + 'hQEMA6B8jfIUScGEAQf/bmQ+xNMGTjPvQCktkxR4Svt2dVNVdSzKsCmvSv24QOQF\n'+ + 'yBMK5w51S/6DTdiZI12IYD7hjvkr9NqxXXupjrVKwqEVpg4Pkwckac0OcElJIBsL\n'+ + '3htr4iYsr8dhSgSS4BO0azcu4wZQTXy5v2P7yYPECMEagNEXnW+tE7sHLCq8Ysqz\n'+ + 'LVxG0R0IUijKeEd3xQC2Tt20e1Z1j5tnqaPhE/9Smqf5OjSUDqpXxvRnSNRk/zEs\n'+ + 'cGVgCF+cv68nUJM9lwEAbBQChplwL6ebnhunC6DsRCxnjLHVyKm127hmhSiMGC0e\n'+ + 'Ns31mGeP1dxpDv6Gi2/oKmq67vG3i4fKeckj7bt30tLA1wH0Qn5Mn6Tzxzve0W0q\n'+ + 'Ghqn9PY9qNK8EkrkzqaFk9dzu5tfSbaJBLS/uIhX2Wj70EMEBbFSkN0qlgOfLgGw\n'+ + '5mwRvCgj4nvV1ByFhnx7uwgQixvOwLH4JLKvwCQpJm+O2R0eC7M6CzR/b9iL/oaO\n'+ + 'JTkoD9hcLhxF7j+3ZYg7rbNwofuHST097vFjzItsucb0jHOzjlkCqbhdczICILTa\n'+ + 'H76Q6YGdMLyG9a3s4yZUMruaeQyWGeXlryzLDvdEoSgoD5YrolsFOM+Z2apbzVs2\n'+ + 'k5CltwtanjjWGnpAqSyr49C6CSU8G1QHpNygx5frtAS8bojR2ovB9OJp2wUklDvC\n'+ + 'LtU7dLpTY/BIvfB1vzwcW/aNgmPadNHX8mAzlqTQJjeLoo69Wp804t+u36sgfd/J\n'+ + 'ser7vdJJUm+86Q9csefItvFmHhqjMg5XXHoa8WZWJOHIQMxZkaIwKAzcEt/oEOdJ\n'+ + 'rbVNVabhTdbmS5I1ok16wg5jMF07ZDM7nXWMcQNjwT646XKP+pp2N6YQROVidNXj\n'+ + 'COyRyiXE/csr\n'+ + '=Ik7G\n'+ + '-----END PGP MESSAGE-----\n', someInputParameter: 'bad string', publicKeyNonAscii: { diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 9a0925b..3be5cdd 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -192,18 +192,21 @@ export class GpgME { msg.post().then(function (result){ let _result = { data: result.data }; _result.base64 = result.base64 ? true: false; - _result.is_mime = result.is_mime ? true: false; - if (result.file_name){ - _result.file_name = result.file_name; - } else { + if (result.hasOwnProperty('dec_info')){ + _result.is_mime = result.dec_info.is_mime ? true: false; + if (result.dec_info.file_name) { + _result.file_name = result.dec_info.file_name; + } + } + if (!result.file_name) { _result.file_name = null; } - if ( - result.hasOwnProperty('signatures') && - Array.isArray(result.signatures) + if (result.hasOwnProperty('info') + && result.info.hasOwnProperty('signatures') + && Array.isArray(result.info.signatures) ) { _result.signatures = collectSignatures( - result.signatures); + result.info.signatures); } resolve(_result); }, function (error){ diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js index 3142725..6c05fc6 100644 --- a/lang/js/src/permittedOperations.js +++ b/lang/js/src/permittedOperations.js @@ -127,8 +127,8 @@ export const permittedOperations = { 'data': 'string', 'base64': 'boolean', 'mime': 'boolean', - 'signatures': 'object', - 'info': 'object' + 'info': 'object', + 'dec_info': 'object' } } }, ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/tests/decryptTest.js | 16 ++++++++++++++++ lang/js/BrowserTestExtension/tests/inputvalues.js | 22 ++++++++++++++++++++-- lang/js/src/gpgmejs.js | 19 +++++++++++-------- lang/js/src/permittedOperations.js | 4 ++-- 4 files changed, 49 insertions(+), 12 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 10:21:53 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 22 Aug 2018 10:21:53 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-140-gb5e68fc Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via b5e68fc000add09200045df885479864bc325445 (commit) via 2767b0a794ae2b77331fc4305f91b767f9b4862d (commit) via cebe6484acaa250858affa3d854ef2b25cecd59f (commit) via 75659ee29c72c78a4c44ba87ea168f06813f84cd (commit) from 29f3ba005571b7a145f18240598d9f87f2ba9bca (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b5e68fc000add09200045df885479864bc325445 Author: Andre Heinecke Date: Wed Aug 22 10:20:20 2018 +0200 Rewrite cached key resolution * src/cryptcontroller.cpp (resolve_through_protocol): New. (resolve_keys_cached): Use new helper function. -- The old code was too much spaghetti and several issues. E.g. it could select a CMS Signing key with OpenPGP Encryption keys. Or would not support fallback to S/MIME if OpenPGP encryption was possible but only an S/MIME signing key available. diff --git a/src/cryptcontroller.cpp b/src/cryptcontroller.cpp index f6f1542..afeb24d 100644 --- a/src/cryptcontroller.cpp +++ b/src/cryptcontroller.cpp @@ -312,86 +312,105 @@ CryptController::parse_output (GpgME::Data &resolverOutput) return lookup_fingerprints (sigFpr, recpFprs); } -int -CryptController::resolve_keys_cached() +static bool +resolve_through_protocol (const GpgME::Protocol &proto, bool sign, + bool encrypt, const std::string &sender, + const std::vector &recps, + std::vector &r_keys, + GpgME::Key &r_sig) { + bool sig_ok = true; + bool enc_ok = true; + const auto cache = KeyCache::instance(); - bool fallbackToSMIME = false; + if (encrypt) + { + r_keys = cache->getEncryptionKeys(recps, proto); + enc_ok = !r_keys.empty(); + } + if (sign && enc_ok) + { + r_sig = cache->getSigningKey (sender.c_str (), proto); + sig_ok = !r_sig.isNull(); + } + return sig_ok && enc_ok; +} + +int +CryptController::resolve_keys_cached() +{ + // Prepare variables + const auto cached_sender = m_mail->getSender (); + auto recps = m_recipient_addrs; if (m_encrypt) { - const auto cached_sender = m_mail->getSender (); - auto recps = m_recipient_addrs; recps.push_back (cached_sender); + } - m_recipients.clear(); - if (opt.enable_smime && opt.prefer_smime) - { - m_recipients = cache->getEncryptionKeys(recps, GpgME::CMS); - if (!m_recipients.empty()) - { - fallbackToSMIME = true; - m_proto = GpgME::CMS; - } - } - - if (m_recipients.empty()) - { - m_recipients = cache->getEncryptionKeys(recps, GpgME::OpenPGP); - m_proto = GpgME::OpenPGP; - } - - if (m_recipients.empty() && (opt.enable_smime && !opt.prefer_smime)) - { - m_recipients = cache->getEncryptionKeys(recps, GpgME::CMS); - fallbackToSMIME = true; - m_proto = GpgME::CMS; - } - - if (m_recipients.empty()) + bool resolved = false; + if (opt.enable_smime && opt.prefer_smime) + { + resolved = resolve_through_protocol (GpgME::CMS, m_sign, m_encrypt, + cached_sender, recps, m_recipients, + m_signer_key); + if (resolved) { - log_debug ("%s:%s: Failed to resolve keys through cache", + log_debug ("%s:%s: Resolved with CMS due to preference.", SRCNAME, __func__); - m_proto = GpgME::UnknownProtocol; - return 1; + m_proto = GpgME::CMS; } } - - if (m_sign) + if (!resolved) { - if (!fallbackToSMIME) + resolved = resolve_through_protocol (GpgME::OpenPGP, m_sign, m_encrypt, + cached_sender, recps, m_recipients, + m_signer_key); + if (resolved) { - m_signer_key = cache->getSigningKey (m_mail->getSender ().c_str (), - GpgME::OpenPGP); + log_debug ("%s:%s: Resolved with OpenPGP.", + SRCNAME, __func__); m_proto = GpgME::OpenPGP; } - if (m_signer_key.isNull() && opt.enable_smime) - { - m_signer_key = cache->getSigningKey (m_mail->getSender ().c_str (), - GpgME::CMS); - m_proto = GpgME::CMS; - } - if (m_signer_key.isNull()) + } + if (!resolved && (opt.enable_smime && !opt.prefer_smime)) + { + resolved = resolve_through_protocol (GpgME::CMS, m_sign, m_encrypt, + cached_sender, recps, m_recipients, + m_signer_key); + if (resolved) { - log_debug ("%s:%s: Failed to resolve signer key through cache", + log_debug ("%s:%s: Resolved with CMS as fallback.", SRCNAME, __func__); - m_recipients.clear(); - m_proto = GpgME::UnknownProtocol; - return 1; + m_proto = GpgME::CMS; } } - log_debug ("%s:%s: Encrypting to:", - SRCNAME, __func__); + if (!resolved) + { + log_debug ("%s:%s: Failed to resolve through cache", + SRCNAME, __func__); + m_recipients.clear(); + m_signer_key = GpgME::Key(); + m_proto = GpgME::UnknownProtocol; + return 1; + } + + if (!m_recipients.empty()) + { + log_debug ("%s:%s: Encrypting with protocol %s to:", + SRCNAME, __func__, to_cstr (m_proto)); + } for (const auto &key: m_recipients) { - log_debug ("%s", key.primaryFingerprint()); + log_debug ("%s", key.primaryFingerprint ()); } if (!m_signer_key.isNull()) { - log_debug ("%s:%s: Signing key: %s", - SRCNAME, __func__, m_signer_key.primaryFingerprint()); + log_debug ("%s:%s: Signing key: %s:%s", + SRCNAME, __func__, m_signer_key.primaryFingerprint (), + to_cstr (m_signer_key.protocol())); } return 0; } commit 2767b0a794ae2b77331fc4305f91b767f9b4862d Author: Andre Heinecke Date: Wed Aug 22 10:19:27 2018 +0200 Add helper to print out protocol * src/cpphelp.cpp, src/cpphelp.h (to_string): New. -- It's in cpphelp as I plan to have some more overloads of this. diff --git a/src/cpphelp.cpp b/src/cpphelp.cpp index a7a57ad..6ed5ad0 100644 --- a/src/cpphelp.cpp +++ b/src/cpphelp.cpp @@ -292,3 +292,11 @@ is_binary (const std::string &input) } return false; } + +const char * +to_cstr (const GpgME::Protocol &prot) +{ + return prot == GpgME::CMS ? "S/MIME" : + prot == GpgME::OpenPGP ? "OpenPGP" : + "Unknown Protocol"; +} diff --git a/src/cpphelp.h b/src/cpphelp.h index 654ab19..0b905b1 100644 --- a/src/cpphelp.h +++ b/src/cpphelp.h @@ -25,6 +25,8 @@ #include #include +#include + /* Stuff that should be in common but is c++ so it does not fit in there. */ @@ -53,4 +55,7 @@ std::string string_to_hex (const std::string& input); /* Check if a string contains a char < 32 */ bool is_binary (const std::string &input); + +/* Return a string repr of the GpgME Protocol */ +const char *to_cstr (const GpgME::Protocol &prot); #endif // CPPHELP_H commit cebe6484acaa250858affa3d854ef2b25cecd59f Author: Andre Heinecke Date: Fri Aug 10 11:38:01 2018 +0200 Fix crash on async send in OL 2013 * src/mail.cpp, src/mail.h (Mail:: diff --git a/src/mail.cpp b/src/mail.cpp index 4ee4314..0e8a9d2 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -73,6 +73,7 @@ static Mail *s_last_mail; Mail::Mail (LPDISPATCH mailitem) : m_mailitem(mailitem), + m_currentItemRef(nullptr), m_processed(false), m_needs_wipe(false), m_needs_save(false), @@ -201,6 +202,8 @@ Mail::~Mail() SRCNAME, __func__); m_parser = nullptr; m_crypter = nullptr; + + releaseCurrentItem(); gpgrt_lock_unlock (&dtor_lock); log_oom_extra ("%s:%s: returning", SRCNAME, __func__); @@ -3454,3 +3457,33 @@ Mail::installFolderEventHandler_o() /* Folder already registered */ gpgol_release (folder); } + +void +Mail::refCurrentItem() +{ + if (m_currentItemRef) + { + gpgol_release (m_currentItemRef); + } + /* This prevents a crash in Outlook 2013 when sending a mail as it + * would unload too early. + * + * As it didn't crash when the mail was opened in Outlook Spy this + * mimics that the mail is inspected somewhere else. */ + m_currentItemRef = get_oom_object (m_mailitem, "GetInspector.CurrentItem"); +} + +void +Mail::releaseCurrentItem() +{ + if (!m_currentItemRef) + { + return; + } + log_oom_extra ("%s:%s: releasing CurrentItem ref %p", + SRCNAME, __func__, m_currentItemRef); + LPDISPATCH m_tmp = m_currentItemRef; + m_currentItemRef = nullptr; + /* This can cause our destruction */ + gpgol_release (m_tmp); +} diff --git a/src/mail.h b/src/mail.h index cc4a78b..ee7fcac 100644 --- a/src/mail.h +++ b/src/mail.h @@ -591,12 +591,18 @@ public: bool isAboutToBeMoved () { return m_is_about_to_be_moved; } void setIsAboutToBeMoved (bool value) { m_is_about_to_be_moved = value; } + /* Releases the current item ref obtained in update oom data */ + void releaseCurrentItem (); + /* Gets an additional reference for GetInspector.CurrentItem */ + void refCurrentItem (); + private: void updateCategories_o (); void updateSigstate (); LPDISPATCH m_mailitem; LPDISPATCH m_event_sink; + LPDISPATCH m_currentItemRef; bool m_processed, /* The message has been porcessed by us. */ m_needs_wipe, /* We have added plaintext to the mesage. */ m_needs_save, /* A property was changed but not by us. */ diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index f93b239..26cbbdd 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -371,6 +371,16 @@ EVENT_SINK_INVOKE(MailItemEvents) log_debug ("%s:%s: Send event for crypto mail %p saving and starting.", SRCNAME, __func__, m_mail); + if (!m_mail->isAsyncCryptDisabled()) + { + /* Obtain a reference of the current item. This prevents + * an early unload which would crash Outlook 2013 + * + * As it didn't crash when the mail was opened in Outlook Spy this + * mimics that the mail is inspected somewhere else. */ + m_mail->refCurrentItem (); + } + // First contact with a mail to encrypt update // state and oom data. m_mail->updateOOMData_o (); diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index bf252a0..afb8197 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -162,6 +162,7 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) invoke_oom_method (mail->item (), "Send", NULL); log_debug ("%s:%s: Send for %p completed.", SRCNAME, __func__, mail); + mail->releaseCurrentItem(); break; } case (BRING_TO_FRONT): commit 75659ee29c72c78a4c44ba87ea168f06813f84cd Author: Andre Heinecke Date: Fri Aug 10 10:39:02 2018 +0200 Disable super verbose debug output * src/w32-gettext.h: Disable very verbose debug output. diff --git a/src/w32-gettext.h b/src/w32-gettext.h index 7232147..c450b31 100644 --- a/src/w32-gettext.h +++ b/src/w32-gettext.h @@ -73,7 +73,7 @@ char *native_to_utf8 (const char *string); #define utf8_to_wchar(VAR1) ({wchar_t *retval; \ retval = _utf8_to_wchar (VAR1); \ - if ((opt.enable_debug & DBG_OOM_EXTRA)) \ + if ((opt.enable_debug & DBG_OOM_EXTRA) && 0) \ { \ log_debug ("%s:%s:%i wchar_t alloc %p:%S", \ SRCNAME, __func__, __LINE__, retval, retval); \ @@ -82,7 +82,7 @@ retval;}) #define wchar_to_utf8(VAR1) ({char *retval; \ retval = _wchar_to_utf8 (VAR1); \ - if ((opt.enable_debug & DBG_OOM_EXTRA)) \ + if ((opt.enable_debug & DBG_OOM_EXTRA) && 0) \ { \ log_debug ("%s:%s:%i char utf8 alloc %p:%s", \ SRCNAME, __func__, __LINE__, retval, retval); \ ----------------------------------------------------------------------- Summary of changes: src/cpphelp.cpp | 8 +++ src/cpphelp.h | 5 ++ src/cryptcontroller.cpp | 127 ++++++++++++++++++++++++++++-------------------- src/mail.cpp | 33 +++++++++++++ src/mail.h | 6 +++ src/mailitem-events.cpp | 10 ++++ src/w32-gettext.h | 4 +- src/windowmessages.cpp | 1 + 8 files changed, 138 insertions(+), 56 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 10:45:48 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 22 Aug 2018 10:45:48 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-7-g0786ac7 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 0786ac78423c7c05b2d373f34fcf3316f94198a7 (commit) from 822c633845066756b6442ca67b93b4b5c4316ca0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0786ac78423c7c05b2d373f34fcf3316f94198a7 Author: NIIBE Yutaka Date: Wed Aug 22 17:45:29 2018 +0900 po: Update Japanese translation. -- Signed-off-by: NIIBE Yutaka diff --git a/po/ja.po b/po/ja.po index 736d7f8..045c46c 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8,9 +8,9 @@ # msgid "" msgstr "" -"Project-Id-Version: gnupg 2.2.6\n" +"Project-Id-Version: gnupg 2.2.9\n" "Report-Msgid-Bugs-To: translations at gnupg.org\n" -"PO-Revision-Date: 2018-04-12 10:51+0900\n" +"PO-Revision-Date: 2018-08-22 17:43+0900\n" "Last-Translator: NIIBE Yutaka \n" "Language-Team: none\n" "Language: ja\n" @@ -4401,15 +4401,17 @@ msgid "" "likely that this message is legitimate. This is because back\n" "then integrity protection was not widely used.\n" msgstr "" +"???: ???????????2003???????????????\n" +"???????????????????????????????\n" +"?????????????????\n" #, c-format msgid "Use the option '%s' to decrypt anyway.\n" -msgstr "" +msgstr "??????????????? '%s' ??????\n" -#, fuzzy, c-format -#| msgid "decryption failed: %s\n" +#, c-format msgid "decryption forced to fail!\n" -msgstr "?????????: %s\n" +msgstr "???????????????!\n" #, c-format msgid "decryption okay\n" @@ -5267,10 +5269,9 @@ msgstr "??: ? %s ???????\n" msgid "bad key signature from key %s: %s (0x%02x, 0x%x)\n" msgstr "?%s???????????: %s (0x%02x, 0x%x)\n" -#, fuzzy, c-format -#| msgid "bad key signature from key %s: %s (0x%02x, 0x%x)\n" +#, c-format msgid "bad data signature from key %s: %s (0x%02x, 0x%x)\n" -msgstr "?%s???????????: %s (0x%02x, 0x%x)\n" +msgstr "?%s?????????????: %s (0x%02x, 0x%x)\n" #, c-format msgid "assuming bad signature from key %s due to an unknown critical bit\n" ----------------------------------------------------------------------- Summary of changes: po/ja.po | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 10:54:40 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 22 Aug 2018 10:54:40 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-142-g649622c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 649622c95089767d8a27623e66396b2378f72a04 (commit) via 9158c1792354be5ef7860a53115488216f9a73e0 (commit) from b5e68fc000add09200045df885479864bc325445 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 649622c95089767d8a27623e66396b2378f72a04 Author: Andre Heinecke Date: Wed Aug 22 10:51:42 2018 +0200 Fix potential crash in T3656 workaround * src/windowmessages.cpp (CLOSE): Use the currentViewRef trick to avoid unload in close. -- The workaround codepath crashed reliably for me with the async sending. But with the current item ref trick it no longer crashes as the unload is later. My observation is that any Invoke that triggers an Unload can crash so we better avoid it. GnuPG-Bug-Id: T3656 diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index afb8197..e3dfd45 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -132,7 +132,11 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) SRCNAME, __func__); break; } + mail->refCurrentItem(); Mail::close (mail); + log_debug ("%s:%s: Close finished.", + SRCNAME, __func__); + mail->releaseCurrentItem(); break; } case (CRYPTO_DONE): commit 9158c1792354be5ef7860a53115488216f9a73e0 Author: Andre Heinecke Date: Wed Aug 22 10:26:58 2018 +0200 WKS: Handle aborted confirmation process better * src/wks-helper.cpp (handle_confirmation_notify): Go back a state if we have not seen a confirmation in this run. diff --git a/src/wks-helper.cpp b/src/wks-helper.cpp index 8ddbf35..388454a 100644 --- a/src/wks-helper.cpp +++ b/src/wks-helper.cpp @@ -691,16 +691,16 @@ WKSHelper::handle_confirmation_notify (const std::string &mbox) const GpgME::Data *mimeData = pair.first; Mail *mail = pair.second; - if (!mail) + if (!mail && !mimeData) { - log_debug ("%s:%s: Confirmation notify without cached mail.", + log_debug ("%s:%s: Confirmation notify without cached data.", SRCNAME, __func__); - } - if (!mimeData) - { - log_error ("%s:%s: Confirmation notify without cached data.", - SRCNAME, __func__); + /* This happens when we have seen a confirmation but have + * not confirmed it and the state was saved. So we go back + * to the confirmation sent state and wait until we see + * the confirmation the next time. */ + update_state (mbox, ConfirmationSent); return; } ----------------------------------------------------------------------- Summary of changes: src/windowmessages.cpp | 4 ++++ src/wks-helper.cpp | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 12:22:16 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Wed, 22 Aug 2018 12:22:16 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-114-g93f674d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via 93f674d33d4dacb115398196a7218c28323fd708 (commit) from 6d720137dd9564931bf313a7e7078e63fb00287c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 93f674d33d4dacb115398196a7218c28323fd708 Author: Maximilian Krambach Date: Wed Aug 22 12:18:55 2018 +0200 js: throw errors in sync functions -- * synchronous functions should throw errors if something goes wrong, Promises should reject. This commit changes some error cases that returned Error objects instead of throwing them - src/Key.js: createKey() and sync Key.get() throw errors - src/Error.js: Exporting the list of errors to be able to test and compare against these strings - src/Keyring.js: Setting a null value in pattern is not useful, and now caused an error with the new changes. - src/Message.js: createMessage and Message.setParameter now throw errors diff --git a/lang/js/src/Errors.js b/lang/js/src/Errors.js index 53e7bcd..7341802 100644 --- a/lang/js/src/Errors.js +++ b/lang/js/src/Errors.js @@ -24,7 +24,7 @@ /** * Listing of all possible error codes and messages of a {@link GPGME_Error}. */ -const err_list = { +export const err_list = { // Connection 'CONN_NO_CONNECT': { msg:'Connection with the nativeMessaging host could not be' diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index 2800ae9..d0f87ed 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -33,17 +33,17 @@ import { createMessage } from './Message'; * answers will be Promises, and the performance will likely suffer * @param {Object} data additional initial properties this Key will have. Needs * a full object as delivered by gpgme-json - * @returns {Object|GPGME_Error} The verified and updated data + * @returns {Object} The verified and updated data */ export function createKey (fingerprint, async = false, data){ if (!isFingerprint(fingerprint) || typeof (async) !== 'boolean'){ - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } if (data !== undefined){ data = validateKeyData(fingerprint, data); } if (data instanceof Error){ - return gpgme_error('KEY_INVALID'); + throw gpgme_error('KEY_INVALID'); } else { return new GPGME_Key(fingerprint, async, data); } @@ -78,7 +78,7 @@ class GPGME_Key { /** * Query any property of the Key listed in {@link validKeyProperties} * @param {String} property property to be retreived - * @returns {Boolean| String | Date | Array | Object |GPGME_Error} + * @returns {Boolean| String | Date | Array | Object} * the value of the property. If the Key is set to Async, the value * will be fetched from gnupg and resolved as a Promise. If Key is not * async, the armored property is not available (it can still be @@ -96,11 +96,11 @@ class GPGME_Key { } } else { if (property === 'armored') { - return gpgme_error('KEY_ASYNC_ONLY'); + throw gpgme_error('KEY_ASYNC_ONLY'); } // eslint-disable-next-line no-use-before-define if (!validKeyProperties.hasOwnProperty(property)){ - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } else { return (this._data[property]); } diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index ab0144e..cb053ba 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -67,7 +67,9 @@ export class GPGME_Keyring { if (prepare_sync === true) { secondrequest = function () { let msg2 = createMessage('keylist'); - msg2.setParameter('keys', pattern); + if (pattern){ + msg2.setParameter('keys', pattern); + } msg2.setParameter('secret', true); return msg2.post(); }; diff --git a/lang/js/src/Message.js b/lang/js/src/Message.js index 1ba2b65..b83caf6 100644 --- a/lang/js/src/Message.js +++ b/lang/js/src/Message.js @@ -29,16 +29,16 @@ import { Connection } from './Connection'; * Initializes a message for gnupg, validating the message's purpose with * {@link permittedOperations} first * @param {String} operation - * @returns {GPGME_Message|GPGME_Error} The Message object + * @returns {GPGME_Message} The Message object */ export function createMessage (operation){ if (typeof (operation) !== 'string'){ - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } if (permittedOperations.hasOwnProperty(operation)){ return new GPGME_Message(operation); } else { - return gpgme_error('MSG_WRONG_OP'); + throw gpgme_error('MSG_WRONG_OP'); } } @@ -117,11 +117,11 @@ export class GPGME_Message { */ setParameter ( param,value ){ if (!param || typeof (param) !== 'string'){ - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } let po = permittedOperations[this._msg.op]; if (!po){ - return gpgme_error('MSG_WRONG_OP'); + throw gpgme_error('MSG_WRONG_OP'); } let poparam = null; if (po.required.hasOwnProperty(param)){ @@ -129,7 +129,7 @@ export class GPGME_Message { } else if (po.optional.hasOwnProperty(param)){ poparam = po.optional[param]; } else { - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } // check incoming value for correctness let checktype = function (val){ @@ -139,24 +139,24 @@ export class GPGME_Message { && val.length > 0) { return true; } - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); case 'number': if ( poparam.allowed.indexOf('number') >= 0 && isNaN(value) === false){ return true; } - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); case 'boolean': if (poparam.allowed.indexOf('boolean') >= 0){ return true; } - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); case 'object': if (Array.isArray(val)){ if (poparam.array_allowed !== true){ - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } for (let i=0; i < val.length; i++){ let res = checktype(val[i]); @@ -171,13 +171,13 @@ export class GPGME_Message { if (poparam.allowed.indexOf('Uint8Array') >= 0){ return true; } - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } else { - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } break; default: - return gpgme_error('PARAM_WRONG'); + throw gpgme_error('PARAM_WRONG'); } }; let typechecked = checktype(value); diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 3be5cdd..2886c6f 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -152,8 +152,13 @@ export class GpgME { if (additional){ let additional_Keys = Object.keys(additional); for (let k = 0; k < additional_Keys.length; k++) { - msg.setParameter(additional_Keys[k], - additional[additional_Keys[k]]); + try { + msg.setParameter(additional_Keys[k], + additional[additional_Keys[k]]); + } + catch (error){ + return Promise.reject(error); + } } } if (msg.isComplete() === true){ @@ -185,9 +190,6 @@ export class GpgME { msg.setParameter('base64', true); } putData(msg, data); - if (base64 === true){ - msg.setParameter('base64', true); - } return new Promise(function (resolve, reject){ msg.post().then(function (result){ let _result = { data: result.data }; @@ -208,7 +210,11 @@ export class GpgME { _result.signatures = collectSignatures( result.info.signatures); } - resolve(_result); + if (_result.signatures instanceof Error){ + reject(_result.signatures); + } else { + resolve(_result); + } }, function (error){ reject(error); }); @@ -295,14 +301,17 @@ export class GpgME { if (!message.info || !message.info.signatures){ reject(gpgme_error('SIG_NO_SIGS')); } else { - let _result = collectSignatures( - message.info.signatures); - _result.is_mime = message.info.is_mime? true: false; - if (message.info.filename){ - _result.file_name = message.info.filename; + let _result = collectSignatures(message.info.signatures); + if (_result instanceof Error){ + reject(_result.signatures); + } else { + _result.is_mime = message.info.is_mime? true: false; + if (message.info.filename){ + _result.file_name = message.info.filename; + } + _result.data = message.data; + resolve(_result); } - _result.data = message.data; - resolve(_result); } }, function (error){ reject(error); @@ -363,8 +372,8 @@ function collectSignatures (sigs){ }; for (let i=0; i< sigs.length; i++){ let sigObj = createSignature(sigs[i]); - if (sigObj instanceof Error){ - return gpgme_error(sigObj); + if (sigObj instanceof Error) { + return gpgme_error('SIG_WRONG'); } if (sigObj.valid !== true){ summary.failures += 1; diff --git a/lang/js/unittests.js b/lang/js/unittests.js index 0abc106..212effd 100644 --- a/lang/js/unittests.js +++ b/lang/js/unittests.js @@ -25,7 +25,7 @@ import { message_params as mp } from './unittest_inputvalues'; import { whatever_params as wp } from './unittest_inputvalues'; import { key_params as kp } from './unittest_inputvalues'; import { Connection } from './src/Connection'; -import { gpgme_error } from './src/Errors'; +import { gpgme_error, err_list } from './src/Errors'; import { toKeyIdArray , isFingerprint } from './src/Helpers'; import { createKey } from './src/Key'; import { GPGME_Keyring } from './src/Keyring'; @@ -225,9 +225,12 @@ function unittests (){ it('createKey returns error if parameters are wrong', function (){ for (let i=0; i< 4; i++){ - let key0 = createKey(wp.four_invalid_params[i]); - expect(key0).to.be.an.instanceof(Error); - expect(key0.code).to.equal('PARAM_WRONG'); + expect(function (){ + createKey(wp.four_invalid_params[i]); + }).to.throw( + err_list.PARAM_WRONG.msg + ); + } }); @@ -312,9 +315,12 @@ function unittests (){ it('Message is not complete after mandatory data is empty', function (){ let test0 = createMessage('encrypt'); - test0.setParameter('data', ''); test0.setParameter('keys', hp.validFingerprints); expect(test0.isComplete()).to.be.false; + expect(function (){ + test0.setParameter('data', ''); + }).to.throw( + err_list.PARAM_WRONG.msg); }); it('Complete Message contains the data that was set', function (){ @@ -331,28 +337,27 @@ function unittests (){ }); it ('Not accepting non-allowed operation', function (){ - let test0 = createMessage(mp.invalid_op_action); - - expect(test0).to.be.an.instanceof(Error); - expect(test0.code).to.equal('MSG_WRONG_OP'); + expect(function () { + createMessage(mp.invalid_op_action); + }).to.throw( + err_list.MSG_WRONG_OP.msg); }); it('Not accepting wrong parameter type', function (){ - let test0 = createMessage(mp.invalid_op_type); - - expect(test0).to.be.an.instanceof(Error); - expect(test0.code).to.equal('PARAM_WRONG'); + expect(function () { + createMessage(mp.invalid_op_type); + }).to.throw( + err_list.PARAM_WRONG.msg); }); it('Not accepting wrong parameter name', function (){ let test0 = createMessage(mp.invalid_param_test.valid_op); for (let i=0; i < mp.invalid_param_test.invalid_param_names.length; i++){ - let ret = test0.setParameter( - mp.invalid_param_test.invalid_param_names[i], - 'Somevalue'); - - expect(ret).to.be.an.instanceof(Error); - expect(ret.code).to.equal('PARAM_WRONG'); + expect(function (){ + test0.setParameter( + mp.invalid_param_test.invalid_param_names[i], + 'Somevalue');} + ).to.throw(err_list.PARAM_WRONG.msg); } }); @@ -360,12 +365,11 @@ function unittests (){ let test0 = createMessage(mp.invalid_param_test.valid_op); for (let j=0; j < mp.invalid_param_test.invalid_values_0.length; j++){ - let ret = test0.setParameter( - mp.invalid_param_test.validparam_name_0, - mp.invalid_param_test.invalid_values_0[j]); - - expect(ret).to.be.an.instanceof(Error); - expect(ret.code).to.equal('PARAM_WRONG'); + expect(function (){ + test0.setParameter( + mp.invalid_param_test.validparam_name_0, + mp.invalid_param_test.invalid_values_0[j]); + }).to.throw(err_list.PARAM_WRONG.msg); } }); }); ----------------------------------------------------------------------- Summary of changes: lang/js/src/Errors.js | 2 +- lang/js/src/Key.js | 12 +++++------ lang/js/src/Keyring.js | 4 +++- lang/js/src/Message.js | 26 ++++++++++++------------ lang/js/src/gpgmejs.js | 39 ++++++++++++++++++++++-------------- lang/js/unittests.js | 54 +++++++++++++++++++++++++++----------------------- 6 files changed, 76 insertions(+), 61 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 12:44:11 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Wed, 22 Aug 2018 12:44:11 +0200 Subject: [git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-115-gd8fd4aa Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, javascript-binding has been updated via d8fd4aad8a93f7745c63814b3779469b610a8db0 (commit) from 93f674d33d4dacb115398196a7218c28323fd708 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d8fd4aad8a93f7745c63814b3779469b610a8db0 Author: Maximilian Krambach Date: Wed Aug 22 12:44:05 2018 +0200 js: changed verify signature result infos -- * the resulting information of verify now are as documented, and the same as in a decrypt callback diff --git a/lang/js/BrowserTestExtension/tests/verifyTest.js b/lang/js/BrowserTestExtension/tests/verifyTest.js index 82aaf56..5788ed5 100644 --- a/lang/js/BrowserTestExtension/tests/verifyTest.js +++ b/lang/js/BrowserTestExtension/tests/verifyTest.js @@ -38,12 +38,12 @@ describe('Verifying data', function () { const message = inputvalues.signedMessage.good; context.verify(message).then(function (result){ expect(result.data).to.be.a('string'); - expect(result.all_valid).to.be.true; - expect(result.count).to.equal(1); - expect(result.signatures.good).to.be.an('array'); - expect(result.signatures.good.length).to.equal(1); - expect(result.signatures.good[0].fingerprint).to.be.a('string'); - expect(result.signatures.good[0].valid).to.be.true; + expect(result.signatures.all_valid).to.be.true; + expect(result.signatures.count).to.equal(1); + expect(result.signatures.signatures.good).to.be.an('array'); + expect(result.signatures.signatures.good.length).to.equal(1); + expect(result.signatures.signatures.good[0].fingerprint).to.be.a('string'); + expect(result.signatures.signatures.good[0].valid).to.be.true; done(); }); }); @@ -52,12 +52,14 @@ describe('Verifying data', function () { const message = inputvalues.signedMessage.bad; context.verify(message).then(function (result){ expect(result.data).to.be.a('string'); - expect(result.all_valid).to.be.false; - expect(result.count).to.equal(1); - expect(result.signatures.bad).to.be.an('array'); - expect(result.signatures.bad.length).to.equal(1); - expect(result.signatures.bad[0].fingerprint).to.be.a('string'); - expect(result.signatures.bad[0].valid).to.be.false; + expect(result.signatures.all_valid).to.be.false; + expect(result.signatures.count).to.equal(1); + expect(result.signatures.signatures.bad).to.be.an('array'); + expect(result.signatures.signatures.bad.length).to.equal(1); + expect(result.signatures.signatures.bad[0].fingerprint) + .to.be.a('string'); + expect(result.signatures.signatures.bad[0].valid) + .to.be.false; done(); }); }); @@ -70,13 +72,16 @@ describe('Verifying data', function () { context.verify(message_encsign.data).then(function (result){ expect(result.data).to.equal(message_enc.data); expect(result.data).to.be.a('string'); - expect(result.all_valid).to.be.true; - expect(result.count).to.equal(1); - expect(result.signatures.good).to.be.an('array'); - expect(result.signatures.good.length).to.equal(1); - expect( - result.signatures.good[0].fingerprint).to.equal(fpr); - expect(result.signatures.good[0].valid).to.be.true; + expect(result.signatures.all_valid).to.be.true; + expect(result.signatures.count).to.equal(1); + expect(result.signatures.signatures.good) + .to.be.an('array'); + expect(result.signatures.signatures.good.length) + .to.equal(1); + expect(result.signatures.signatures.good[0].fingerprint) + .to.equal(fpr); + expect(result.signatures.signatures.good[0].valid) + .to.be.true; done(); }); }); diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 2886c6f..7692298 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -301,8 +301,10 @@ export class GpgME { if (!message.info || !message.info.signatures){ reject(gpgme_error('SIG_NO_SIGS')); } else { - let _result = collectSignatures(message.info.signatures); - if (_result instanceof Error){ + let _result = { + signatures: collectSignatures(message.info.signatures) + }; + if (_result.signatures instanceof Error){ reject(_result.signatures); } else { _result.is_mime = message.info.is_mime? true: false; ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/tests/verifyTest.js | 43 +++++++++++++----------- lang/js/src/gpgmejs.js | 6 ++-- 2 files changed, 28 insertions(+), 21 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 13:16:56 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 22 Aug 2018 13:16:56 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-227-g59ed27b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 59ed27bae14da6c1ba6848b34acfc836846a27bc (commit) via d8fd4aad8a93f7745c63814b3779469b610a8db0 (commit) via 93f674d33d4dacb115398196a7218c28323fd708 (commit) via 6d720137dd9564931bf313a7e7078e63fb00287c (commit) via 9dd6c67cd5ae8bf394c4c257d6d16907018761c2 (commit) via 0036b9bc493f0482cc7c4619867649481393163e (commit) via 738a8e6f950af08305c082d59a91d3d5d45800fa (commit) via 9608996d88549b60da490e5eeb41db023f97a038 (commit) via 605eb8a8bfcb12141d7cc5626e75af812cda6c75 (commit) via fe3de5b86b4a25f5b23cf1af2fd1809ef6c087a0 (commit) via 8b8c009dee8ae5493e7f888ee518468dbfcf5375 (commit) via d77a1c887d6a5e892329534c94f95eaf8bb88492 (commit) via 91c2362550f787cc28d764c0e571e911c740f74f (commit) via dd32daad0bb21e3d5567326d0b2e548ff8510431 (commit) via 1954d27be86b8e4eb801ca6ddcb670f8cfb149f5 (commit) via 74684f24c663af12c88b196fecd5f44863b893e4 (commit) via 3cbafb97ec4d94c1b9a2232a74f19f432ba67384 (commit) via fff365ffc583ef87ac585df2ac84fd8586202b8e (commit) via 5b0f8230b2172bffcb3a3b629a75c9cf1a50a3d8 (commit) via 8e87790db3499b1625fd65f3272192df47b5dfd0 (commit) via 3fb094a9b8c320fc10e537a9bb5fab34807f4e52 (commit) via ad39d54d192864b54a155bf5f94d5b6bb3e8612a (commit) via 754e799d35fd62d7a979452f44342934659908c7 (commit) via 90cb4a684211fe5630f209ba61510e8be3129eae (commit) via d65a392670888f86071ca629266ec14b7afb0e46 (commit) via ea43158d4043b01058afd7411c84aa38b61c2009 (commit) via 43cff5136459c5bca4dca66772eb815f5761c6cd (commit) via 715cdc0d7d5bc8d39ff3cc49774c59e5db01c1b6 (commit) via aeb065acc91a22b6548ebf0a558951ed26398214 (commit) via 622db0d1de665dfd93c991cd2d517078b04b3a13 (commit) via 68a012deb3b501d7417778be12c88bd475a37cb5 (commit) via 6313a2de9ee84a9321292f775e4d6c790486d3dc (commit) via 9d247b7fd5edd11fb5710a057baec671276f5034 (commit) via e16a87e83910ebb6bfdc4148369165f121f0997e (commit) via 522121ea7e105acc22795b1997ca500c7b227b4f (commit) via 94ee0988d4eaac27785de6efb7c19ca9976e1e9c (commit) via b18b96fb364711025d1e5fa9f135ee682dd0558a (commit) via 4b343c4e339862a5faf8dd20590a3c4592fb6abb (commit) via 040b1ed40ada7c9ce095dec696406aea730e3766 (commit) via a965e3e0b89521ad4f3898a8483161624c2e5848 (commit) via 50da3ff2fddf0d35541f798313e881fef3cff869 (commit) via ce0379d999039131c86dc0bb83e9b8edfee1c7d4 (commit) via 5213a599fea0da64560f935dffbf6b27a39d4850 (commit) via 30bb5490466119b66eeac255d71fb7bdc79149fa (commit) via 4015f5b4983c8a4590aa71776880d8bc42c7918d (commit) via 8964627f6ad7c407785a9fa5cb508c7c28be0d60 (commit) via 67b6fa5a2948deed6a914c638f923fb9ad2eac66 (commit) via 10f2106404f01e7bb369fc66a597875fb455cd27 (commit) via 1919fa41b6da4dfd4f69e776caa6e6b1883eb208 (commit) via 1105fc87a3bd3e1152aff578b7b84871558418e6 (commit) via a52ec87d406379f1a6acd8d4f34605a4bac8683b (commit) via 88e7f8ec2ef3d90ca014b0bdb246f4d99f82abc8 (commit) via d27703ea4f0eed950cddf0157dc78bcb5d8d1c65 (commit) via 780f7880c6598d4532354b348d7bd74026d162f4 (commit) via 3cd428ba442f43e470b977e27e18ff52567baba5 (commit) via 3c783bd09ce54b0d50dc3bea201e70e4fcbbf6a3 (commit) via aed402c5d572b60246f1f8e57ae269f8c91b0b7c (commit) via d0fc4ded58f4a6a86c5ee0a36a3d3c669e244d0d (commit) via e154554e9a48a08219649a58be0b641c561e1748 (commit) via e97e6c06e950cfad424e120f4f3752b594214c94 (commit) via c072675f3f2d734297a348c6de810148fb1424a2 (commit) via 7a072270ac031152ee034df0f5b6ef5e8bf7d394 (commit) via bfd3799d39df265882deedeee083fd5246a2f35d (commit) via 0356a667c5a8b4fdb4404cebb57475ed3f39ade9 (commit) via 332b4adbcc52ccf337cbc1943d5abef500769e10 (commit) via 53ce2b94bc35243710dec9b7972c7aaaa79dbc75 (commit) via d4adbf453d39659eee378b2be1d7125315d76083 (commit) via 7a73d88aba106d571f121dc3230864c81a76e5db (commit) via eff27d6387b1cad2ef9901fa03dbee2ea86c786a (commit) via a4ba80c553c2ac42f9e311344302c04ec9aa715b (commit) via e38b8beb20a8cfe897c378e3c20be80b8256159e (commit) via f7ed80ff6a66f2c5ee6f1c3daebd597f4592733d (commit) via ecad77263585cd5954758f797327d98232d880dc (commit) via 6b4caee039af6fd97912426aff143745bf7e191a (commit) via d1ca90ef75aa4ab61cb8f7563be6fc55012a3900 (commit) via 987b31746809dfe04966e37edd759a448a28d975 (commit) via c92326cc257cf7c8b6c0ddc43ec81573c409bc64 (commit) via 5f5bf024a83625b8f8bac4779b1c2236637c23e0 (commit) via cca40627b0afa2efc85ef7f5f1a1060a221ff2a2 (commit) via 8f3d83e5f0903323ec92f588f60dcecb0ae96de4 (commit) via cf075846fb48c8d71937100d2c45069d37d54a38 (commit) via c755287ba845c4cbbf1d50e5aafecb2e687c7ac9 (commit) via 6f67814eb45725bc7f3736a2638bad0a7470f17a (commit) via fda7b13f1b673962ce34b6f429158a7eb9cef47b (commit) via eb7129f3196ae4f0807ceba0c1fc9e818ea6cd22 (commit) via f45b926816340d3cca37f013a9eb1b1d9cdb0cfe (commit) via 1f7b19512cfa7e1b153b99d6a2b40bad82a5496e (commit) via 3685913bf510a14b8cb324d980217d90489e6453 (commit) via 1fb310cabe578625f96fce5d84ff6f0092c08d24 (commit) via 5befa1c9751fe54b5ae87906d7f09772ce9de6ea (commit) via c72adc00965fe4fcedd9d18609211021a091b28b (commit) via 30c47d80a27054aa340cbd6dc39d1b8a5dc5cf22 (commit) via e2aa8066a9b3ce694169ad9fcc26cae486a804af (commit) via 461dd0c8b41683a91073b362d100ee5217ec53f6 (commit) via 727340b295f25e04cb595022ba143cda48364697 (commit) via d62f66b1fb47f2075770d896f672748a4136e70b (commit) via 6ab25e40d904007755c5d999bf66ae264236e745 (commit) via 94f21d9f6bc1cf94e068e26eae53e593189dcec6 (commit) via eef3a509fa5744e5f09ec8084985e6070b78226b (commit) from 263dadb04aed4f973248b32c52af6ca59bcb7c1f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 59ed27bae14da6c1ba6848b34acfc836846a27bc Merge: 263dadb d8fd4aa Author: Andre Heinecke Date: Wed Aug 22 13:15:35 2018 +0200 Merge branch 'javascript-binding' This adds a new language binding "gpgme.js" to GPGME. It serves as a bridge between the native-messaging service "gpgme-json" and JavaScript Applications. The first user of this binding will be Mailvelope which will see GnuPG integration in the near future. GnuPG-Bug-Id: T4107 ----------------------------------------------------------------------- Summary of changes: configure.ac | 3 + doc/Makefile.am | 3 +- doc/examples/gpgme-chrome.json | 9 + doc/examples/gpgme-mozilla.json | 9 + lang/Makefile.am | 2 +- lang/README | 2 +- lang/js/.babelrc | 1 + lang/js/.eslintrc.json | 49 ++ lang/js/BrowserTestExtension/Makefile.am | 45 ++ lang/js/BrowserTestExtension/browsertest.html | 28 + lang/js/BrowserTestExtension/index.html | 113 ++++ lang/js/BrowserTestExtension/longTests.html | 22 + lang/js/BrowserTestExtension/manifest.json | 13 + lang/js/BrowserTestExtension/popup.html | 9 + .../js/BrowserTestExtension/popup.js | 31 +- .../js/BrowserTestExtension/runbrowsertest.js | 27 +- .../js/BrowserTestExtension/rununittests.js | 28 +- .../js/BrowserTestExtension/setup_testing.js | 29 +- lang/js/BrowserTestExtension/testicon.png | Bin 0 -> 2697 bytes lang/js/BrowserTestExtension/testkey.pub | 30 + lang/js/BrowserTestExtension/testkey.sec | 57 ++ lang/js/BrowserTestExtension/testkey2.pub | 30 + .../BrowserTestExtension/tests/KeyImportExport.js | 149 +++++ lang/js/BrowserTestExtension/tests/KeyInfos.js | 57 ++ lang/js/BrowserTestExtension/tests/decryptTest.js | 78 +++ .../tests/encryptDecryptTest.js | 170 +++++ lang/js/BrowserTestExtension/tests/encryptTest.js | 113 ++++ lang/js/BrowserTestExtension/tests/inputvalues.js | 338 ++++++++++ .../BrowserTestExtension/tests/longRunningTests.js | 56 ++ lang/js/BrowserTestExtension/tests/signTest.js | 63 ++ lang/js/BrowserTestExtension/tests/startup.js | 47 ++ lang/js/BrowserTestExtension/tests/verifyTest.js | 90 +++ lang/js/BrowserTestExtension/unittests.html | 17 + lang/{cpp => js/DemoExtension}/Makefile.am | 21 +- src/sys-util.h => lang/js/DemoExtension/entry.js | 31 +- lang/js/DemoExtension/maindemo.js | 119 ++++ lang/js/DemoExtension/mainui.html | 47 ++ lang/js/DemoExtension/manifest.json | 14 + lang/js/DemoExtension/popup.html | 9 + lang/js/DemoExtension/testicon.png | Bin 0 -> 2670 bytes lang/js/DemoExtension/ui.css | 33 + lang/{qt => js}/Makefile.am | 29 +- lang/js/README | 116 ++++ lang/js/build_extensions.sh | 17 + lang/js/jsdoc.conf | 24 + lang/js/package.json | 17 + lang/js/src/Connection.js | 283 +++++++++ lang/js/src/Errors.js | 169 +++++ lang/js/src/Helpers.js | 137 ++++ lang/js/src/Key.js | 688 +++++++++++++++++++++ lang/js/src/Keyring.js | 435 +++++++++++++ lang/{cpp => js/src}/Makefile.am | 24 +- lang/js/src/Message.js | 239 +++++++ lang/js/src/Signature.js | 200 ++++++ lang/js/src/gpgmejs.js | 391 ++++++++++++ lang/js/src/index.js | 52 ++ lang/js/src/permittedOperations.js | 403 ++++++++++++ lang/js/unittest_inputvalues.js | 123 ++++ lang/js/unittests.js | 379 ++++++++++++ lang/js/webpack.conf.js | 36 ++ lang/js/webpack.conf_unittests.js | 36 ++ 61 files changed, 5665 insertions(+), 125 deletions(-) create mode 100644 doc/examples/gpgme-chrome.json create mode 100644 doc/examples/gpgme-mozilla.json create mode 100644 lang/js/.babelrc create mode 100644 lang/js/.eslintrc.json create mode 100644 lang/js/BrowserTestExtension/Makefile.am create mode 100644 lang/js/BrowserTestExtension/browsertest.html create mode 100644 lang/js/BrowserTestExtension/index.html create mode 100644 lang/js/BrowserTestExtension/longTests.html create mode 100644 lang/js/BrowserTestExtension/manifest.json create mode 100644 lang/js/BrowserTestExtension/popup.html copy src/sys-util.h => lang/js/BrowserTestExtension/popup.js (52%) copy src/sys-util.h => lang/js/BrowserTestExtension/runbrowsertest.js (52%) copy src/sys-util.h => lang/js/BrowserTestExtension/rununittests.js (52%) copy src/sys-util.h => lang/js/BrowserTestExtension/setup_testing.js (52%) create mode 100644 lang/js/BrowserTestExtension/testicon.png create mode 100644 lang/js/BrowserTestExtension/testkey.pub create mode 100644 lang/js/BrowserTestExtension/testkey.sec create mode 100644 lang/js/BrowserTestExtension/testkey2.pub create mode 100644 lang/js/BrowserTestExtension/tests/KeyImportExport.js create mode 100644 lang/js/BrowserTestExtension/tests/KeyInfos.js create mode 100644 lang/js/BrowserTestExtension/tests/decryptTest.js create mode 100644 lang/js/BrowserTestExtension/tests/encryptDecryptTest.js create mode 100644 lang/js/BrowserTestExtension/tests/encryptTest.js create mode 100644 lang/js/BrowserTestExtension/tests/inputvalues.js create mode 100644 lang/js/BrowserTestExtension/tests/longRunningTests.js create mode 100644 lang/js/BrowserTestExtension/tests/signTest.js create mode 100644 lang/js/BrowserTestExtension/tests/startup.js create mode 100644 lang/js/BrowserTestExtension/tests/verifyTest.js create mode 100644 lang/js/BrowserTestExtension/unittests.html copy lang/{cpp => js/DemoExtension}/Makefile.am (58%) copy src/sys-util.h => lang/js/DemoExtension/entry.js (52%) create mode 100644 lang/js/DemoExtension/maindemo.js create mode 100644 lang/js/DemoExtension/mainui.html create mode 100644 lang/js/DemoExtension/manifest.json create mode 100644 lang/js/DemoExtension/popup.html create mode 100644 lang/js/DemoExtension/testicon.png create mode 100644 lang/js/DemoExtension/ui.css copy lang/{qt => js}/Makefile.am (50%) create mode 100644 lang/js/README create mode 100755 lang/js/build_extensions.sh create mode 100644 lang/js/jsdoc.conf create mode 100644 lang/js/package.json create mode 100644 lang/js/src/Connection.js create mode 100644 lang/js/src/Errors.js create mode 100644 lang/js/src/Helpers.js create mode 100644 lang/js/src/Key.js create mode 100644 lang/js/src/Keyring.js copy lang/{cpp => js/src}/Makefile.am (54%) create mode 100644 lang/js/src/Message.js create mode 100644 lang/js/src/Signature.js create mode 100644 lang/js/src/gpgmejs.js create mode 100644 lang/js/src/index.js create mode 100644 lang/js/src/permittedOperations.js create mode 100644 lang/js/unittest_inputvalues.js create mode 100644 lang/js/unittests.js create mode 100644 lang/js/webpack.conf.js create mode 100644 lang/js/webpack.conf_unittests.js hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 13:31:47 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 22 Aug 2018 13:31:47 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-145-gb09e891 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via b09e89143d13f1d170ba2298ca412b47f2f03382 (commit) via 7486c0bf18a59e531144901b97e4c7c352acf5c2 (commit) via 1692fc9846e5b961aef9142dda14c23964994c06 (commit) from 649622c95089767d8a27623e66396b2378f72a04 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b09e89143d13f1d170ba2298ca412b47f2f03382 Author: Andre Heinecke Date: Wed Aug 22 13:30:35 2018 +0200 Fix is_valid_chksum check * src/parsecontroller.cpp (is_valid_checksum): Don't check the OR'ed sigsum values for equality. -- This fixes handling of "Green Valid" S/MIME mails. diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp index 8dc0034..04a583e 100644 --- a/src/parsecontroller.cpp +++ b/src/parsecontroller.cpp @@ -240,20 +240,18 @@ ParseController::setSender(const std::string &sender) static bool is_valid_chksum(const GpgME::Signature &sig) { - switch (sig.summary()) - { - case GpgME::Signature::Valid: - case GpgME::Signature::Green: - case GpgME::Signature::KeyRevoked: - case GpgME::Signature::KeyExpired: - case GpgME::Signature::SigExpired: - case GpgME::Signature::CrlMissing: - case GpgME::Signature::CrlTooOld: - case GpgME::Signature::TofuConflict: - return true; - default: - return false; - } + const auto sum = sig.summary(); + static unsigned int valid_mask = (unsigned int) ( + GpgME::Signature::Valid | + GpgME::Signature::Green | + GpgME::Signature::KeyRevoked | + GpgME::Signature::KeyExpired | + GpgME::Signature::SigExpired | + GpgME::Signature::CrlMissing | + GpgME::Signature::CrlTooOld | + GpgME::Signature::TofuConflict ); + + return sum & valid_mask; } void commit 7486c0bf18a59e531144901b97e4c7c352acf5c2 Author: Andre Heinecke Date: Wed Aug 22 13:28:32 2018 +0200 Make autosecure compatible with always sign * src/mail.cpp (Mail::setDoAutosecure_m): Handle always sign and do not treat it as manual setting. -- It makes sense for users who always sign to still encrypt based on key availablity. diff --git a/src/mail.cpp b/src/mail.cpp index 5188c9e..26fa366 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -3387,7 +3387,10 @@ Mail::setDoAutosecure_m (bool value) setUUID_o (); int old_flags = get_gpgol_draft_info_flags (msg); - if (old_flags && m_first_autosecure_check) + if (old_flags && m_first_autosecure_check && + /* Someone with always sign and autosecure active + * will want to get autoencryption. */ + !(old_flags == 2 && opt.sign_default)) { /* They were set explicily before us. This can be * because they were a draft (which is bad) or @@ -3401,7 +3404,7 @@ Mail::setDoAutosecure_m (bool value) return; } m_first_autosecure_check = false; - set_gpgol_draft_info_flags (msg, value ? 3 : 0); + set_gpgol_draft_info_flags (msg, value ? 3 : opt.sign_default ? 2 : 0); gpgol_release (msg); gpgoladdin_invalidate_ui(); } commit 1692fc9846e5b961aef9142dda14c23964994c06 Author: Andre Heinecke Date: Wed Aug 22 10:59:57 2018 +0200 Fix minor name inconsitencs * src/mail.cpp (releaseCurrentItem): m_tmp was not a member. diff --git a/src/mail.cpp b/src/mail.cpp index 0e8a9d2..5188c9e 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -3482,8 +3482,8 @@ Mail::releaseCurrentItem() } log_oom_extra ("%s:%s: releasing CurrentItem ref %p", SRCNAME, __func__, m_currentItemRef); - LPDISPATCH m_tmp = m_currentItemRef; + LPDISPATCH tmp = m_currentItemRef; m_currentItemRef = nullptr; /* This can cause our destruction */ - gpgol_release (m_tmp); + gpgol_release (tmp); } ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 11 +++++++---- src/parsecontroller.cpp | 26 ++++++++++++-------------- 2 files changed, 19 insertions(+), 18 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 14:48:34 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Wed, 22 Aug 2018 14:48:34 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-228-g94a0ed3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 94a0ed361ea04c2a0a2e144877b0e17b9fea35a2 (commit) from 59ed27bae14da6c1ba6848b34acfc836846a27bc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 94a0ed361ea04c2a0a2e144877b0e17b9fea35a2 Author: Maximilian Krambach Date: Wed Aug 22 14:49:11 2018 +0200 js: Return error if signature has no fingerprint -- * src/Signature.js/get fingerprint: A signature with no fingerprint should not happen, but if it does, we should throw an error here, as the method is a getter. diff --git a/lang/js/src/Signature.js b/lang/js/src/Signature.js index a653904..530590f 100644 --- a/lang/js/src/Signature.js +++ b/lang/js/src/Signature.js @@ -87,9 +87,12 @@ class GPGME_Signature { constructor (sigObject){ this._rawSigObject = sigObject; } + /** + * @returns {String} the fingerprint of this signature + */ get fingerprint (){ if (!this._rawSigObject.fingerprint){ - return gpgme_error('SIG_WRONG'); + throw gpgme_error('SIG_WRONG'); } else { return this._rawSigObject.fingerprint; } ----------------------------------------------------------------------- Summary of changes: lang/js/src/Signature.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 16:37:54 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Wed, 22 Aug 2018 16:37:54 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-229-g129fa91 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 129fa919b935d97d995bc6b457c7f6984c06e825 (commit) from 94a0ed361ea04c2a0a2e144877b0e17b9fea35a2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 129fa919b935d97d995bc6b457c7f6984c06e825 Author: Maximilian Krambach Date: Wed Aug 22 16:32:31 2018 +0200 js: improve decryption performance -- * src/Connection.js, src/Helpers.js: performance of decoding incoming base64 data was improved to about 4 times the speed by introducing two more efficient functions (thanks to rrenkert at intevation.de for finding and testing them) * src/gpgmejs.js: Decrypted data will now return as Uint8Array, if the caller does not wish for a decoding. Decoding binary data will return invalid data, and a Uint8Array may be desired. This can be indicated by using the (new) 'binary' option in decrypt. * src/Errors.js A new error in case this decoding fails * src/Message.js, src/Connection.js: expected is change from base64 to binary, to avoid confusion later on. diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index 928ac68..8756cce 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -26,7 +26,7 @@ import { permittedOperations } from './permittedOperations'; import { gpgme_error } from './Errors'; import { GPGME_Message, createMessage } from './Message'; -import { decode } from './Helpers'; +import { decode, atobArray, Utf8ArrayToStr } from './Helpers'; /** * A Connection handles the nativeMessaging interaction via a port. As the @@ -223,8 +223,9 @@ class Answer{ } } /** - * Returns the base64 encoded answer data with the content verified - * against {@link permittedOperations}. + * Decodes and verifies the base64 encoded answer data. Verified against + * {@link permittedOperations}. + * @returns {Object} The readable gpnupg answer */ getMessage (){ if (this._response_b64 === null){ @@ -264,14 +265,15 @@ class Answer{ } if (_decodedResponse.base64 === true && poa.data[key] === 'string' - && this.expected !== 'base64' - ){ - _response[key] = decodeURIComponent( - atob(_decodedResponse[key]).split('').map( - function (c) { - return '%' + - ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }).join('')); + ) { + if (this.expected === 'binary'){ + _response[key] = atobArray(_decodedResponse[key]); + _response.binary = true; + } else { + _response[key] = Utf8ArrayToStr( + atobArray(_decodedResponse[key])); + _response.binary = false; + } } else { _response[key] = decode(_decodedResponse[key]); } diff --git a/lang/js/src/Errors.js b/lang/js/src/Errors.js index 7341802..145c3a5 100644 --- a/lang/js/src/Errors.js +++ b/lang/js/src/Errors.js @@ -103,6 +103,10 @@ export const err_list = { msg: 'Invalid parameter was found', type: 'error' }, + 'DECODE_FAIL': { + msg: 'Decoding failed due to unexpected data', + type: 'error' + }, 'PARAM_IGNORED': { msg: 'An parameter was set that has no effect in gpgmejs', type: 'warning' diff --git a/lang/js/src/Helpers.js b/lang/js/src/Helpers.js index ba4277a..9fa5775 100644 --- a/lang/js/src/Helpers.js +++ b/lang/js/src/Helpers.js @@ -134,4 +134,73 @@ export function decode (property){ return property; } return property; -} \ No newline at end of file +} + +/** + * Turns a base64 encoded string into an uint8 array + * @param {String} base64 encoded String + * @returns {Uint8Array} + * adapted from https://gist.github.com/borismus/1032746 + */ +export function atobArray (base64) { + if (typeof (base64) !== 'string'){ + throw gpgme_error('DECODE_FAIL'); + } + const raw = window.atob(base64); + const rawLength = raw.length; + let array = new Uint8Array(new ArrayBuffer(rawLength)); + for (let i = 0; i < rawLength; i++) { + array[i] = raw.charCodeAt(i); + } + return array; +} + +/** + * Turns a Uint8Array into an utf8-String + * @param {*} array Uint8Array + * @returns {String} + * Taken and slightly adapted from + * http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt + * (original header: + * utf.js - UTF-8 <=> UTF-16 convertion + * + * Copyright (C) 1999 Masanao Izumo + * Version: 1.0 + * LastModified: Dec 25 1999 + * This library is free. You can redistribute it and/or modify it. + * ) + */ +export function Utf8ArrayToStr (array) { + let out, i, len, c, char2, char3; + out = ''; + len = array.length; + i = 0; + if (array instanceof Uint8Array === false){ + throw gpgme_error('DECODE_FAIL'); + } + while (i < len) { + c = array[i++]; + switch (c >> 4) { + case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: + // 0xxxxxxx + out += String.fromCharCode(c); + break; + case 12: case 13: + // 110x xxxx 10xx xxxx + char2 = array[i++]; + out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); + break; + case 14: + // 1110 xxxx 10xx xxxx 10xx xxxx + char2 = array[i++]; + char3 = array[i++]; + out += String.fromCharCode(((c & 0x0F) << 12) | + ((char2 & 0x3F) << 6) | + ((char3 & 0x3F) << 0)); + break; + default: + break; + } + } + return out; +} diff --git a/lang/js/src/Message.js b/lang/js/src/Message.js index b83caf6..48813df 100644 --- a/lang/js/src/Message.js +++ b/lang/js/src/Message.js @@ -64,7 +64,7 @@ export class GPGME_Message { } set expected (value){ - if (value === 'base64'){ + if (value === 'binary'){ this._expected = value; } } diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 7692298..513e4a5 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -30,8 +30,8 @@ import { createSignature } from './Signature'; /** * @typedef {Object} decrypt_result - * @property {String} data The decrypted data - * @property {Boolean} base64 indicating whether data is base64 encoded. + * @property {String|Uint8Array} data The decrypted data + * @property {Boolean} binary indicating whether data is an Uint8Array. * @property {Boolean} is_mime (optional) the data claims to be a MIME * object. * @property {String} file_name (optional) the original file name @@ -51,7 +51,8 @@ import { createSignature } from './Signature'; /** * @typedef {Object} encrypt_result The result of an encrypt operation * @property {String} data The encrypted message - * @property {Boolean} base64 Indicating whether data is base64 encoded. + * @property {Boolean} binary Indicating whether returning payload data is an + * Uint8Array. */ /** @@ -174,10 +175,12 @@ export class GpgME { * Strings and Objects with a getText method * @param {Boolean} base64 (optional) false if the data is an armored * block, true if it is base64 encoded binary data + * @param {Boolean} binary (optional) if true, treat the decoded data as + * binary, and return the data as Uint8Array * @returns {Promise} Decrypted Message and information * @async */ - decrypt (data, base64=false){ + decrypt (data, base64=false, binary){ if (data === undefined){ return Promise.reject(gpgme_error('MSG_EMPTY')); } @@ -189,11 +192,14 @@ export class GpgME { if (base64 === true){ msg.setParameter('base64', true); } + if (binary === true){ + msg.expected = 'binary'; + } putData(msg, data); return new Promise(function (resolve, reject){ msg.post().then(function (result){ let _result = { data: result.data }; - _result.base64 = result.base64 ? true: false; + _result.binary = result.binary ? true: false; if (result.hasOwnProperty('dec_info')){ _result.is_mime = result.dec_info.is_mime ? true: false; if (result.dec_info.file_name) { @@ -251,7 +257,7 @@ export class GpgME { putData(msg, data); return new Promise(function (resolve,reject) { if (mode ==='detached'){ - msg.expected ='base64'; + msg.expected ='binary'; } msg.post().then( function (message) { if (mode === 'clearsign'){ ----------------------------------------------------------------------- Summary of changes: lang/js/src/Connection.js | 24 ++++++++-------- lang/js/src/Errors.js | 4 +++ lang/js/src/Helpers.js | 71 ++++++++++++++++++++++++++++++++++++++++++++++- lang/js/src/Message.js | 2 +- lang/js/src/gpgmejs.js | 18 ++++++++---- 5 files changed, 100 insertions(+), 19 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 18:39:24 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Wed, 22 Aug 2018 18:39:24 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-230-gf0409bb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd (commit) from 129fa919b935d97d995bc6b457c7f6984c06e825 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd Author: Maximilian Krambach Date: Wed Aug 22 18:37:46 2018 +0200 js: make method parameters objects -- * As requested by using parties, the options to be passed into the methods are now objects, with the objects' properties better describing what they do, and to avoid the need to type several nulls in a method call if one wants the last parameter. - src/Keyring.js, src/gpgme.js: Changed parameters and their validations - BrowserTest/*.js Had to adapt quite some calls to the new format diff --git a/lang/js/BrowserTestExtension/tests/KeyImportExport.js b/lang/js/BrowserTestExtension/tests/KeyImportExport.js index f52b790..f57877f 100644 --- a/lang/js/BrowserTestExtension/tests/KeyImportExport.js +++ b/lang/js/BrowserTestExtension/tests/KeyImportExport.js @@ -35,7 +35,7 @@ describe('Key importing', function () { const prm = Gpgmejs.init(); prm.then(function (gpgmejs){ context = gpgmejs; - context.Keyring.getKeys(fpr).then( + context.Keyring.getKeys({ pattern: fpr }).then( function (result){ if (result.length === 1) { result[0].delete().then(function (){ @@ -52,7 +52,7 @@ describe('Key importing', function () { afterEach(function (done){ // delete the test key if still present - context.Keyring.getKeys(fpr).then( + context.Keyring.getKeys({ pattern: fpr }).then( function (result){ if (result.length === 1) { result[0].delete().then(function (){ @@ -67,7 +67,7 @@ describe('Key importing', function () { }); it('Importing Key', function (done) { - context.Keyring.getKeys(fpr).then(function (result){ + context.Keyring.getKeys({ pattern: fpr }).then(function (result){ expect(result).to.be.an('array'); expect(result.length).to.equal(0); context.Keyring.importKey(pubKey).then(function (result){ @@ -127,23 +127,26 @@ describe('Key importing', function () { it('exporting armored Key with getKeysArmored', function (done) { context.Keyring.importKey(pubKey).then(function (){ - context.Keyring.getKeysArmored(fpr).then(function (result){ - expect(result).to.be.an('object'); - expect(result.armored).to.be.a('string'); - expect(result.secret_fprs).to.be.undefined; - done(); - }); + context.Keyring.getKeysArmored({ pattern: fpr }) + .then(function (result){ + expect(result).to.be.an('object'); + expect(result.armored).to.be.a('string'); + expect(result.secret_fprs).to.be.undefined; + done(); + }); }); }); it('Exporting Key (including secret fingerprints)', function (done) { const key_secret = inputvalues.encrypt.good.fingerprint; - context.Keyring.getKeysArmored(key_secret, true).then(function (result){ - expect(result).to.be.an('object'); - expect(result.armored).to.be.a('string'); - expect(result.secret_fprs).to.be.an('array'); - expect(result.secret_fprs[0]).to.equal(key_secret); - done(); - }); + context.Keyring.getKeysArmored({ + pattern: key_secret, with_secret_fpr: true }) + .then(function (result){ + expect(result).to.be.an('object'); + expect(result.armored).to.be.a('string'); + expect(result.secret_fprs).to.be.an('array'); + expect(result.secret_fprs[0]).to.equal(key_secret); + done(); + }); }); }); \ No newline at end of file diff --git a/lang/js/BrowserTestExtension/tests/KeyInfos.js b/lang/js/BrowserTestExtension/tests/KeyInfos.js index e1caabe..430c83a 100644 --- a/lang/js/BrowserTestExtension/tests/KeyInfos.js +++ b/lang/js/BrowserTestExtension/tests/KeyInfos.js @@ -36,7 +36,7 @@ describe('Key information', function () { it('A fingerprint is consistently returned upper case hex', function (done){ const mixedCase = inputvalues.encrypt.good.fingerprint_mixedcase; - context.Keyring.getKeys(mixedCase).then(function (result){ + context.Keyring.getKeys({ pattern: mixedCase }).then(function (result){ expect(result).to.be.an('array'); expect(result.length).to.equal(1); expect(result[0].fingerprint).to.equal(mixedCase.toUpperCase()); diff --git a/lang/js/BrowserTestExtension/tests/decryptTest.js b/lang/js/BrowserTestExtension/tests/decryptTest.js index ea88749..8852cb6 100644 --- a/lang/js/BrowserTestExtension/tests/decryptTest.js +++ b/lang/js/BrowserTestExtension/tests/decryptTest.js @@ -38,7 +38,7 @@ describe('Decryption', function () { it('Decryption of random string fails', function (done) { let data = bigString(20 * 1024); - context.decrypt(data).then( + context.decrypt({ data: data }).then( function (){}, function (error){ expect(error).to.be.an('error'); @@ -49,21 +49,22 @@ describe('Decryption', function () { it('Decryption of slightly corrupted message fails', function (done) { const data = bigString(10000); - context.encrypt(data, good_fpr).then(function (enc){ - context.decrypt(sabotageMsg(enc.data)).then( - function (){}, - function (error){ - expect(error).to.be.an('error'); - expect(error.code).to.equal('GNUPG_ERROR'); - done(); - }); - }); + context.encrypt({ data: data, publicKeys:good_fpr }).then( + function (enc){ + context.decrypt({ data: sabotageMsg(enc.data) }).then( + function (){}, + function (error){ + expect(error).to.be.an('error'); + expect(error.code).to.equal('GNUPG_ERROR'); + done(); + }); + }); }).timeout(5000); it('decrypt/verify operations return proper information', function (done){ const data = inputvalues.encryptSignedMessage; - context.decrypt(data).then(function (result){ + context.decrypt({ data: data }).then(function (result){ expect(result).to.be.an('object'); expect(result.signatures).to.be.an('object'); expect(result.signatures.all_valid).to.be.true; diff --git a/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js b/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js index 28c98d9..1efdf5c 100644 --- a/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js +++ b/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js @@ -38,25 +38,25 @@ describe('Encryption and Decryption', function (){ it('Successful encrypt and decrypt simple string', function (done) { let data = inputvalues.encrypt.good.data; - context.encrypt(data, good_fpr).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include('BEGIN PGP MESSAGE'); - expect(answer.data).to.include('END PGP MESSAGE'); - - context.decrypt(answer.data).then(function (result) { - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal( - inputvalues.encrypt.good.data); - done(); + context.encrypt({ data: data, publicKeys: good_fpr }).then( + function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include('BEGIN PGP MESSAGE'); + expect(answer.data).to.include('END PGP MESSAGE'); + context.decrypt({ data: answer.data }).then(function (result) { + expect(result).to.not.be.empty; + expect(result.data).to.be.a('string'); + expect(result.data).to.equal( + inputvalues.encrypt.good.data); + done(); + }); }); - }); }); it('Decrypt simple non-ascii', function (done) { let data = encryptedData; - context.decrypt(data).then(function (result) { + context.decrypt({ data: data }).then(function (result) { expect(result).to.not.be.empty; expect(result.data).to.be.a('string'); expect(result.data).to.equal( @@ -67,77 +67,81 @@ describe('Encryption and Decryption', function (){ it('Trailing whitespace and different line endings', function (done) { const data = 'Keks. \rKeks \n Keks \r\n'; - context.encrypt(data, good_fpr).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include('BEGIN PGP MESSAGE'); - expect(answer.data).to.include('END PGP MESSAGE'); + context.encrypt({ data: data, publicKeys: good_fpr }).then( + function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include('BEGIN PGP MESSAGE'); + expect(answer.data).to.include('END PGP MESSAGE'); - context.decrypt(answer.data).then(function (result) { - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal(data); - done(); + context.decrypt({ data: answer.data }).then(function (result) { + expect(result).to.not.be.empty; + expect(result.data).to.be.a('string'); + expect(result.data).to.equal(data); + done(); + }); }); - }); }).timeout(5000); it('Random data, as string', function (done) { let data = bigString(1000); - context.encrypt(data, good_fpr).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include( - 'BEGIN PGP MESSAGE'); - expect(answer.data).to.include( - 'END PGP MESSAGE'); - context.decrypt(answer.data).then(function (result) { - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal(data); - done(); + context.encrypt({ data:data, publicKeys: good_fpr }).then( + function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include( + 'BEGIN PGP MESSAGE'); + expect(answer.data).to.include( + 'END PGP MESSAGE'); + context.decrypt({ data: answer.data }).then(function (result) { + expect(result).to.not.be.empty; + expect(result.data).to.be.a('string'); + expect(result.data).to.equal(data); + done(); + }); }); - }); }).timeout(3000); it('Data, input as base64', function (done) { let data = inputvalues.encrypt.good.data; let b64data = btoa(data); - context.encrypt(b64data, good_fpr, true).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include( - 'BEGIN PGP MESSAGE'); - expect(answer.data).to.include( - 'END PGP MESSAGE'); - context.decrypt(answer.data).then( - function (result) { + context.encrypt({ data: b64data, publicKeys: good_fpr, base64: true }) + .then(function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include( + 'BEGIN PGP MESSAGE'); + expect(answer.data).to.include( + 'END PGP MESSAGE'); + context.decrypt({ data: answer.data }).then(function (result) { expect(result).to.not.be.empty; expect(result.data).to.be.a('string'); - expect(data).to.equal(data); + expect(result.data).to.equal(data); done(); }); - }); + }); }).timeout(3000); it('Random data, input as base64', function (done) { let data = bigBoringString(0.001); let b64data = btoa(data); - context.encrypt(b64data, good_fpr, true).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include( - 'BEGIN PGP MESSAGE'); - expect(answer.data).to.include( - 'END PGP MESSAGE'); - context.decrypt(answer.data).then( - function (result) { - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal(b64data); - done(); - }); - }); + context.encrypt( + { data: b64data, publicKeys: good_fpr, base64: true }) + .then(function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include( + 'BEGIN PGP MESSAGE'); + expect(answer.data).to.include( + 'END PGP MESSAGE'); + context.decrypt({ data:answer.data }).then( + function (result) { + expect(result).to.not.be.empty; + expect(result.data).to.be.a('string'); + expect(result.data).to.equal(data); + done(); + }); + }); }).timeout(3000); for (let j = 0; j < inputvalues.encrypt.good.data_nonascii_32.length; j++){ @@ -151,20 +155,22 @@ describe('Encryption and Decryption', function (){ for (let i=0; i < 34 * 1024; i++){ data += input; } - context.encrypt(data,good_fpr).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include( - 'BEGIN PGP MESSAGE'); - expect(answer.data).to.include( - 'END PGP MESSAGE'); - context.decrypt(answer.data).then(function (result) { - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal(data); - done(); + context.encrypt({ data: data, publicKeys: good_fpr }) + .then(function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include( + 'BEGIN PGP MESSAGE'); + expect(answer.data).to.include( + 'END PGP MESSAGE'); + context.decrypt({ data: answer.data }) + .then(function (result) { + expect(result).to.not.be.empty; + expect(result.data).to.be.a('string'); + expect(result.data).to.equal(data); + done(); + }); }); - }); }).timeout(5000); } }); diff --git a/lang/js/BrowserTestExtension/tests/encryptTest.js b/lang/js/BrowserTestExtension/tests/encryptTest.js index a242af5..ccdb499 100644 --- a/lang/js/BrowserTestExtension/tests/encryptTest.js +++ b/lang/js/BrowserTestExtension/tests/encryptTest.js @@ -37,32 +37,34 @@ describe('Encryption', function () { it('Successful encrypt', function (done) { const data = inputvalues.encrypt.good.data; - context.encrypt(data, good_fpr).then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include('BEGIN PGP MESSAGE'); - expect(answer.data).to.include('END PGP MESSAGE'); - done(); - }); - }); - - const sizes = [5,20,50]; - for (let i=0; i < sizes.length; i++) { - it('Successful encrypt a ' + sizes[i] + 'MB message', function (done) { - const data = fixedLengthString(sizes[i]); - context.encrypt(data, good_fpr).then(function (answer) { + context.encrypt({ data: data, publicKeys: good_fpr }) + .then(function (answer) { expect(answer).to.not.be.empty; expect(answer.data).to.be.a('string'); expect(answer.data).to.include('BEGIN PGP MESSAGE'); expect(answer.data).to.include('END PGP MESSAGE'); done(); }); + }); + + const sizes = [5,20,50]; + for (let i=0; i < sizes.length; i++) { + it('Successful encrypt a ' + sizes[i] + 'MB message', function (done) { + const data = fixedLengthString(sizes[i]); + context.encrypt({ data: data, publicKeys: good_fpr }) + .then(function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include('BEGIN PGP MESSAGE'); + expect(answer.data).to.include('END PGP MESSAGE'); + done(); + }); }).timeout(20000); } it('Sending encryption without keys fails', function (done) { const data = inputvalues.encrypt.good.data; - context.encrypt(data,null).then(function (answer) { + context.encrypt({ data: data }).then(function (answer) { expect(answer).to.be.undefined; }, function (error){ expect(error).to.be.an('Error'); @@ -72,41 +74,44 @@ describe('Encryption', function () { }); it('Sending encryption without data fails', function (done) { - context.encrypt(null, good_fpr).then(function (answer) { - expect(answer).to.be.undefined; - }, function (error) { - expect(error).to.be.an.instanceof(Error); - expect(error.code).to.equal('MSG_INCOMPLETE'); - done(); - }); + context.encrypt({ data: null, publicKeys: good_fpr }) + .then(function (answer) { + expect(answer).to.be.undefined; + }, function (error) { + expect(error).to.be.an.instanceof(Error); + expect(error.code).to.equal('MSG_INCOMPLETE'); + done(); + }); }); it('Sending encryption with non existing keys fails', function (done) { const data = inputvalues.encrypt.good.data; const bad_fpr = inputvalues.encrypt.bad.fingerprint; - context.encrypt(data, bad_fpr).then(function (answer) { - expect(answer).to.be.undefined; - }, function (error){ - expect(error).to.be.an('Error'); - expect(error.code).to.not.be.undefined; - expect(error.code).to.equal('GNUPG_ERROR'); - done(); - }); + context.encrypt({ data:data, publicKeys: bad_fpr }) + .then(function (answer) { + expect(answer).to.be.undefined; + }, function (error){ + expect(error).to.be.an('Error'); + expect(error.code).to.not.be.undefined; + expect(error.code).to.equal('GNUPG_ERROR'); + done(); + }); }).timeout(5000); it('Overly large message ( > 64MB) is rejected', function (done) { const data = fixedLengthString(65); - context.encrypt(data, good_fpr).then(function (answer) { - expect(answer).to.be.undefined; - }, function (error){ - expect(error).to.be.an.instanceof(Error); - // TODO: there is a 64 MB hard limit at least in chrome at: - // chromium//extensions/renderer/messaging_util.cc: - // kMaxMessageLength - // The error will be a browser error, not from gnupg or from - // this library - done(); - }); + context.encrypt({ data: data, publicKeys: good_fpr }) + .then(function (answer) { + expect(answer).to.be.undefined; + }, function (error){ + expect(error).to.be.an.instanceof(Error); + // TODO: there is a 64 MB hard limit at least in chrome at: + // chromium//extensions/renderer/messaging_util.cc: + // kMaxMessageLength + // The error will be a browser error, not from gnupg or from + // this library + done(); + }); }).timeout(8000); // TODO check different valid parameter diff --git a/lang/js/BrowserTestExtension/tests/longRunningTests.js b/lang/js/BrowserTestExtension/tests/longRunningTests.js index 240a6b9..1d710e3 100644 --- a/lang/js/BrowserTestExtension/tests/longRunningTests.js +++ b/lang/js/BrowserTestExtension/tests/longRunningTests.js @@ -38,18 +38,20 @@ describe('Long running Encryption/Decryption', function () { it('Successful encrypt/decrypt completely random data ' + (i+1) + '/100', function (done) { const data = bigString(2*1024*1024); - context.encrypt(data,good_fpr).then(function (answer){ - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include('BEGIN PGP MESSAGE'); - expect(answer.data).to.include('END PGP MESSAGE'); - context.decrypt(answer.data).then(function (result){ - expect(result).to.not.be.empty; - expect(result.data).to.be.a('string'); - expect(result.data).to.equal(data); - done(); + context.encrypt({ data: data, publicKeys: good_fpr }) + .then(function (answer){ + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include('BEGIN PGP MESSAGE'); + expect(answer.data).to.include('END PGP MESSAGE'); + context.decrypt({ data: answer.data }) + .then(function (result){ + expect(result).to.not.be.empty; + expect(result.data).to.be.a('string'); + expect(result.data).to.equal(data); + done(); + }); }); - }); }).timeout(15000); } diff --git a/lang/js/BrowserTestExtension/tests/signTest.js b/lang/js/BrowserTestExtension/tests/signTest.js index f5bd9c1..bd8db80 100644 --- a/lang/js/BrowserTestExtension/tests/signTest.js +++ b/lang/js/BrowserTestExtension/tests/signTest.js @@ -38,7 +38,7 @@ describe('Signing', function () { it('Sign a message', function (done) { const data = bigString(100); - context.sign(data, good_fpr).then(function (answer) { + context.sign({ data: data, keys: good_fpr }).then(function (answer) { expect(answer).to.not.be.empty; expect(answer.data).to.be.a('string'); expect(answer.data).to.include('BEGIN PGP SIGNATURE'); @@ -50,14 +50,15 @@ describe('Signing', function () { it('Detached sign a message', function (done) { const data = bigString(100); - context.sign(data,good_fpr, 'detached').then(function (answer) { - expect(answer).to.not.be.empty; - expect(answer.data).to.be.a('string'); - expect(answer.data).to.include(data); - expect(answer.signature).to.be.a('string'); - expect(answer.signature).to.be.a('string'); - done(); - }); + context.sign({ data: data, keys: good_fpr, mode: 'detached' }) + .then(function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include(data); + expect(answer.signature).to.be.a('string'); + expect(answer.signature).to.be.a('string'); + done(); + }); }); }); diff --git a/lang/js/BrowserTestExtension/tests/verifyTest.js b/lang/js/BrowserTestExtension/tests/verifyTest.js index 5788ed5..04c7a77 100644 --- a/lang/js/BrowserTestExtension/tests/verifyTest.js +++ b/lang/js/BrowserTestExtension/tests/verifyTest.js @@ -36,7 +36,7 @@ describe('Verifying data', function () { }); it('Successful verify message', function (done) { const message = inputvalues.signedMessage.good; - context.verify(message).then(function (result){ + context.verify({ data: message }).then(function (result){ expect(result.data).to.be.a('string'); expect(result.signatures.all_valid).to.be.true; expect(result.signatures.count).to.equal(1); @@ -50,7 +50,7 @@ describe('Verifying data', function () { it('Successfully recognize changed cleartext', function (done) { const message = inputvalues.signedMessage.bad; - context.verify(message).then(function (result){ + context.verify({ data: message }).then(function (result){ expect(result.data).to.be.a('string'); expect(result.signatures.all_valid).to.be.false; expect(result.signatures.count).to.equal(1); @@ -67,24 +67,24 @@ describe('Verifying data', function () { it('Encrypt-Sign-Verify random message', function (done) { const message = bigString(2000); let fpr = inputvalues.encrypt.good.fingerprint; - context.encrypt(message, fpr).then(function (message_enc){ - context.sign(message_enc.data, fpr).then(function (message_encsign){ - context.verify(message_encsign.data).then(function (result){ - expect(result.data).to.equal(message_enc.data); - expect(result.data).to.be.a('string'); - expect(result.signatures.all_valid).to.be.true; - expect(result.signatures.count).to.equal(1); - expect(result.signatures.signatures.good) - .to.be.an('array'); - expect(result.signatures.signatures.good.length) - .to.equal(1); - expect(result.signatures.signatures.good[0].fingerprint) - .to.equal(fpr); - expect(result.signatures.signatures.good[0].valid) - .to.be.true; - done(); - }); + context.encrypt({ data: message, publicKeys: fpr }) + .then(function (message_enc){ + context.sign({ data: message_enc.data, keys: fpr }) + .then(function (message_encsign){ + context.verify({ data: message_encsign.data }) + .then(function (result){ + expect(result.data).to.equal(message_enc.data); + expect(result.data).to.be.a('string'); + expect(result.signatures.all_valid).to.be.true; + expect(result.signatures.count).to.equal(1); + const arr = result.signatures.signatures.good; + expect(arr).to.be.an('array'); + expect(arr.length).to.equal(1); + expect(arr[0].fingerprint).to.equal(fpr); + expect(arr[0].valid).to.be.true; + done(); + }); + }); }); - }); }); }); \ No newline at end of file diff --git a/lang/js/DemoExtension/maindemo.js b/lang/js/DemoExtension/maindemo.js index 8d19085..97a27f6 100644 --- a/lang/js/DemoExtension/maindemo.js +++ b/lang/js/DemoExtension/maindemo.js @@ -29,7 +29,7 @@ document.addEventListener('DOMContentLoaded', function () { function (){ let data = document.getElementById('inputtext').value; let keyId = document.getElementById('pubkey').value; - gpgmejs.encrypt(data, keyId).then( + gpgmejs.encrypt({ data: data, privateKeys: keyId }).then( function (answer){ if (answer.data){ document.getElementById( @@ -43,7 +43,7 @@ document.addEventListener('DOMContentLoaded', function () { document.getElementById('buttondecrypt').addEventListener('click', function (){ let data = document.getElementById('inputtext').value; - gpgmejs.decrypt(data).then( + gpgmejs.decrypt({ data: data }).then( function (answer){ if (answer.data){ document.getElementById( @@ -68,7 +68,7 @@ document.addEventListener('DOMContentLoaded', function () { function (){ let data = document.getElementById('inputtext').value; let keyId = document.getElementById('pubkey').value; - gpgmejs.sign(data, keyId).then( + gpgmejs.sign({ data: data, keys: keyId }).then( function (answer){ if (answer.data){ document.getElementById( @@ -82,7 +82,7 @@ document.addEventListener('DOMContentLoaded', function () { document.getElementById('verifytext').addEventListener('click', function (){ let data = document.getElementById('inputtext').value; - gpgmejs.verify(data).then( + gpgmejs.verify({ data: data }).then( function (answer){ let vals = ''; if (answer.all_valid === true){ @@ -101,7 +101,11 @@ document.addEventListener('DOMContentLoaded', function () { document.getElementById('searchkey').addEventListener('click', function (){ let data = document.getElementById('inputtext').value; - gpgmejs.Keyring.getKeys(data, true, true).then(function (keys){ + gpgmejs.Keyring.getKeys({ + pattern: data, + prepare_sync: true, + search: true } + ).then(function (keys){ if (keys.length === 1){ document.getElementById( 'pubkey').value = keys[0].fingerprint; diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index cb053ba..d6ba1d6 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -35,27 +35,38 @@ export class GPGME_Keyring { /** * Queries Keys (all Keys or a subset) from gnupg. * - * @param {String | Array} pattern (optional) A pattern to + * @param {Object} options + * @param {String | Array} options.pattern (optional) A pattern to * search for in userIds or KeyIds. - * @param {Boolean} prepare_sync (optional) if set to true, most data - * (with the exception of armored Key blocks) will be cached for the + * @param {Boolean} options.prepare_sync (optional) if set to true, most + * data (with the exception of armored Key blocks) will be cached for the * Keys. This enables direct, synchronous use of these properties for * all keys. It does not check for changes on the backend. The cached * information can be updated with the {@link Key.refresh} method. - * @param {Boolean} search (optional) retrieve Keys from external + * @param {Boolean} options.search (optional) retrieve Keys from external * servers with the method(s) defined in gnupg (e.g. WKD/HKP lookup) * @returns {Promise>} * @static * @async */ - getKeys (pattern, prepare_sync=false, search=false){ + getKeys (options){ + if (options && typeof options !== 'object'){ + return Promise.reject(gpgme_error('PARAM_WRONG')); + } return new Promise(function (resolve, reject) { let msg = createMessage('keylist'); - if (pattern !== undefined && pattern !== null){ - msg.setParameter('keys', pattern); + if (options && options.pattern) { + if ( + typeof options.pattern === 'string' + || Array.isArray(options.pattern) + ){ + msg.setParameter('keys', options.pattern); + } else { + reject(gpgme_error('PARAM_WRONG')); + } } msg.setParameter('sigs', true); - if (search === true){ + if (options && options.search === true){ msg.setParameter('locate', true); } msg.post().then(function (result){ @@ -64,11 +75,11 @@ export class GPGME_Keyring { resolve([]); } else { let secondrequest; - if (prepare_sync === true) { + if (options && options.prepare_sync === true) { secondrequest = function () { let msg2 = createMessage('keylist'); - if (pattern){ - msg2.setParameter('keys', pattern); + if (options.pattern){ + msg2.setParameter('keys', options.pattern); } msg2.setParameter('secret', true); return msg2.post(); @@ -80,7 +91,7 @@ export class GPGME_Keyring { } secondrequest().then(function (answer) { for (let i=0; i < result.keys.length; i++){ - if (prepare_sync === true){ + if (options.prepare_sync === true){ if (answer && answer.keys) { for (let j=0; j < answer.keys.length; j++ ){ @@ -100,7 +111,7 @@ export class GPGME_Keyring { } } let k = createKey(result.keys[i].fingerprint, - !prepare_sync, result.keys[i]); + !options.prepare_sync, result.keys[i]); resultset.push(k); } resolve(resultset); @@ -126,31 +137,42 @@ export class GPGME_Keyring { /** * Fetches the armored public Key blocks for all Keys matching the * pattern (if no pattern is given, fetches all keys known to gnupg). - * @param {String|Array} pattern (optional) The Pattern to + * @param {Object} options (optional) + * @param {String|Array} options.pattern The Pattern to * search for - * @param {Boolean} with_secret_fpr (optional) also return a list of + * @param {Boolean} options.with_secret_fpr also return a list of * fingerprints for the keys that have a secret key available * @returns {Promise} Object containing the * armored Key(s) and additional information. * @static * @async */ - getKeysArmored (pattern, with_secret_fpr) { + getKeysArmored (options) { + if (options && typeof options !== 'object'){ + return Promise.reject(gpgme_error('PARAM_WRONG')); + } return new Promise(function (resolve, reject) { let msg = createMessage('export'); msg.setParameter('armor', true); - if (with_secret_fpr === true) { + if (options.with_secret_fpr === true) { msg.setParameter('with-sec-fprs', true); } - if (pattern !== undefined && pattern !== null){ - msg.setParameter('keys', pattern); + if (options.pattern){ + if ( + typeof options.pattern === 'string' + || Array.isArray(options.pattern) + ){ + msg.setParameter('keys', options.pattern); + } } msg.post().then(function (answer){ const result = { armored: answer.data }; - if (with_secret_fpr === true - && answer.hasOwnProperty('sec-fprs') - ) { - result.secret_fprs = answer['sec-fprs']; + if (options.with_secret_fpr === true){ + if (answer.hasOwnProperty('sec-fprs')){ + result.secret_fprs = answer['sec-fprs']; + } else { + result.secret_fprs = []; + } } resolve(result); }, function (error){ @@ -300,7 +322,6 @@ export class GPGME_Keyring { changes.signature = (result.status & 4) === 4; changes.subkey = (result.status & 8) === 8; // 16 new secret key: not implemented - fprs.push(result.fingerprint); infos[result.fingerprint] = { changes: changes, @@ -309,19 +330,20 @@ export class GPGME_Keyring { } let resultset = []; if (prepare_sync === true){ - me.getKeys(fprs, true).then(function (result){ - for (let i=0; i < result.length; i++) { - resultset.push({ - key: result[i], - changes: - infos[result[i].fingerprint].changes, - status: infos[result[i].fingerprint].status - }); - } - resolve({ Keys:resultset,summary: summary }); - }, function (error){ - reject(error); - }); + me.getKeys({ pattern: fprs, prepare_sync: true }) + .then(function (result){ + for (let i=0; i < result.length; i++) { + resultset.push({ + key: result[i], + changes: + infos[result[i].fingerprint].changes, + status: infos[result[i].fingerprint].status + }); + } + resolve({ Keys:resultset,summary: summary }); + }, function (error){ + reject(error); + }); } else { for (let i=0; i < fprs.length; i++) { resultset.push({ @@ -364,42 +386,49 @@ export class GPGME_Keyring { * Generates a new Key pair directly in gpg, and returns a GPGME_Key * representing that Key. Please note that due to security concerns, * secret Keys can not be deleted or exported from inside gpgme.js. - * - * @param {String} userId The user Id, e.g. 'Foo Bar ' - * @param {String} algo (optional) algorithm (and optionally key size) - * to be used. See {@link supportedKeyAlgos} below for supported + * @param {Object} options + * @param {String} option.userId The user Id, e.g. 'Foo Bar ' + * @param {String} option.algo (optional) algorithm (and optionally key + * size) to be used. See {@link supportedKeyAlgos} below for supported * values. If ommitted, 'default' is used. - * @param {Number} expires (optional) Expiration time in seconds from now. - * If not set or set to 0, expiration will be 'never' - * @param {String} subkey_algo (optional) algorithm of the encryption - * subkey. If ommited the same as algo is used. + * @param {Number} option.expires (optional) Expiration time in seconds + * from now. If not set or set to 0, expiration will be 'never' + * @param {String} options.subkey_algo (optional) algorithm of the + * encryption subkey. If ommited the same as algo is used. * * @return {Promise} * @async */ - generateKey (userId, algo = 'default', expires, subkey_algo){ - if ( - typeof (userId) !== 'string' || + generateKey (options){ + if (!options + || typeof options !== 'object' + || typeof options.userId !== 'string' // eslint-disable-next-line no-use-before-define - supportedKeyAlgos.indexOf(algo) < 0 || - (expires && !( Number.isInteger(expires) || expires < 0 )) + || ( options.algo && supportedKeyAlgos.indexOf(options.algo) < 0 ) + || ( options.expires && !( + Number.isInteger(options.expires) || options.expires < 0 ) ) ){ return Promise.reject(gpgme_error('PARAM_WRONG')); } // eslint-disable-next-line no-use-before-define - if (subkey_algo && supportedKeyAlgos.indexOf(subkey_algo) < 0 ){ + if (options.subkey_algo && supportedKeyAlgos.indexOf( + options.subkey_algo) < 0 + ){ return Promise.reject(gpgme_error('PARAM_WRONG')); } let me = this; return new Promise(function (resolve, reject){ let msg = createMessage('createkey'); - msg.setParameter('userid', userId); - msg.setParameter('algo', algo ); - if (subkey_algo) { - msg.setParameter('subkey-algo', subkey_algo ); + msg.setParameter('userid', options.userId); + if (!options.algo){ + options.algo === 'default'; + } + msg.setParameter('algo', options.algo); + if (options.subkey_algo) { + msg.setParameter('subkey-algo', options.subkey_algo ); } - if (expires){ - msg.setParameter('expires', expires); + if (options.expires){ + msg.setParameter('expires', options.expires); } else { msg.setParameter('expires', 0); } diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 513e4a5..e039842 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -110,52 +110,63 @@ export class GpgME { /** * Encrypt (and optionally sign) data - * @param {String|Object} data text/data to be encrypted as String. Also - * accepts Objects with a getText method - * @param {inputKeys} publicKeys + * @param {Object} options + * @param {String|Object} options.data text/data to be encrypted as String. + * Also accepts Objects with a getText method + * @param {inputKeys} options.publicKeys * Keys used to encrypt the message - * @param {inputKeys} secretKeys (optional) Keys used to sign the + * @param {inputKeys} opions.secretKeys (optional) Keys used to sign the * message. If Keys are present, the operation requested is assumed * to be 'encrypt and sign' - * @param {Boolean} base64 (optional) The data will be interpreted as - * base64 encoded data. - * @param {Boolean} armor (optional) Request the output as armored + * @param {Boolean} options.base64 (optional) The data will be interpreted + * as base64 encoded data. + * @param {Boolean} options.armor (optional) Request the output as armored * block. - * @param {Boolean} wildcard (optional) If true, recipient information - * will not be added to the message. + * @param {Boolean} options.wildcard (optional) If true, recipient + * information will not be added to the message. * @param {Object} additional use additional valid gpg options as * defined in {@link permittedOperations} * @returns {Promise} Object containing the encrypted * message and additional info. * @async */ - encrypt (data, publicKeys, secretKeys, base64=false, armor=true, - wildcard=false, additional = {}){ + encrypt (options){ + if (!options || (typeof options !== 'object')){ + return Promise.reject(gpgme_error('PARAM_WRONG')); + } + if (!options.hasOwnProperty('data') + || !options.hasOwnProperty('publicKeys') + ){ + return Promise.reject(gpgme_error('MSG_INCOMPLETE')); + } let msg = createMessage('encrypt'); if (msg instanceof Error){ return Promise.reject(msg); } - msg.setParameter('armor', armor); - msg.setParameter('always-trust', true); - if (base64 === true) { + if (!options.hasOwnProperty('armor')){ + options.armor = true; + } + msg.setParameter('armor', options.armor); + + if (options.base64 === true) { msg.setParameter('base64', true); } - let pubkeys = toKeyIdArray(publicKeys); + let pubkeys = toKeyIdArray(options.publicKeys); msg.setParameter('keys', pubkeys); - let sigkeys = toKeyIdArray(secretKeys); + let sigkeys = toKeyIdArray(options.secretKeys); if (sigkeys.length > 0) { msg.setParameter('signing_keys', sigkeys); } - putData(msg, data); - if (wildcard === true){ + putData(msg, options.data); + if (options.wildcard === true){ msg.setParameter('throw-keyids', true); } - if (additional){ - let additional_Keys = Object.keys(additional); + if (options.additional){ + let additional_Keys = Object.keys(options.additional); for (let k = 0; k < additional_Keys.length; k++) { try { msg.setParameter(additional_Keys[k], - additional[additional_Keys[k]]); + options.additional[additional_Keys[k]]); } catch (error){ return Promise.reject(error); @@ -171,17 +182,21 @@ export class GpgME { /** * Decrypts a Message - * @param {String|Object} data text/data to be decrypted. Accepts + * @param {Object} options + * @param {String|Object} options.data text/data to be decrypted. Accepts * Strings and Objects with a getText method - * @param {Boolean} base64 (optional) false if the data is an armored - * block, true if it is base64 encoded binary data - * @param {Boolean} binary (optional) if true, treat the decoded data as - * binary, and return the data as Uint8Array + * @param {Boolean} options.base64 (optional) false if the data is an + * armored block, true if it is base64 encoded binary data + * @param {Boolean} options.binary (optional) if true, treat the decoded + * data as binary, and return the data as Uint8Array * @returns {Promise} Decrypted Message and information * @async */ - decrypt (data, base64=false, binary){ - if (data === undefined){ + decrypt (options){ + if (!options || (typeof options !== 'object')){ + return Promise.reject('PARAM_WRONG'); + } + if (!options.data){ return Promise.reject(gpgme_error('MSG_EMPTY')); } let msg = createMessage('decrypt'); @@ -189,13 +204,13 @@ export class GpgME { if (msg instanceof Error){ return Promise.reject(msg); } - if (base64 === true){ + if (options.base64 === true){ msg.setParameter('base64', true); } - if (binary === true){ + if (options.binary === true){ msg.expected = 'binary'; } - putData(msg, data); + putData(msg, options.data); return new Promise(function (resolve, reject){ msg.post().then(function (result){ let _result = { data: result.data }; @@ -229,44 +244,49 @@ export class GpgME { /** * Sign a Message - * @param {String|Object} data text/data to be signed. Accepts Strings - * and Objects with a getText method. - * @param {inputKeys} keys The key/keys to use for signing - * @param {String} mode The signing mode. Currently supported: + * @param {Object} options Signing options + * @param {String|Object} options.data text/data to be signed. Accepts + * Strings and Objects with a getText method. + * @param {inputKeys} options.keys The key/keys to use for signing + * @param {String} options.mode The signing mode. Currently supported: * 'clearsign':The Message is embedded into the signature; * 'detached': The signature is stored separately - * @param {Boolean} base64 input is considered base64 + * @param {Boolean} options.base64 input is considered base64 * @returns {Promise} * @async */ - sign (data, keys, mode='clearsign', base64=false) { - if (data === undefined){ + sign (options){ + if ( + !options || (typeof options !== 'object')){ + return Promise.reject(gpgme_error('PARAM_WRONG')); + } + if (!options.data){ return Promise.reject(gpgme_error('MSG_EMPTY')); } - let key_arr = toKeyIdArray(keys); + if (!options.mode) { + options.mode = 'clearsign'; + } + let key_arr = toKeyIdArray(options.keys); if (key_arr.length === 0){ return Promise.reject(gpgme_error('MSG_NO_KEYS')); } let msg = createMessage('sign'); msg.setParameter('keys', key_arr); - if (base64 === true){ + if (options.base64 === true){ msg.setParameter('base64', true); } - msg.setParameter('mode', mode); - putData(msg, data); + msg.setParameter('mode', options.mode); + putData(msg, options.data); return new Promise(function (resolve,reject) { - if (mode ==='detached'){ - msg.expected ='binary'; - } msg.post().then( function (message) { - if (mode === 'clearsign'){ + if (options.mode === 'clearsign'){ resolve({ data: message.data } ); - } else if (mode === 'detached') { + } else if (options.mode === 'detached') { resolve({ - data: data, + data: options.data, signature: message.data }); } @@ -278,28 +298,33 @@ export class GpgME { /** * Verifies data. - * @param {String|Object} data text/data to be verified. Accepts Strings - * and Objects with a getText method - * @param {String} (optional) A detached signature. If not present, + * @param {Object} options + * @param {String|Object} options.data text/data to be verified. Accepts + * Strings and Objects with a getText method + * @param {String} options.signature A detached signature. If not present, * opaque mode is assumed - * @param {Boolean} (optional) Data and signature are base64 encoded + * @param {Boolean} options.base64 Indicating that data and signature are + * base64 encoded * @returns {Promise} *@async */ - verify (data, signature, base64 = false){ + verify (options){ + if (!options || (typeof options !== 'object') || !options.data){ + return Promise.reject(gpgme_error('PARAM_WRONG')); + } let msg = createMessage('verify'); - let dt = putData(msg, data); + let dt = putData(msg, options.data); if (dt instanceof Error){ return Promise.reject(dt); } - if (signature){ - if (typeof (signature)!== 'string'){ + if (options.signature){ + if (typeof signature !== 'string'){ return Promise.reject(gpgme_error('PARAM_WRONG')); } else { msg.setParameter('signature', signature); } } - if (base64 === true){ + if (options.base64 === true){ msg.setParameter('base64', true); } return new Promise(function (resolve, reject){ @@ -342,14 +367,14 @@ function putData (message, data){ } if (!data){ return gpgme_error('PARAM_WRONG'); - } else if (typeof (data) === 'string') { + } else if (typeof data === 'string') { message.setParameter('data', data); } else if ( - typeof (data) === 'object' && - typeof (data.getText) === 'function' + (typeof data === 'object') && + (typeof data.getText === 'function') ){ let txt = data.getText(); - if (typeof (txt) === 'string'){ + if (typeof txt === 'string'){ message.setParameter('data', txt); } else { return gpgme_error('PARAM_WRONG'); ----------------------------------------------------------------------- Summary of changes: .../BrowserTestExtension/tests/KeyImportExport.js | 35 ++--- lang/js/BrowserTestExtension/tests/KeyInfos.js | 2 +- lang/js/BrowserTestExtension/tests/decryptTest.js | 23 +-- .../tests/encryptDecryptTest.js | 160 +++++++++++---------- lang/js/BrowserTestExtension/tests/encryptTest.js | 87 +++++------ .../BrowserTestExtension/tests/longRunningTests.js | 24 ++-- lang/js/BrowserTestExtension/tests/signTest.js | 19 +-- lang/js/BrowserTestExtension/tests/verifyTest.js | 40 +++--- lang/js/DemoExtension/maindemo.js | 14 +- lang/js/src/Keyring.js | 143 ++++++++++-------- lang/js/src/gpgmejs.js | 147 +++++++++++-------- 11 files changed, 385 insertions(+), 309 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 19:08:04 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Wed, 22 Aug 2018 19:08:04 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-231-g24a0005 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 24a00058652233775cbe51446cba337b70cefdf1 (commit) from f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 24a00058652233775cbe51446cba337b70cefdf1 Author: Maximilian Krambach Date: Wed Aug 22 19:07:05 2018 +0200 js: add decrypt result options -- * As a decrypt result cannot be known beforehand, the decrypt operation may add an 'expect' property, taking either 'uint8' or 'base64', which will return the decrypted data in the appropiate formats. the return property 'format' will give a feedback on which option was taken. A test was added to reflect these changes. diff --git a/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js b/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js index 1efdf5c..c10c5d0 100644 --- a/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js +++ b/lang/js/BrowserTestExtension/tests/encryptDecryptTest.js @@ -144,6 +144,30 @@ describe('Encryption and Decryption', function (){ }); }).timeout(3000); + it('Random data, original data is and should stay base64 encoded', + function (done) { + let data = bigBoringString(0.001); + let b64data = btoa(data); + context.encrypt( + { data: b64data, publicKeys: good_fpr }) + .then(function (answer) { + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include( + 'BEGIN PGP MESSAGE'); + expect(answer.data).to.include( + 'END PGP MESSAGE'); + context.decrypt({ + data:answer.data, expect: 'base64' }) + .then(function (result) { + expect(result).to.not.be.empty; + expect(result.data).to.be.a('string'); + expect(result.data).to.equal(b64data); + done(); + }); + }); + }).timeout(3000); + for (let j = 0; j < inputvalues.encrypt.good.data_nonascii_32.length; j++){ it('Roundtrip with >1MB non-ascii input meeting default chunksize (' + (j + 1) + '/' diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index 8756cce..3fd1810 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -266,13 +266,16 @@ class Answer{ if (_decodedResponse.base64 === true && poa.data[key] === 'string' ) { - if (this.expected === 'binary'){ + if (this.expected === 'uint8'){ _response[key] = atobArray(_decodedResponse[key]); - _response.binary = true; + _response.format = 'uint8'; + } else if (this.expected === 'base64'){ + _response[key] = _decodedResponse[key]; + _response.format = 'base64'; } else { _response[key] = Utf8ArrayToStr( atobArray(_decodedResponse[key])); - _response.binary = false; + _response.format = 'string'; } } else { _response[key] = decode(_decodedResponse[key]); diff --git a/lang/js/src/Message.js b/lang/js/src/Message.js index 48813df..fff20fb 100644 --- a/lang/js/src/Message.js +++ b/lang/js/src/Message.js @@ -64,7 +64,7 @@ export class GPGME_Message { } set expected (value){ - if (value === 'binary'){ + if (value === 'uint8' || value === 'base64'){ this._expected = value; } } diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index e039842..ac64030 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -31,7 +31,11 @@ import { createSignature } from './Signature'; /** * @typedef {Object} decrypt_result * @property {String|Uint8Array} data The decrypted data - * @property {Boolean} binary indicating whether data is an Uint8Array. + * @property {String} format Indicating how the data was converted after being + * received from gpgme. + * 'string': Data was decoded into an utf-8 string, + * 'base64': Data was not processed and is a base64 string + * 'uint8': data was turned into a Uint8Array * @property {Boolean} is_mime (optional) the data claims to be a MIME * object. * @property {String} file_name (optional) the original file name @@ -51,8 +55,8 @@ import { createSignature } from './Signature'; /** * @typedef {Object} encrypt_result The result of an encrypt operation * @property {String} data The encrypted message - * @property {Boolean} binary Indicating whether returning payload data is an - * Uint8Array. + * @property {Boolean} base64 Indicating whether returning payload data is + * base64 encoded */ /** @@ -187,8 +191,9 @@ export class GpgME { * Strings and Objects with a getText method * @param {Boolean} options.base64 (optional) false if the data is an * armored block, true if it is base64 encoded binary data - * @param {Boolean} options.binary (optional) if true, treat the decoded - * data as binary, and return the data as Uint8Array + * @param {String} options.expect (optional) can be set to 'uint8' or + * 'base64'. Does no extra decoding on the data, and returns the decoded + * data as either Uint8Array or unprocessed(base64 encoded) string. * @returns {Promise} Decrypted Message and information * @async */ @@ -207,14 +212,14 @@ export class GpgME { if (options.base64 === true){ msg.setParameter('base64', true); } - if (options.binary === true){ - msg.expected = 'binary'; + if (options.expect === 'base64' || options.expect === 'uint8'){ + msg.expected = options.expect; } putData(msg, options.data); return new Promise(function (resolve, reject){ msg.post().then(function (result){ let _result = { data: result.data }; - _result.binary = result.binary ? true: false; + _result.format = result.format ? result.format : null; if (result.hasOwnProperty('dec_info')){ _result.is_mime = result.dec_info.is_mime ? true: false; if (result.dec_info.file_name) { ----------------------------------------------------------------------- Summary of changes: .../tests/encryptDecryptTest.js | 24 ++++++++++++++++++++++ lang/js/src/Connection.js | 9 +++++--- lang/js/src/Message.js | 2 +- lang/js/src/gpgmejs.js | 21 +++++++++++-------- 4 files changed, 44 insertions(+), 12 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 22 23:31:15 2018 From: cvs at cvs.gnupg.org (by Damien Goutte-Gattat via Gnupg-devel) Date: Wed, 22 Aug 2018 23:31:15 +0200 Subject: [git] Pinentry - branch, master, updated. pinentry-1.1.0-12-gd0eaec8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via d0eaec8ef60be9b4d1aa5993c11d261a35202a2e (commit) from 0fb3392f61569cb93e52c81465bc8e4636bca3b7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d0eaec8ef60be9b4d1aa5993c11d261a35202a2e Author: Damien Goutte-Gattat via Gnupg-devel Date: Tue Aug 21 20:31:53 2018 +0100 Disallow echo disabling when prompting for a PIN. * gtk+-2/pinentry-gtk-2.c (create_window): Do not setup the backspace handler when prompting for a PIN. callback only when not prompting for a PIN. * qt/pinentrydialog.h (_got_input): Rename field to _disable_echo_allowed. * qt/pinentrydialog.cpp (PinEntryDialog::setPrompt): Disallow echo disabling when prompting for a PIN. * tqt/pinentrydialog.h (_got_input): Rename field to _disable_echo_allowed. * tqt/pinentrydialog.cpp (PinEntryDialog::setPrompt): Disallow echo disabling when prompting for a PIN. Signed-off-by: Damien Goutte-Gattat diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c index 1e07fdc..a4522e4 100644 --- a/gtk+-2/pinentry-gtk-2.c +++ b/gtk+-2/pinentry-gtk-2.c @@ -729,8 +729,14 @@ create_window (pinentry_t ctx) gtk_widget_set_size_request (entry, 200, -1); g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (changed_text_handler), entry); - g_signal_connect (G_OBJECT (entry), "backspace", - G_CALLBACK (backspace_handler), entry); + + /* Enable disabling echo if we're not asking for a PIN. */ + if (pinentry->prompt && !strstr (pinentry->prompt, "PIN")) + { + g_signal_connect (G_OBJECT (entry), "backspace", + G_CALLBACK (backspace_handler), entry); + } + hbox = gtk_hbox_new (FALSE, HIG_TINY); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); /* There was a wish in issue #2139 that this button should not diff --git a/qt/pinentrydialog.cpp b/qt/pinentrydialog.cpp index b7f2e53..a58e636 100644 --- a/qt/pinentrydialog.cpp +++ b/qt/pinentrydialog.cpp @@ -138,7 +138,7 @@ PinEntryDialog::PinEntryDialog(QWidget *parent, const char *name, : QDialog(parent), mRepeat(NULL), _grabbed(false), - _got_input(false), + _disable_echo_allowed(true), mVisibilityTT(visibilityTT), mHideTT(hideTT), mVisiActionEdit(NULL), @@ -318,6 +318,8 @@ void PinEntryDialog::setPrompt(const QString &txt) { _prompt->setText(txt); _prompt->setVisible(!txt.isEmpty()); + if (txt.contains("PIN")) + _disable_echo_allowed = false; } QString PinEntryDialog::prompt() const @@ -362,7 +364,7 @@ void PinEntryDialog::setQualityBarTT(const QString &txt) void PinEntryDialog::onBackspace() { - if (!_got_input) { + if (_disable_echo_allowed) { _edit->setEchoMode(QLineEdit::NoEcho); if (mRepeat) { mRepeat->setEchoMode(QLineEdit::NoEcho); @@ -380,7 +382,7 @@ void PinEntryDialog::updateQuality(const QString &txt) _timer->stop(); } - _got_input = true; + _disable_echo_allowed = false; if (!_have_quality_bar || !_pinentry_info) { return; diff --git a/qt/pinentrydialog.h b/qt/pinentrydialog.h index 396f03b..d5e6963 100644 --- a/qt/pinentrydialog.h +++ b/qt/pinentrydialog.h @@ -109,7 +109,7 @@ private: bool _grabbed; bool _have_quality_bar; bool _timed_out; - bool _got_input; + bool _disable_echo_allowed; pinentry_t _pinentry_info; QTimer *_timer; QString mRepeatError, diff --git a/tqt/pinentrydialog.cpp b/tqt/pinentrydialog.cpp index 6a2ae12..b7aa309 100644 --- a/tqt/pinentrydialog.cpp +++ b/tqt/pinentrydialog.cpp @@ -33,7 +33,7 @@ PinEntryDialog::PinEntryDialog( TQWidget* parent, const char* name, bool modal, bool enable_quality_bar ) : TQDialog( parent, name, modal, TQt::WStyle_StaysOnTop ), _grabbed( false ), - _got_input( false ) + _disable_echo_allowed ( true ) { TQBoxLayout* top = new TQVBoxLayout( this, 6 ); TQBoxLayout* upperLayout = new TQHBoxLayout( top ); @@ -134,7 +134,7 @@ void PinEntryDialog::updateQuality( const SecTQString & txt ) int percent; TQPalette pal; - _got_input = true; + _disable_echo_allowed = false; if (!_have_quality_bar || !_pinentry_info) return; @@ -166,7 +166,7 @@ void PinEntryDialog::updateQuality( const SecTQString & txt ) void PinEntryDialog::onBackspace() { - if (!_got_input) + if (_disable_echo_allowed) _edit->setEchoMode( SecTQLineEdit::NoEcho ); } @@ -208,6 +208,8 @@ SecTQString PinEntryDialog::text() const void PinEntryDialog::setPrompt( const TQString& txt ) { _prompt->setText( txt ); + if (txt.contains("PIN")) + _disable_echo_allowed = false; } TQString PinEntryDialog::prompt() const diff --git a/tqt/pinentrydialog.h b/tqt/pinentrydialog.h index eb4d332..8ec3fd5 100644 --- a/tqt/pinentrydialog.h +++ b/tqt/pinentrydialog.h @@ -87,7 +87,7 @@ private: bool _grabbed; bool _have_quality_bar; pinentry_t _pinentry_info; - bool _got_input; + bool _disable_echo_allowed; }; ----------------------------------------------------------------------- Summary of changes: gtk+-2/pinentry-gtk-2.c | 10 ++++++++-- qt/pinentrydialog.cpp | 8 +++++--- qt/pinentrydialog.h | 2 +- tqt/pinentrydialog.cpp | 8 +++++--- tqt/pinentrydialog.h | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 23 12:17:14 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 23 Aug 2018 12:17:14 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-233-g3fd6837 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 3fd6837fce9b339b8b09a800a969e0950e78250c (commit) via 60dc499abd89f7e62a7b9cad943a96faa65187d5 (commit) from 24a00058652233775cbe51446cba337b70cefdf1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3fd6837fce9b339b8b09a800a969e0950e78250c Author: Maximilian Krambach Date: Thu Aug 23 12:15:59 2018 +0200 js: use destructured option parameters -- * Adds to f0409bbdafcbd4f8b0be099a6b3ce0d5352c9bcd and makes use of destructuring, allowing for defaults, and cleaning up the validation. diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index d8fd8c8..5902708 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -35,7 +35,7 @@ export class GPGME_Keyring { /** * Queries Keys (all Keys or a subset) from gnupg. * - * @param {Object} options + * @param {Object} options: * @param {String | Array} options.pattern (optional) A pattern to * search for in userIds or KeyIds. * @param {Boolean} options.prepare_sync (optional) if set to true, most @@ -49,24 +49,14 @@ export class GPGME_Keyring { * @static * @async */ - getKeys (options){ - if (options && typeof options !== 'object'){ - return Promise.reject(gpgme_error('PARAM_WRONG')); - } + getKeys ({ pattern, prepare_sync = false, search = false }){ return new Promise(function (resolve, reject) { let msg = createMessage('keylist'); - if (options && options.pattern) { - if ( - typeof options.pattern === 'string' - || Array.isArray(options.pattern) - ){ - msg.setParameter('keys', options.pattern); - } else { - reject(gpgme_error('PARAM_WRONG')); - } + if (pattern) { + msg.setParameter('keys', pattern); } msg.setParameter('sigs', true); - if (options && options.search === true){ + if (search === true){ msg.setParameter('locate', true); } msg.post().then(function (result){ @@ -75,11 +65,11 @@ export class GPGME_Keyring { resolve([]); } else { let secondrequest; - if (options && options.prepare_sync === true) { + if (prepare_sync === true) { secondrequest = function () { let msg2 = createMessage('keylist'); - if (options.pattern){ - msg2.setParameter('keys', options.pattern); + if (pattern){ + msg2.setParameter('keys', pattern); } msg2.setParameter('secret', true); return msg2.post(); @@ -91,7 +81,7 @@ export class GPGME_Keyring { } secondrequest().then(function (answer) { for (let i=0; i < result.keys.length; i++){ - if (options.prepare_sync === true){ + if (prepare_sync === true){ if (answer && answer.keys) { for (let j=0; j < answer.keys.length; j++ ){ @@ -111,7 +101,7 @@ export class GPGME_Keyring { } } let k = createKey(result.keys[i].fingerprint, - !options.prepare_sync, result.keys[i]); + !prepare_sync, result.keys[i]); resultset.push(k); } resolve(resultset); @@ -147,27 +137,19 @@ export class GPGME_Keyring { * @static * @async */ - getKeysArmored (options) { - if (options && typeof options !== 'object'){ - return Promise.reject(gpgme_error('PARAM_WRONG')); - } + getKeysArmored ({ pattern, with_secret_fpr }) { return new Promise(function (resolve, reject) { let msg = createMessage('export'); msg.setParameter('armor', true); - if (options.with_secret_fpr === true) { + if (with_secret_fpr === true) { msg.setParameter('with-sec-fprs', true); } - if (options.pattern){ - if ( - typeof options.pattern === 'string' - || Array.isArray(options.pattern) - ){ - msg.setParameter('keys', options.pattern); - } + if (pattern){ + msg.setParameter('keys', pattern); } msg.post().then(function (answer){ const result = { armored: answer.data }; - if (options.with_secret_fpr === true){ + if (with_secret_fpr === true){ if (answer.hasOwnProperty('sec-fprs')){ result.secret_fprs = answer['sec-fprs']; } else { @@ -404,39 +386,27 @@ export class GPGME_Keyring { * @return {Promise} * @async */ - generateKey (options){ - if (!options - || typeof options !== 'object' - || typeof options.userId !== 'string' + generateKey ({ userId, algo = 'default', expires= 0, subkey_algo }){ + if (typeof userId !== 'string' // eslint-disable-next-line no-use-before-define - || ( options.algo && supportedKeyAlgos.indexOf(options.algo) < 0 ) - || ( options.expires && !( - Number.isInteger(options.expires) || options.expires < 0 ) ) + || (algo && supportedKeyAlgos.indexOf(algo) < 0 ) + || (!Number.isInteger(expires) || expires < 0 ) ){ return Promise.reject(gpgme_error('PARAM_WRONG')); } // eslint-disable-next-line no-use-before-define - if (options.subkey_algo && supportedKeyAlgos.indexOf( - options.subkey_algo) < 0 - ){ + if (subkey_algo && supportedKeyAlgos.indexOf(subkey_algo) < 0){ return Promise.reject(gpgme_error('PARAM_WRONG')); } let me = this; return new Promise(function (resolve, reject){ let msg = createMessage('createkey'); - msg.setParameter('userid', options.userId); - if (!options.algo){ - options.algo === 'default'; - } - msg.setParameter('algo', options.algo); - if (options.subkey_algo) { - msg.setParameter('subkey-algo', options.subkey_algo ); - } - if (options.expires){ - msg.setParameter('expires', options.expires); - } else { - msg.setParameter('expires', 0); + msg.setParameter('userid', userId); + msg.setParameter('algo', algo); + if (subkey_algo) { + msg.setParameter('subkey-algo',subkey_algo ); } + msg.setParameter('expires', expires); msg.post().then(function (response){ me.getKeys(response.fingerprint, true).then( // TODO prepare_sync? diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index ac64030..ffee719 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -134,43 +134,39 @@ export class GpgME { * message and additional info. * @async */ - encrypt (options){ - if (!options || (typeof options !== 'object')){ - return Promise.reject(gpgme_error('PARAM_WRONG')); - } - if (!options.hasOwnProperty('data') - || !options.hasOwnProperty('publicKeys') - ){ + encrypt ({ data, publicKeys, secretKeys, base64 = false, armor = true, + wildcard, additional = {} }){ + if (!data || !publicKeys){ return Promise.reject(gpgme_error('MSG_INCOMPLETE')); } let msg = createMessage('encrypt'); if (msg instanceof Error){ return Promise.reject(msg); } - if (!options.hasOwnProperty('armor')){ - options.armor = true; - } - msg.setParameter('armor', options.armor); + msg.setParameter('armor', armor); - if (options.base64 === true) { + if (base64 === true) { msg.setParameter('base64', true); } - let pubkeys = toKeyIdArray(options.publicKeys); + let pubkeys = toKeyIdArray(publicKeys); + if (!pubkeys.length) { + return Promise.reject(gpgme_error('MSG_NO_KEYS')); + } msg.setParameter('keys', pubkeys); - let sigkeys = toKeyIdArray(options.secretKeys); + let sigkeys = toKeyIdArray(secretKeys); if (sigkeys.length > 0) { msg.setParameter('signing_keys', sigkeys); } - putData(msg, options.data); - if (options.wildcard === true){ + putData(msg, data); + if (wildcard === true){ msg.setParameter('throw-keyids', true); } - if (options.additional){ - let additional_Keys = Object.keys(options.additional); + if (additional){ + let additional_Keys = Object.keys(additional); for (let k = 0; k < additional_Keys.length; k++) { try { msg.setParameter(additional_Keys[k], - options.additional[additional_Keys[k]]); + additional[additional_Keys[k]]); } catch (error){ return Promise.reject(error); @@ -197,11 +193,8 @@ export class GpgME { * @returns {Promise} Decrypted Message and information * @async */ - decrypt (options){ - if (!options || (typeof options !== 'object')){ - return Promise.reject('PARAM_WRONG'); - } - if (!options.data){ + decrypt ({ data, base64, expect }){ + if (!data){ return Promise.reject(gpgme_error('MSG_EMPTY')); } let msg = createMessage('decrypt'); @@ -209,13 +202,13 @@ export class GpgME { if (msg instanceof Error){ return Promise.reject(msg); } - if (options.base64 === true){ + if (base64 === true){ msg.setParameter('base64', true); } - if (options.expect === 'base64' || options.expect === 'uint8'){ - msg.expected = options.expect; + if (expect === 'base64' || expect === 'uint8'){ + msg.expected = expect; } - putData(msg, options.data); + putData(msg, data); return new Promise(function (resolve, reject){ msg.post().then(function (result){ let _result = { data: result.data }; @@ -260,38 +253,32 @@ export class GpgME { * @returns {Promise} * @async */ - sign (options){ - if ( - !options || (typeof options !== 'object')){ - return Promise.reject(gpgme_error('PARAM_WRONG')); - } - if (!options.data){ + sign ({ data, keys, mode = 'clearsign', base64 }){ + if (!data){ return Promise.reject(gpgme_error('MSG_EMPTY')); } - if (!options.mode) { - options.mode = 'clearsign'; - } - let key_arr = toKeyIdArray(options.keys); + let key_arr = toKeyIdArray(keys); if (key_arr.length === 0){ return Promise.reject(gpgme_error('MSG_NO_KEYS')); } - let msg = createMessage('sign'); + let msg = createMessage('sign'); msg.setParameter('keys', key_arr); - if (options.base64 === true){ + if (base64 === true){ msg.setParameter('base64', true); } - msg.setParameter('mode', options.mode); - putData(msg, options.data); + msg.setParameter('mode', mode); + putData(msg, data); + return new Promise(function (resolve,reject) { msg.post().then( function (message) { - if (options.mode === 'clearsign'){ + if (mode === 'clearsign'){ resolve({ data: message.data } ); - } else if (options.mode === 'detached') { + } else if (mode === 'detached') { resolve({ - data: options.data, + data: data, signature: message.data }); } @@ -313,23 +300,23 @@ export class GpgME { * @returns {Promise} *@async */ - verify (options){ - if (!options || (typeof options !== 'object') || !options.data){ + verify ({ data, signature, base64 }){ + if (!data){ return Promise.reject(gpgme_error('PARAM_WRONG')); } let msg = createMessage('verify'); - let dt = putData(msg, options.data); + let dt = putData(msg, data); if (dt instanceof Error){ return Promise.reject(dt); } - if (options.signature){ + if (signature){ if (typeof signature !== 'string'){ return Promise.reject(gpgme_error('PARAM_WRONG')); } else { msg.setParameter('signature', signature); } } - if (options.base64 === true){ + if (base64 === true){ msg.setParameter('base64', true); } return new Promise(function (resolve, reject){ diff --git a/lang/js/unittests.js b/lang/js/unittests.js index 212effd..8f1ffb6 100644 --- a/lang/js/unittests.js +++ b/lang/js/unittests.js @@ -262,7 +262,7 @@ function unittests (){ it('Loading Keys from Keyring, to be used synchronously', function (done){ let keyring = new GPGME_Keyring; - keyring.getKeys(null, true).then(function (result){ + keyring.getKeys({ prepare_sync: true }).then(function (result){ expect(result).to.be.an('array'); expect(result[0].get('hasSecret')).to.be.a('boolean'); done(); @@ -273,7 +273,9 @@ function unittests (){ it('Loading specific Key from Keyring, to be used synchronously', function (done){ let keyring = new GPGME_Keyring; - keyring.getKeys(kp.validKeyFingerprint, true).then( + keyring.getKeys({ + pattern: kp.validKeyFingerprint, + prepare_sync: true }).then( function (result){ expect(result).to.be.an('array'); expect(result[0].get('hasSecret')).to.be.a('boolean'); commit 60dc499abd89f7e62a7b9cad943a96faa65187d5 Author: Maximilian Krambach Date: Thu Aug 23 11:28:18 2018 +0200 js: update getDefaultKey to more precise logic -- * src/Keyring.js: Adapted Keyring.getDefaultKey() to my current understanding of a default signing key: either the default key set in the gpg config, or 'the first usable private key' - usability meaning 'not invalid, expired, revoked, and can be used for signing'. It should be the same key used as in command line when doing a --sign operation. In case the user has a smartcard plugged in, we currently won't know of this here, so our choice may differ. But as we do all javascript-binding sign operations with the key fingerprint explicitly set, this should not be a real problem. This method is seen more as a convenience to tell using librarys which key represents the main user. diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index d6ba1d6..d8fd8c8 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -221,7 +221,12 @@ export class GPGME_Keyring { reject(gpgme_error('KEY_NO_DEFAULT')); } else { for (let i=0; i< result.keys.length; i++ ) { - if (result.keys[i].invalid === false) { + if ( + result.keys[i].invalid === false && + result.keys[i].expired === false && + result.keys[i].revoked === false && + result.keys[i].can_sign === true + ) { let k = createKey( result.keys[i].fingerprint, !prepare_sync, ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 87 ++++++++++++++++++-------------------------------- lang/js/src/gpgmejs.js | 87 +++++++++++++++++++++----------------------------- lang/js/unittests.js | 6 ++-- 3 files changed, 72 insertions(+), 108 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 23 12:33:40 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 23 Aug 2018 12:33:40 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-234-g352c530 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 352c53040d75e70dcda16c153d10c21e8eee0e01 (commit) from 3fd6837fce9b339b8b09a800a969e0950e78250c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 352c53040d75e70dcda16c153d10c21e8eee0e01 Author: Maximilian Krambach Date: Thu Aug 23 12:30:49 2018 +0200 js: offer an always-trust parameter on encrypt -- * src/gpgmejs.js: Setting the default to 'always trust' assumes that most api users will already have made their internal checks, but may not have the gnupg web-of-trust model implemented, thus trusting the key themselves, without gnupg having full or even any information. Still it should stay an option to have gnupg decide. diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index ffee719..1a5d557 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -128,6 +128,9 @@ export class GpgME { * block. * @param {Boolean} options.wildcard (optional) If true, recipient * information will not be added to the message. + * @param {Boolean} always_trust (optional, default true) This assumes that + * used keys are fully trusted. If set to false, encryption to a key not + * fully trusted in gnupg will fail * @param {Object} additional use additional valid gpg options as * defined in {@link permittedOperations} * @returns {Promise} Object containing the encrypted @@ -135,7 +138,7 @@ export class GpgME { * @async */ encrypt ({ data, publicKeys, secretKeys, base64 = false, armor = true, - wildcard, additional = {} }){ + wildcard, always_trust = true, additional = {} }){ if (!data || !publicKeys){ return Promise.reject(gpgme_error('MSG_INCOMPLETE')); } @@ -148,6 +151,9 @@ export class GpgME { if (base64 === true) { msg.setParameter('base64', true); } + if (always_trust === true) { + msg.setParameter('always-trust', true); + } let pubkeys = toKeyIdArray(publicKeys); if (!pubkeys.length) { return Promise.reject(gpgme_error('MSG_NO_KEYS')); ----------------------------------------------------------------------- Summary of changes: lang/js/src/gpgmejs.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 23 17:56:40 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 23 Aug 2018 17:56:40 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-235-gf62dd4b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via f62dd4bb27c36e44acf93af1daf24eefda3029c2 (commit) from 352c53040d75e70dcda16c153d10c21e8eee0e01 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f62dd4bb27c36e44acf93af1daf24eefda3029c2 Author: Maximilian Krambach Date: Thu Aug 23 17:55:35 2018 +0200 js: fix syntax inside Keyring methods -- * recent changes in parameter calling led to a forgotten internal call in getDefaultKey using old syntax (and failing in case a default key is configured) diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 5902708..2b57e63 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -185,7 +185,8 @@ export class GPGME_Keyring { && resp.option.value.length === 1 && resp.option.value[0].hasOwnProperty('string') && typeof (resp.option.value[0].string) === 'string'){ - me.getKeys(resp.option.value[0].string, true).then( + me.getKeys({ pattern: resp.option.value[0].string, + prepare_sync: true }).then( function (keys){ if (keys.length === 1){ resolve(keys[0]); ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 23 20:50:21 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 23 Aug 2018 20:50:21 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-236-ga5f8dac Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via a5f8dac77d50480a208c99398df323c58ce6dc58 (commit) from f62dd4bb27c36e44acf93af1daf24eefda3029c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a5f8dac77d50480a208c99398df323c58ce6dc58 Author: Andre Heinecke Date: Thu Aug 23 20:49:26 2018 +0200 json: Add sender and file name to encrypt * src/gpgme-json.c (hlp_encrypt, op_encrypt): Support sender and file_name. diff --git a/src/gpgme-json.c b/src/gpgme-json.c index d636ddb..9358269 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -1607,6 +1607,8 @@ static const char hlp_encrypt[] = "protocol: Either \"openpgp\" (default) or \"cms\".\n" "signing_keys: Similar to the keys parameter for added signing.\n" " (openpgp only)" + "file_name: The file name associated with the data.\n" + "sender: Sender info to embed in a signature.\n" "\n" "Optional boolean flags (default is false):\n" "base64: Input data is base64 encoded.\n" @@ -1634,12 +1636,14 @@ op_encrypt (cjson_t request, cjson_t result) char **signing_patterns = NULL; int opt_mime; char *keystring = NULL; + char *file_name = NULL; gpgme_data_t input = NULL; gpgme_data_t output = NULL; int abool; gpgme_encrypt_flags_t encrypt_flags = 0; gpgme_ctx_t keylist_ctx = NULL; gpgme_key_t key = NULL; + cjson_t j_tmp = NULL; if ((err = get_protocol (request, &protocol))) goto leave; @@ -1676,6 +1680,17 @@ op_encrypt (cjson_t request, cjson_t result) if (abool) encrypt_flags |= GPGME_ENCRYPT_WANT_ADDRESS; + j_tmp = cJSON_GetObjectItem (request, "file_name"); + if (j_tmp && cjson_is_string (j_tmp)) + { + file_name = j_tmp->valuestring; + } + + j_tmp = cJSON_GetObjectItem (request, "sender"); + if (j_tmp && cjson_is_string (j_tmp)) + { + gpgme_set_sender (ctx, j_tmp->valuestring); + } /* Get the keys. */ err = get_keys (request, "keys", &keystring); @@ -1724,6 +1739,10 @@ op_encrypt (cjson_t request, cjson_t result) if (opt_mime) gpgme_data_set_encoding (input, GPGME_DATA_ENCODING_MIME); + if (file_name) + { + gpgme_data_set_file_name (input, file_name); + } /* Create an output data object. */ err = gpgme_data_new (&output); @@ -1765,6 +1784,8 @@ op_encrypt (cjson_t request, cjson_t result) xfree_array (signing_patterns); xfree (keystring); release_onetime_context (keylist_ctx); + /* Reset sender in case the context is reused */ + gpgme_set_sender (ctx, NULL); gpgme_key_unref (key); gpgme_signers_clear (ctx); release_context (ctx); ----------------------------------------------------------------------- Summary of changes: src/gpgme-json.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 24 10:33:27 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 24 Aug 2018 10:33:27 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-237-g138e1dd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 138e1dde027338358a8da19ff8592b7369494534 (commit) from a5f8dac77d50480a208c99398df323c58ce6dc58 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 138e1dde027338358a8da19ff8592b7369494534 Author: Maximilian Krambach Date: Fri Aug 24 10:33:42 2018 +0200 js: add new options to permittedOperations -- * reflecting the new optional strings accepted by the backend. 'file_name' and 'sender' can be used via the 'additional' parameter in encrypt operations diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js index 6c05fc6..efb34f9 100644 --- a/lang/js/src/permittedOperations.js +++ b/lang/js/src/permittedOperations.js @@ -94,6 +94,12 @@ export const permittedOperations = { }, 'wrap': { allowed: ['boolean'] + }, + 'sender': { + allowed: ['string'] + }, + 'file_name': { + allowed: ['string'] } }, answer: { ----------------------------------------------------------------------- Summary of changes: lang/js/src/permittedOperations.js | 6 ++++++ 1 file changed, 6 insertions(+) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 06:54:45 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 27 Aug 2018 06:54:45 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-188-gce2f717 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via ce2f71760155b71a71418fe145a557c99bd52290 (commit) from 1b309d9f6199a91caa0ca0b97b92d599e00b736e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ce2f71760155b71a71418fe145a557c99bd52290 Author: NIIBE Yutaka Date: Mon Aug 27 13:12:31 2018 +0900 g10: Change decryption key selection for public key encryption. * g10/mainproc.c (struct mainproc_context): It's now pubkey_enc_list. (do_proc_packets): Remove the first arg CTRL. Fix call of proc_pubkey_enc. (release_list): Handle pubkey_enc_list. (proc_pubkey_enc): Remove the first arg CTRL. Simply put the packet to pubkey_enc_list. (print_pkenc_list): Remove the last arg FAILED. (proc_encrypted): Only call print_pkenc_list once. Handle DEK here. (proc_packets, proc_signature_packets, proc_signature_packets_by_fd) (proc_encryption_packets): Fix call of do_proc_packets. * g10/packet.h (struct pubkey_enc_list): Define. * g10/pubkey-enc.c (get_it): Change the second argument K. (get_session_key): Select session key by LIST, using enum_secret_keys. * g10/gpgv.c (get_session_key): Change the second argument K. * g10/test-stubs.c (get_session_key): Likewise. -- Collect all PKT_PUBKEY_ENC packets, and then, process the PKT_ENCRYPTED* packet. Signed-off-by: NIIBE Yutaka diff --git a/g10/gpgv.c b/g10/gpgv.c index c142cef..b335906 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -490,7 +490,7 @@ read_key_from_file (ctrl_t ctrl, const char *fname, kbnode_t *r_keyblock) * No encryption here but mainproc links to these functions. */ gpg_error_t -get_session_key (ctrl_t ctrl, PKT_pubkey_enc *k, DEK *dek) +get_session_key (ctrl_t ctrl, struct pubkey_enc_list *k, DEK *dek) { (void)ctrl; (void)k; diff --git a/g10/mainproc.c b/g10/mainproc.c index 1d56f1f..6ec1589 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -46,16 +46,6 @@ #define MAX_NESTING_DEPTH 32 -/* An object to build a list of keyid related info. */ -struct kidlist_item -{ - struct kidlist_item *next; - u32 kid[2]; - int pubkey_algo; - int reason; -}; - - /* * Object to hold the processing context. */ @@ -95,7 +85,7 @@ struct mainproc_context iobuf_t iobuf; /* Used to get the filename etc. */ int trustletter; /* Temporary usage in list_node. */ ulong symkeys; /* Number of symmetrically encrypted session keys. */ - struct kidlist_item *pkenc_list; /* List of encryption packets. */ + struct pubkey_enc_list *pkenc_list; /* List of encryption packets. */ struct { unsigned int sig_seen:1; /* Set to true if a signature packet has been seen. */ @@ -112,7 +102,7 @@ static int literals_seen; /*** Local prototypes. ***/ -static int do_proc_packets (ctrl_t ctrl, CTX c, iobuf_t a); +static int do_proc_packets (CTX c, iobuf_t a); static void list_node (CTX c, kbnode_t node); static void proc_tree (CTX c, kbnode_t node); @@ -135,7 +125,10 @@ release_list( CTX c ) release_kbnode (c->list); while (c->pkenc_list) { - struct kidlist_item *tmp = c->pkenc_list->next; + struct pubkey_enc_list *tmp = c->pkenc_list->next; + + mpi_release (c->pkenc_list->data[0]); + mpi_release (c->pkenc_list->data[1]); xfree (c->pkenc_list); c->pkenc_list = tmp; } @@ -458,10 +451,9 @@ proc_symkey_enc (CTX c, PACKET *pkt) static void -proc_pubkey_enc (ctrl_t ctrl, CTX c, PACKET *pkt) +proc_pubkey_enc (CTX c, PACKET *pkt) { PKT_pubkey_enc *enc; - int result = 0; /* Check whether the secret key is available and store in this case. */ c->last_was_session_key = 1; @@ -472,76 +464,29 @@ proc_pubkey_enc (ctrl_t ctrl, CTX c, PACKET *pkt) if (opt.verbose) log_info (_("public key is %s\n"), keystr (enc->keyid)); - if (is_status_enabled()) + if (is_status_enabled ()) { char buf[50]; snprintf (buf, sizeof buf, "%08lX%08lX %d 0", - (ulong)enc->keyid[0], (ulong)enc->keyid[1], enc->pubkey_algo); + (ulong)enc->keyid[0], (ulong)enc->keyid[1], enc->pubkey_algo); write_status_text (STATUS_ENC_TO, buf); } - if (!opt.list_only && opt.override_session_key) + if (!opt.list_only && !opt.override_session_key) { - /* It does not make much sense to store the session key in - * secure memory because it has already been passed on the - * command line and the GCHQ knows about it. */ - c->dek = xmalloc_clear (sizeof *c->dek); - result = get_override_session_key (c->dek, opt.override_session_key); - if (result) - { - xfree (c->dek); - c->dek = NULL; - } - } - else if (enc->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E - || enc->pubkey_algo == PUBKEY_ALGO_ECDH - || enc->pubkey_algo == PUBKEY_ALGO_RSA - || enc->pubkey_algo == PUBKEY_ALGO_RSA_E - || enc->pubkey_algo == PUBKEY_ALGO_ELGAMAL) - { - /* Note that we also allow type 20 Elgamal keys for decryption. - There are still a couple of those keys in active use as a - subkey. */ - - /* FIXME: Store this all in a list and process it later so that - we can prioritize what key to use. This gives a better user - experience if wildcard keyids are used. */ - if (!c->dek && ((!enc->keyid[0] && !enc->keyid[1]) - || opt.try_all_secrets - || have_secret_key_with_kid (enc->keyid))) - { - if(opt.list_only) - result = GPG_ERR_MISSING_ACTION; /* fixme: Use better error code. */ - else - { - c->dek = xmalloc_secure_clear (sizeof *c->dek); - if ((result = get_session_key (ctrl, enc, c->dek))) - { - /* Error: Delete the DEK. */ - xfree (c->dek); - c->dek = NULL; - } - } - } - else - result = GPG_ERR_NO_SECKEY; - } - else - result = GPG_ERR_PUBKEY_ALGO; + struct pubkey_enc_list *x = xmalloc (sizeof *x); - if (1) - { - /* Store it for later display. */ - struct kidlist_item *x = xmalloc (sizeof *x); - x->kid[0] = enc->keyid[0]; - x->kid[1] = enc->keyid[1]; + x->keyid[0] = enc->keyid[0]; + x->keyid[1] = enc->keyid[1]; x->pubkey_algo = enc->pubkey_algo; - x->reason = result; + x->data[0] = x->data[1] = NULL; + if (enc->data[0]) + { + x->data[0] = mpi_copy (enc->data[0]); + x->data[1] = mpi_copy (enc->data[1]); + } x->next = c->pkenc_list; c->pkenc_list = x; - - if (!result && opt.verbose > 1) - log_info (_("public key encrypted data: good DEK\n")); } free_packet(pkt, NULL); @@ -553,60 +498,34 @@ proc_pubkey_enc (ctrl_t ctrl, CTX c, PACKET *pkt) * not decrypt. */ static void -print_pkenc_list (ctrl_t ctrl, struct kidlist_item *list, int failed) +print_pkenc_list (ctrl_t ctrl, struct pubkey_enc_list *list) { for (; list; list = list->next) { PKT_public_key *pk; const char *algstr; - if (failed && !list->reason) - continue; - if (!failed && list->reason) - continue; - algstr = openpgp_pk_algo_name (list->pubkey_algo); pk = xmalloc_clear (sizeof *pk); if (!algstr) algstr = "[?]"; pk->pubkey_algo = list->pubkey_algo; - if (!get_pubkey (ctrl, pk, list->kid)) + if (!get_pubkey (ctrl, pk, list->keyid)) { char *p; log_info (_("encrypted with %u-bit %s key, ID %s, created %s\n"), nbits_from_pk (pk), algstr, keystr_from_pk(pk), strtimestamp (pk->timestamp)); - p = get_user_id_native (ctrl, list->kid); + p = get_user_id_native (ctrl, list->keyid); log_printf (_(" \"%s\"\n"), p); xfree (p); } else log_info (_("encrypted with %s key, ID %s\n"), - algstr, keystr(list->kid)); + algstr, keystr(list->keyid)); free_public_key (pk); - - if (gpg_err_code (list->reason) == GPG_ERR_NO_SECKEY) - { - if (is_status_enabled()) - { - char buf[20]; - snprintf (buf, sizeof buf, "%08lX%08lX", - (ulong)list->kid[0], (ulong)list->kid[1]); - write_status_text (STATUS_NO_SECKEY, buf); - } - } - else if (gpg_err_code (list->reason) == GPG_ERR_MISSING_ACTION) - { - /* Not tested for secret key due to --list-only mode. */ - } - else if (list->reason) - { - log_info (_("public key decryption failed: %s\n"), - gpg_strerror (list->reason)); - write_status_error ("pkdecrypt_failed", list->reason); - } } } @@ -630,11 +549,58 @@ proc_encrypted (CTX c, PACKET *pkt) log_info (_("encrypted with %lu passphrases\n"), c->symkeys); else if (c->symkeys == 1) log_info (_("encrypted with 1 passphrase\n")); - print_pkenc_list (c->ctrl, c->pkenc_list, 1 ); - print_pkenc_list (c->ctrl, c->pkenc_list, 0 ); + print_pkenc_list (c->ctrl, c->pkenc_list); + } + + /* Figure out the session key by looking at all pkenc packets. */ + if (opt.list_only || c->dek) + ; + else if (opt.override_session_key) + { + c->dek = xmalloc_clear (sizeof *c->dek); + result = get_override_session_key (c->dek, opt.override_session_key); + if (result) + { + xfree (c->dek); + c->dek = NULL; + log_info (_("public key decryption failed: %s\n"), + gpg_strerror (result)); + write_status_error ("pkdecrypt_failed", result); + } + } + else + { + c->dek = xmalloc_secure_clear (sizeof *c->dek); + result = get_session_key (c->ctrl, c->pkenc_list, c->dek); + if (result == GPG_ERR_NO_SECKEY) + { + if (is_status_enabled ()) + { + struct pubkey_enc_list *list; + + for (list = c->pkenc_list; list; list = list->next) + { + char buf[20]; + snprintf (buf, sizeof buf, "%08lX%08lX", + (ulong)list->keyid[0], (ulong)list->keyid[1]); + write_status_text (STATUS_NO_SECKEY, buf); + } + } + } + else if (result) + { + log_info (_("public key decryption failed: %s\n"), + gpg_strerror (result)); + write_status_error ("pkdecrypt_failed", result); + + /* Error: Delete the DEK. */ + xfree (c->dek); + c->dek = NULL; + } } - /* FIXME: Figure out the session key by looking at all pkenc packets. */ + if (c->dek && opt.verbose > 1) + log_info (_("public key encrypted data: good DEK\n")); write_status (STATUS_BEGIN_DECRYPTION); @@ -709,7 +675,7 @@ proc_encrypted (CTX c, PACKET *pkt) && gnupg_cipher_is_compliant (CO_DE_VS, c->dek->algo, GCRY_CIPHER_MODE_CFB)) { - struct kidlist_item *i; + struct pubkey_enc_list *i; int compliant = 1; PKT_public_key *pk = xmalloc (sizeof *pk); @@ -722,7 +688,7 @@ proc_encrypted (CTX c, PACKET *pkt) { memset (pk, 0, sizeof *pk); pk->pubkey_algo = i->pubkey_algo; - if (get_pubkey (c->ctrl, pk, i->kid) != 0 + if (get_pubkey (c->ctrl, pk, i->keyid) != 0 || ! gnupg_pk_is_compliant (CO_DE_VS, pk->pubkey_algo, pk->pkey, nbits_from_pk (pk), NULL)) compliant = 0; @@ -1367,7 +1333,7 @@ proc_packets (ctrl_t ctrl, void *anchor, iobuf_t a ) c->ctrl = ctrl; c->anchor = anchor; - rc = do_proc_packets (ctrl, c, a); + rc = do_proc_packets (c, a); xfree (c); return rc; @@ -1390,7 +1356,7 @@ proc_signature_packets (ctrl_t ctrl, void *anchor, iobuf_t a, c->signed_data.used = !!signedfiles; c->sigfilename = sigfilename; - rc = do_proc_packets (ctrl, c, a); + rc = do_proc_packets (c, a); /* If we have not encountered any signature we print an error messages, send a NODATA status back and return an error code. @@ -1433,7 +1399,7 @@ proc_signature_packets_by_fd (ctrl_t ctrl, c->signed_data.data_names = NULL; c->signed_data.used = (signed_data_fd != -1); - rc = do_proc_packets (ctrl, c, a); + rc = do_proc_packets (c, a); /* If we have not encountered any signature we print an error messages, send a NODATA status back and return an error code. @@ -1466,7 +1432,7 @@ proc_encryption_packets (ctrl_t ctrl, void *anchor, iobuf_t a ) c->ctrl = ctrl; c->anchor = anchor; c->encrypt_only = 1; - rc = do_proc_packets (ctrl, c, a); + rc = do_proc_packets (c, a); xfree (c); return rc; } @@ -1492,7 +1458,7 @@ check_nesting (CTX c) static int -do_proc_packets (ctrl_t ctrl, CTX c, iobuf_t a) +do_proc_packets (CTX c, iobuf_t a) { PACKET *pkt; struct parse_packet_ctx_s parsectx; @@ -1526,7 +1492,7 @@ do_proc_packets (ctrl_t ctrl, CTX c, iobuf_t a) { switch (pkt->pkttype) { - case PKT_PUBKEY_ENC: proc_pubkey_enc (ctrl, c, pkt); break; + case PKT_PUBKEY_ENC: proc_pubkey_enc (c, pkt); break; case PKT_SYMKEY_ENC: proc_symkey_enc (c, pkt); break; case PKT_ENCRYPTED: case PKT_ENCRYPTED_MDC: @@ -1572,7 +1538,7 @@ do_proc_packets (ctrl_t ctrl, CTX c, iobuf_t a) case PKT_SIGNATURE: newpkt = add_signature (c, pkt); break; case PKT_SYMKEY_ENC: proc_symkey_enc (c, pkt); break; - case PKT_PUBKEY_ENC: proc_pubkey_enc (ctrl, c, pkt); break; + case PKT_PUBKEY_ENC: proc_pubkey_enc (c, pkt); break; case PKT_ENCRYPTED: case PKT_ENCRYPTED_MDC: case PKT_ENCRYPTED_AEAD: proc_encrypted (c, pkt); break; @@ -1599,7 +1565,7 @@ do_proc_packets (ctrl_t ctrl, CTX c, iobuf_t a) break; case PKT_USER_ID: newpkt = add_user_id (c, pkt); break; case PKT_SIGNATURE: newpkt = add_signature (c, pkt); break; - case PKT_PUBKEY_ENC: proc_pubkey_enc (ctrl, c, pkt); break; + case PKT_PUBKEY_ENC: proc_pubkey_enc (c, pkt); break; case PKT_SYMKEY_ENC: proc_symkey_enc (c, pkt); break; case PKT_ENCRYPTED: case PKT_ENCRYPTED_MDC: diff --git a/g10/packet.h b/g10/packet.h index 6957686..3f87294 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -131,6 +131,16 @@ typedef struct { } PKT_pubkey_enc; +/* An object to build a list of public-key encrypted session key. */ +struct pubkey_enc_list +{ + struct pubkey_enc_list *next; + u32 keyid[2]; + int pubkey_algo; + gcry_mpi_t data[PUBKEY_MAX_NENC]; +}; + + /* A one-pass signature packet as defined in RFC 4880, Section 5.4. All fields are serialized. */ typedef struct { @@ -889,7 +899,7 @@ gpg_error_t check_signature2 (ctrl_t ctrl, /*-- pubkey-enc.c --*/ -gpg_error_t get_session_key (ctrl_t ctrl, PKT_pubkey_enc *k, DEK *dek); +gpg_error_t get_session_key (ctrl_t ctrl, struct pubkey_enc_list *k, DEK *dek); gpg_error_t get_override_session_key (DEK *dek, const char *string); /*-- compress.c --*/ diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c index 0185097..8540e03 100644 --- a/g10/pubkey-enc.c +++ b/g10/pubkey-enc.c @@ -38,7 +38,7 @@ #include "../common/compliance.h" -static gpg_error_t get_it (ctrl_t ctrl, PKT_pubkey_enc *k, +static gpg_error_t get_it (ctrl_t ctrl, struct pubkey_enc_list *k, DEK *dek, PKT_public_key *sk, u32 *keyid); @@ -72,92 +72,92 @@ is_algo_in_prefs (kbnode_t keyblock, preftype_t type, int algo) * which should have been allocated in secure memory by the caller. */ gpg_error_t -get_session_key (ctrl_t ctrl, PKT_pubkey_enc * k, DEK * dek) +get_session_key (ctrl_t ctrl, struct pubkey_enc_list *list, DEK *dek) { PKT_public_key *sk = NULL; int rc; + void *enum_context = NULL; + u32 keyid[2]; + int search_for_secret_keys = 1; if (DBG_CLOCK) log_clock ("get_session_key enter"); - rc = openpgp_pk_test_algo2 (k->pubkey_algo, PUBKEY_USAGE_ENC); - if (rc) - goto leave; - - if ((k->keyid[0] || k->keyid[1]) && !opt.try_all_secrets) + while (search_for_secret_keys) { + struct pubkey_enc_list *k; + + free_public_key (sk); sk = xmalloc_clear (sizeof *sk); - sk->pubkey_algo = k->pubkey_algo; /* We want a pubkey with this algo. */ - if (!(rc = get_seckey (ctrl, sk, k->keyid))) + rc = enum_secret_keys (ctrl, &enum_context, sk); + if (rc) { - /* Check compliance. */ - if (! gnupg_pk_is_allowed (opt.compliance, PK_USE_DECRYPTION, - sk->pubkey_algo, - sk->pkey, nbits_from_pk (sk), NULL)) - { - log_info (_("key %s is not suitable for decryption" - " in %s mode\n"), - keystr_from_pk (sk), - gnupg_compliance_option_string (opt.compliance)); - rc = gpg_error (GPG_ERR_PUBKEY_ALGO); - } - else - rc = get_it (ctrl, k, dek, sk, k->keyid); + rc = GPG_ERR_NO_SECKEY; + break; } - } - else if (opt.skip_hidden_recipients) - rc = gpg_error (GPG_ERR_NO_SECKEY); - else /* Anonymous receiver: Try all available secret keys. */ - { - void *enum_context = NULL; - u32 keyid[2]; - for (;;) + if (!(sk->pubkey_usage & PUBKEY_USAGE_ENC)) + continue; + + /* Check compliance. */ + if (! gnupg_pk_is_allowed (opt.compliance, PK_USE_DECRYPTION, + sk->pubkey_algo, + sk->pkey, nbits_from_pk (sk), NULL)) { - free_public_key (sk); - sk = xmalloc_clear (sizeof *sk); - rc = enum_secret_keys (ctrl, &enum_context, sk); - if (rc) - { - rc = GPG_ERR_NO_SECKEY; - break; - } - if (sk->pubkey_algo != k->pubkey_algo) + log_info (_("key %s is not suitable for decryption" + " in %s mode\n"), + keystr_from_pk (sk), + gnupg_compliance_option_string (opt.compliance)); + continue; + } + + for (k = list; k; k = k->next) + { + if (!(k->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E + || k->pubkey_algo == PUBKEY_ALGO_ECDH + || k->pubkey_algo == PUBKEY_ALGO_RSA + || k->pubkey_algo == PUBKEY_ALGO_RSA_E + || k->pubkey_algo == PUBKEY_ALGO_ELGAMAL)) continue; - if (!(sk->pubkey_usage & PUBKEY_USAGE_ENC)) + + if (openpgp_pk_test_algo2 (k->pubkey_algo, PUBKEY_USAGE_ENC)) + continue; + + if (sk->pubkey_algo != k->pubkey_algo) continue; + keyid_from_pk (sk, keyid); - if (!opt.quiet) - log_info (_("anonymous recipient; trying secret key %s ...\n"), - keystr (keyid)); - - /* Check compliance. */ - if (! gnupg_pk_is_allowed (opt.compliance, PK_USE_DECRYPTION, - sk->pubkey_algo, - sk->pkey, nbits_from_pk (sk), NULL)) + + if (!k->keyid[0] && !k->keyid[1]) { - log_info (_("key %s is not suitable for decryption" - " in %s mode\n"), - keystr_from_pk (sk), - gnupg_compliance_option_string (opt.compliance)); - continue; + if (!opt.quiet) + log_info (_("anonymous recipient; trying secret key %s ...\n"), + keystr (keyid)); } + else if (opt.try_all_secrets + || (k->keyid[0] == keyid[0] && k->keyid[1] == keyid[1])) + ; + else + continue; rc = get_it (ctrl, k, dek, sk, keyid); if (!rc) { - if (!opt.quiet) + if (!opt.quiet && !k->keyid[0] && !k->keyid[1]) log_info (_("okay, we are the anonymous recipient.\n")); + search_for_secret_keys = 0; break; } else if (gpg_err_code (rc) == GPG_ERR_FULLY_CANCELED) - break; /* Don't try any more secret keys. */ + { + search_for_secret_keys = 0; + break; /* Don't try any more secret keys. */ + } } - enum_secret_keys (ctrl, &enum_context, NULL); /* free context */ } - - leave: + enum_secret_keys (ctrl, &enum_context, NULL); /* free context */ free_public_key (sk); + if (DBG_CLOCK) log_clock ("get_session_key leave"); return rc; @@ -166,7 +166,7 @@ get_session_key (ctrl_t ctrl, PKT_pubkey_enc * k, DEK * dek) static gpg_error_t get_it (ctrl_t ctrl, - PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid) + struct pubkey_enc_list *enc, DEK *dek, PKT_public_key *sk, u32 *keyid) { gpg_error_t err; byte *frame = NULL; diff --git a/g10/test-stubs.c b/g10/test-stubs.c index 1e13632..a2b0d29 100644 --- a/g10/test-stubs.c +++ b/g10/test-stubs.c @@ -253,7 +253,7 @@ read_key_from_file (ctrl_t ctrl, const char *fname, kbnode_t *r_keyblock) * No encryption here but mainproc links to these functions. */ gpg_error_t -get_session_key (ctrl_t ctrl, PKT_pubkey_enc *k, DEK *dek) +get_session_key (ctrl_t ctrl, struct pubkey_enc_list *k, DEK *dek) { (void)ctrl; (void)k; ----------------------------------------------------------------------- Summary of changes: g10/gpgv.c | 2 +- g10/mainproc.c | 200 +++++++++++++++++++++++-------------------------------- g10/packet.h | 12 +++- g10/pubkey-enc.c | 118 ++++++++++++++++---------------- g10/test-stubs.c | 2 +- 5 files changed, 155 insertions(+), 179 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 09:15:35 2018 From: cvs at cvs.gnupg.org (by Jasper Spaans) Date: Mon, 27 Aug 2018 09:15:35 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-238-g08cd34a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 08cd34afb762975b0273575035dacf69449ef241 (commit) from 138e1dde027338358a8da19ff8592b7369494534 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 08cd34afb762975b0273575035dacf69449ef241 Author: Jasper Spaans Date: Mon Aug 27 09:04:16 2018 +0200 core: Export gpgme_data_new_from_estream function. Signed-off-by: Werner Koch diff --git a/src/gpgme.def b/src/gpgme.def index a01d89a..c690220 100644 --- a/src/gpgme.def +++ b/src/gpgme.def @@ -272,5 +272,7 @@ EXPORTS gpgme_op_encrypt_sign_ext @202 gpgme_op_encrypt_sign_ext_start @203 + gpgme_data_new_from_estream @204 + ; END diff --git a/src/libgpgme.vers b/src/libgpgme.vers index b49c86d..7531f54 100644 --- a/src/libgpgme.vers +++ b/src/libgpgme.vers @@ -133,6 +133,9 @@ GPGME_1.1 { gpgme_op_decrypt_ext; gpgme_op_decrypt_ext_start; + + gpgme_data_new_from_estream; + }; ----------------------------------------------------------------------- Summary of changes: src/gpgme.def | 2 ++ src/libgpgme.vers | 3 +++ 2 files changed, 5 insertions(+) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 09:26:20 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 27 Aug 2018 09:26:20 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-193-gb823788 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via b823788d200902f34c632026934cf0e43152b73e (commit) via 84cc55880a5815155328229beb309326472bfd82 (commit) via 03a8de7def4195b9accde47c1dcb84279361936d (commit) via 6bb93fc295e712ddf9b461dfe650211caf16a844 (commit) via 30153c65f0875f9a62838f6347bcdcedd6114d35 (commit) from ce2f71760155b71a71418fe145a557c99bd52290 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b823788d200902f34c632026934cf0e43152b73e Author: NIIBE Yutaka Date: Tue Jun 12 16:20:21 2018 +0900 g10: Fix enum_secret_keys for card keys. * g10/skclist.c (enum_secret_keys): Since "KEY-FPR" returns fingerprint in binary, change it to hex string. Signed-off-by: NIIBE Yutaka diff --git a/g10/skclist.c b/g10/skclist.c index d40fe6d..fe24b4a 100644 --- a/g10/skclist.c +++ b/g10/skclist.c @@ -331,6 +331,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) strlist_t sl; strlist_t card_list; char *serialno; + char fpr2[43]; struct agent_card_info_s info; kbnode_t keyblock; kbnode_t node; @@ -350,7 +351,6 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) if (!sk) { /* Free the context. */ - agent_release_card_info (&c->info); xfree (c->serialno); free_strlist (c->card_list); pubkeys_free (c->results); @@ -419,14 +419,19 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) } xfree (serialno); - agent_release_card_info (&c->info); + c->info.fpr2valid = 0; err = agent_scd_getattr ("KEY-FPR", &c->info); if (err) log_error ("error retrieving key fingerprint from card: %s\n", gpg_strerror (err)); if (c->info.fpr2valid) - name = c->info.fpr2; + { + c->fpr2[0] = '0'; + c->fpr2[1] = 'x'; + bin2hex (c->info.fpr2, 20, c->fpr2+2); + name = c->fpr2; + } c->sl = c->sl->next; } else commit 84cc55880a5815155328229beb309326472bfd82 Author: NIIBE Yutaka Date: Tue Jun 12 10:42:24 2018 +0900 g10: Prefer to available card keys for decryption. * g10/skclist.c (enum_secret_keys): Add logic to prefer decryption keys on cards. Signed-off-by: NIIBE Yutaka diff --git a/g10/skclist.c b/g10/skclist.c index f8c8cad..d40fe6d 100644 --- a/g10/skclist.c +++ b/g10/skclist.c @@ -329,6 +329,9 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) int eof; int state; strlist_t sl; + strlist_t card_list; + char *serialno; + struct agent_card_info_s info; kbnode_t keyblock; kbnode_t node; getkey_ctx_t ctx; @@ -347,6 +350,9 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) if (!sk) { /* Free the context. */ + agent_release_card_info (&c->info); + xfree (c->serialno); + free_strlist (c->card_list); pubkeys_free (c->results); release_kbnode (c->keyblock); getkey_end (ctrl, c->ctx); @@ -390,7 +396,49 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) c->state++; break; - case 3: /* Init search context to enum all secret keys. */ + case 3: /* Init list of card keys to try. */ + err = agent_scd_cardlist (&c->card_list); + if (!err) + agent_scd_serialno (&c->serialno, NULL); + c->sl = c->card_list; + c->state++; + break; + + case 4: /* Get next item from card list. */ + if (c->sl) + { + char *serialno; + + err = agent_scd_serialno (&serialno, c->sl->d); + if (err) + { + if (opt.verbose) + log_info (_("error getting serial number of card: %s\n"), + gpg_strerror (err)); + continue; + } + + xfree (serialno); + agent_release_card_info (&c->info); + err = agent_scd_getattr ("KEY-FPR", &c->info); + if (err) + log_error ("error retrieving key fingerprint from card: %s\n", + gpg_strerror (err)); + + if (c->info.fpr2valid) + name = c->info.fpr2; + c->sl = c->sl->next; + } + else + { + if (c->serialno) + /* Select the original card again. */ + agent_scd_serialno (&c->serialno, c->serialno); + c->state++; + } + break; + + case 5: /* Init search context to enum all secret keys. */ err = getkey_bynames (ctrl, &c->ctx, NULL, NULL, 1, &keyblock); if (err) @@ -403,7 +451,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) c->state++; break; - case 4: /* Get next item from the context. */ + case 6: /* Get next item from the context. */ if (c->ctx) { err = getkey_next (ctrl, c->ctx, NULL, &keyblock); @@ -446,10 +494,10 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) /* Get the next key from the current keyblock. */ for (; c->node; c->node = c->node->next) - { - if (c->node->pkt->pkttype == PKT_PUBLIC_KEY + { + if (c->node->pkt->pkttype == PKT_PUBLIC_KEY || c->node->pkt->pkttype == PKT_PUBLIC_SUBKEY) - { + { pubkey_t r; /* Skip this candidate if it's already enumerated. */ @@ -459,8 +507,8 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) if (r) continue; - copy_public_key (sk, c->node->pkt->pkt.public_key); - c->node = c->node->next; + copy_public_key (sk, c->node->pkt->pkt.public_key); + c->node = c->node->next; r = xtrycalloc (1, sizeof (*r)); if (!r) @@ -475,8 +523,8 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) r->next = c->results; c->results = r; - return 0; /* Found. */ - } + return 0; /* Found. */ + } } /* Dispose the keyblock and continue. */ commit 03a8de7def4195b9accde47c1dcb84279361936d Author: NIIBE Yutaka Date: Tue Jun 12 10:36:59 2018 +0900 g10: Move enum_secret_keys to skclist.c. * g10/getkey.c (enum_secret_keys): Move to... * g10/skclist.c (enum_secret_keys): ... here. -- The function enum_secret_keys is not used by gpgv.c, but it is in getkey.c. Extending enum_secret_keys will require change of gpgv.c, so moving the function to the file for gpg is better. Signed-off-by: NIIBE Yutaka diff --git a/g10/getkey.c b/g10/getkey.c index e9e98b1..41afeb9 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -3947,203 +3947,6 @@ lookup (ctrl_t ctrl, getkey_ctx_t ctx, int want_secret, } -/* Enumerate some secret keys (specifically, those specified with - * --default-key and --try-secret-key). Use the following procedure: - * - * 1) Initialize a void pointer to NULL - * 2) Pass a reference to this pointer to this function (content) - * and provide space for the secret key (sk) - * 3) Call this function as long as it does not return an error (or - * until you are done). The error code GPG_ERR_EOF indicates the - * end of the listing. - * 4) Call this function a last time with SK set to NULL, - * so that can free it's context. - * - * In pseudo-code: - * - * void *ctx = NULL; - * PKT_public_key *sk = xmalloc_clear (sizeof (*sk)); - * - * while ((err = enum_secret_keys (&ctx, sk))) - * { // Process SK. - * if (done) - * break; - * sk = xmalloc_clear (sizeof (*sk)); - * } - * - * // Release any resources used by CTX. - * enum_secret_keys (&ctx, NULL); - * - * if (gpg_err_code (err) != GPG_ERR_EOF) - * ; // An error occurred. - */ -gpg_error_t -enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) -{ - gpg_error_t err = 0; - const char *name; - kbnode_t keyblock; - struct - { - int eof; - int state; - strlist_t sl; - kbnode_t keyblock; - kbnode_t node; - getkey_ctx_t ctx; - pubkey_t results; - } *c = *context; - - if (!c) - { - /* Make a new context. */ - c = xtrycalloc (1, sizeof *c); - if (!c) - return gpg_error_from_syserror (); - *context = c; - } - - if (!sk) - { - /* Free the context. */ - pubkeys_free (c->results); - release_kbnode (c->keyblock); - getkey_end (ctrl, c->ctx); - xfree (c); - *context = NULL; - return 0; - } - - if (c->eof) - return gpg_error (GPG_ERR_EOF); - - for (;;) - { - /* Loop until we have a keyblock. */ - while (!c->keyblock) - { - /* Loop over the list of secret keys. */ - do - { - name = NULL; - keyblock = NULL; - switch (c->state) - { - case 0: /* First try to use the --default-key. */ - name = parse_def_secret_key (ctrl); - c->state = 1; - break; - - case 1: /* Init list of keys to try. */ - c->sl = opt.secret_keys_to_try; - c->state++; - break; - - case 2: /* Get next item from list. */ - if (c->sl) - { - name = c->sl->d; - c->sl = c->sl->next; - } - else - c->state++; - break; - - case 3: /* Init search context to enum all secret keys. */ - err = getkey_bynames (ctrl, &c->ctx, NULL, NULL, 1, - &keyblock); - if (err) - { - release_kbnode (keyblock); - keyblock = NULL; - getkey_end (ctrl, c->ctx); - c->ctx = NULL; - } - c->state++; - break; - - case 4: /* Get next item from the context. */ - if (c->ctx) - { - err = getkey_next (ctrl, c->ctx, NULL, &keyblock); - if (err) - { - release_kbnode (keyblock); - keyblock = NULL; - getkey_end (ctrl, c->ctx); - c->ctx = NULL; - } - } - else - c->state++; - break; - - default: /* No more names to check - stop. */ - c->eof = 1; - return gpg_error (GPG_ERR_EOF); - } - } - while ((!name || !*name) && !keyblock); - - if (keyblock) - c->node = c->keyblock = keyblock; - else - { - err = getkey_byname (ctrl, NULL, NULL, name, 1, &c->keyblock); - if (err) - { - /* getkey_byname might return a keyblock even in the - error case - I have not checked. Thus better release - it. */ - release_kbnode (c->keyblock); - c->keyblock = NULL; - } - else - c->node = c->keyblock; - } - } - - /* Get the next key from the current keyblock. */ - for (; c->node; c->node = c->node->next) - { - if (c->node->pkt->pkttype == PKT_PUBLIC_KEY - || c->node->pkt->pkttype == PKT_PUBLIC_SUBKEY) - { - pubkey_t r; - - /* Skip this candidate if it's already enumerated. */ - for (r = c->results; r; r = r->next) - if (!cmp_public_keys (r->pk, c->node->pkt->pkt.public_key)) - break; - if (r) - continue; - - copy_public_key (sk, c->node->pkt->pkt.public_key); - c->node = c->node->next; - - r = xtrycalloc (1, sizeof (*r)); - if (!r) - { - err = gpg_error_from_syserror (); - free_public_key (sk); - return err; - } - - r->pk = sk; - r->keyblock = NULL; - r->next = c->results; - c->results = r; - - return 0; /* Found. */ - } - } - - /* Dispose the keyblock and continue. */ - release_kbnode (c->keyblock); - c->keyblock = NULL; - } -} - gpg_error_t get_seckey_default_or_card (ctrl_t ctrl, PKT_public_key *pk, const byte *fpr_card, size_t fpr_len) diff --git a/g10/skclist.c b/g10/skclist.c index 78890dc..f8c8cad 100644 --- a/g10/skclist.c +++ b/g10/skclist.c @@ -286,3 +286,201 @@ build_sk_list (ctrl_t ctrl, *ret_sk_list = sk_list; return err; } + + +/* Enumerate some secret keys (specifically, those specified with + * --default-key and --try-secret-key). Use the following procedure: + * + * 1) Initialize a void pointer to NULL + * 2) Pass a reference to this pointer to this function (content) + * and provide space for the secret key (sk) + * 3) Call this function as long as it does not return an error (or + * until you are done). The error code GPG_ERR_EOF indicates the + * end of the listing. + * 4) Call this function a last time with SK set to NULL, + * so that can free it's context. + * + * In pseudo-code: + * + * void *ctx = NULL; + * PKT_public_key *sk = xmalloc_clear (sizeof (*sk)); + * + * while ((err = enum_secret_keys (&ctx, sk))) + * { // Process SK. + * if (done) + * break; + * sk = xmalloc_clear (sizeof (*sk)); + * } + * + * // Release any resources used by CTX. + * enum_secret_keys (&ctx, NULL); + * + * if (gpg_err_code (err) != GPG_ERR_EOF) + * ; // An error occurred. + */ +gpg_error_t +enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) +{ + gpg_error_t err = 0; + const char *name; + kbnode_t keyblock; + struct + { + int eof; + int state; + strlist_t sl; + kbnode_t keyblock; + kbnode_t node; + getkey_ctx_t ctx; + pubkey_t results; + } *c = *context; + + if (!c) + { + /* Make a new context. */ + c = xtrycalloc (1, sizeof *c); + if (!c) + return gpg_error_from_syserror (); + *context = c; + } + + if (!sk) + { + /* Free the context. */ + pubkeys_free (c->results); + release_kbnode (c->keyblock); + getkey_end (ctrl, c->ctx); + xfree (c); + *context = NULL; + return 0; + } + + if (c->eof) + return gpg_error (GPG_ERR_EOF); + + for (;;) + { + /* Loop until we have a keyblock. */ + while (!c->keyblock) + { + /* Loop over the list of secret keys. */ + do + { + name = NULL; + keyblock = NULL; + switch (c->state) + { + case 0: /* First try to use the --default-key. */ + name = parse_def_secret_key (ctrl); + c->state = 1; + break; + + case 1: /* Init list of keys to try. */ + c->sl = opt.secret_keys_to_try; + c->state++; + break; + + case 2: /* Get next item from list. */ + if (c->sl) + { + name = c->sl->d; + c->sl = c->sl->next; + } + else + c->state++; + break; + + case 3: /* Init search context to enum all secret keys. */ + err = getkey_bynames (ctrl, &c->ctx, NULL, NULL, 1, + &keyblock); + if (err) + { + release_kbnode (keyblock); + keyblock = NULL; + getkey_end (ctrl, c->ctx); + c->ctx = NULL; + } + c->state++; + break; + + case 4: /* Get next item from the context. */ + if (c->ctx) + { + err = getkey_next (ctrl, c->ctx, NULL, &keyblock); + if (err) + { + release_kbnode (keyblock); + keyblock = NULL; + getkey_end (ctrl, c->ctx); + c->ctx = NULL; + } + } + else + c->state++; + break; + + default: /* No more names to check - stop. */ + c->eof = 1; + return gpg_error (GPG_ERR_EOF); + } + } + while ((!name || !*name) && !keyblock); + + if (keyblock) + c->node = c->keyblock = keyblock; + else + { + err = getkey_byname (ctrl, NULL, NULL, name, 1, &c->keyblock); + if (err) + { + /* getkey_byname might return a keyblock even in the + error case - I have not checked. Thus better release + it. */ + release_kbnode (c->keyblock); + c->keyblock = NULL; + } + else + c->node = c->keyblock; + } + } + + /* Get the next key from the current keyblock. */ + for (; c->node; c->node = c->node->next) + { + if (c->node->pkt->pkttype == PKT_PUBLIC_KEY + || c->node->pkt->pkttype == PKT_PUBLIC_SUBKEY) + { + pubkey_t r; + + /* Skip this candidate if it's already enumerated. */ + for (r = c->results; r; r = r->next) + if (!cmp_public_keys (r->pk, c->node->pkt->pkt.public_key)) + break; + if (r) + continue; + + copy_public_key (sk, c->node->pkt->pkt.public_key); + c->node = c->node->next; + + r = xtrycalloc (1, sizeof (*r)); + if (!r) + { + err = gpg_error_from_syserror (); + free_public_key (sk); + return err; + } + + r->pk = sk; + r->keyblock = NULL; + r->next = c->results; + c->results = r; + + return 0; /* Found. */ + } + } + + /* Dispose the keyblock and continue. */ + release_kbnode (c->keyblock); + c->keyblock = NULL; + } +} commit 6bb93fc295e712ddf9b461dfe650211caf16a844 Author: NIIBE Yutaka Date: Mon Jun 11 15:02:57 2018 +0900 g10: Fix comment of enum_secret_keys. * g10/getkey.c (enum_secret_keys): Fix comment for usage of enum_secret_keys, following the previous change. -- Signed-off-by: NIIBE Yutaka diff --git a/g10/getkey.c b/g10/getkey.c index 5e4ca54..e9e98b1 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -3968,13 +3968,11 @@ lookup (ctrl_t ctrl, getkey_ctx_t ctx, int want_secret, * { // Process SK. * if (done) * break; - * free_public_key (sk); * sk = xmalloc_clear (sizeof (*sk)); * } * * // Release any resources used by CTX. * enum_secret_keys (&ctx, NULL); - * free_public_key (sk); * * if (gpg_err_code (err) != GPG_ERR_EOF) * ; // An error occurred. commit 30153c65f0875f9a62838f6347bcdcedd6114d35 Author: NIIBE Yutaka Date: Mon Jun 11 11:48:14 2018 +0900 g10: Enumerated keys for decryption should be unique. * g10/getkey.c (enum_secret_keys): Collecting keys in the context, check duplicate to make sure returning only unique keys. * g10/pubkey-enc.c (get_session_key): Now, it's the responsibility of enum_secret_keys to free keys. -- Signed-off-by: NIIBE Yutaka diff --git a/g10/getkey.c b/g10/getkey.c index 08e17e9..5e4ca54 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -3993,6 +3993,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) kbnode_t keyblock; kbnode_t node; getkey_ctx_t ctx; + pubkey_t results; } *c = *context; if (!c) @@ -4007,6 +4008,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) if (!sk) { /* Free the context. */ + pubkeys_free (c->results); release_kbnode (c->keyblock); getkey_end (ctrl, c->ctx); xfree (c); @@ -4109,8 +4111,31 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) if (c->node->pkt->pkttype == PKT_PUBLIC_KEY || c->node->pkt->pkttype == PKT_PUBLIC_SUBKEY) { + pubkey_t r; + + /* Skip this candidate if it's already enumerated. */ + for (r = c->results; r; r = r->next) + if (!cmp_public_keys (r->pk, c->node->pkt->pkt.public_key)) + break; + if (r) + continue; + copy_public_key (sk, c->node->pkt->pkt.public_key); c->node = c->node->next; + + r = xtrycalloc (1, sizeof (*r)); + if (!r) + { + err = gpg_error_from_syserror (); + free_public_key (sk); + return err; + } + + r->pk = sk; + r->keyblock = NULL; + r->next = c->results; + c->results = r; + return 0; /* Found. */ } } diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c index 8540e03..32b1ed0 100644 --- a/g10/pubkey-enc.c +++ b/g10/pubkey-enc.c @@ -87,7 +87,6 @@ get_session_key (ctrl_t ctrl, struct pubkey_enc_list *list, DEK *dek) { struct pubkey_enc_list *k; - free_public_key (sk); sk = xmalloc_clear (sizeof *sk); rc = enum_secret_keys (ctrl, &enum_context, sk); if (rc) @@ -156,7 +155,6 @@ get_session_key (ctrl_t ctrl, struct pubkey_enc_list *list, DEK *dek) } } enum_secret_keys (ctrl, &enum_context, NULL); /* free context */ - free_public_key (sk); if (DBG_CLOCK) log_clock ("get_session_key leave"); ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 174 -------------------------------------- g10/pubkey-enc.c | 2 - g10/skclist.c | 251 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 251 insertions(+), 176 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 11:21:37 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Mon, 27 Aug 2018 11:21:37 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-239-g557fec6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 557fec600248e6ad413af01c9a53d4993f36af0c (commit) from 08cd34afb762975b0273575035dacf69449ef241 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 557fec600248e6ad413af01c9a53d4993f36af0c Author: Maximilian Krambach Date: Mon Aug 27 11:21:02 2018 +0200 js: fix file_name return on decrypt -- * src/gpgmejs: Line 228 checked the wrong variable. To avoid further confusion, _result was renamed to returnValue in the whole file diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 1a5d557..5bdffeb 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -217,28 +217,28 @@ export class GpgME { putData(msg, data); return new Promise(function (resolve, reject){ msg.post().then(function (result){ - let _result = { data: result.data }; - _result.format = result.format ? result.format : null; + let returnValue = { data: result.data }; + returnValue.format = result.format ? result.format : null; if (result.hasOwnProperty('dec_info')){ - _result.is_mime = result.dec_info.is_mime ? true: false; + returnValue.is_mime = result.dec_info.is_mime ? true: false; if (result.dec_info.file_name) { - _result.file_name = result.dec_info.file_name; + returnValue.file_name = result.dec_info.file_name; } } - if (!result.file_name) { - _result.file_name = null; + if (!returnValue.file_name) { + returnValue.file_name = null; } if (result.hasOwnProperty('info') && result.info.hasOwnProperty('signatures') && Array.isArray(result.info.signatures) ) { - _result.signatures = collectSignatures( + returnValue.signatures = collectSignatures( result.info.signatures); } - if (_result.signatures instanceof Error){ - reject(_result.signatures); + if (returnValue.signatures instanceof Error){ + reject(returnValue.signatures); } else { - resolve(_result); + resolve(returnValue); } }, function (error){ reject(error); @@ -330,18 +330,18 @@ export class GpgME { if (!message.info || !message.info.signatures){ reject(gpgme_error('SIG_NO_SIGS')); } else { - let _result = { + let returnValue = { signatures: collectSignatures(message.info.signatures) }; - if (_result.signatures instanceof Error){ - reject(_result.signatures); + if (returnValue.signatures instanceof Error){ + reject(returnValue.signatures); } else { - _result.is_mime = message.info.is_mime? true: false; + returnValue.is_mime = message.info.is_mime? true: false; if (message.info.filename){ - _result.file_name = message.info.filename; + returnValue.file_name = message.info.filename; } - _result.data = message.data; - resolve(_result); + returnValue.data = message.data; + resolve(returnValue); } } }, function (error){ ----------------------------------------------------------------------- Summary of changes: lang/js/src/gpgmejs.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 11:48:41 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Mon, 27 Aug 2018 11:48:41 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-240-g4f28fbd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 4f28fbddd3d70eb7e3ce874b1673630142110b72 (commit) from 557fec600248e6ad413af01c9a53d4993f36af0c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4f28fbddd3d70eb7e3ce874b1673630142110b72 Author: Maximilian Krambach Date: Mon Aug 27 11:50:09 2018 +0200 js: extend information on decoding in decrypt -- * src/Connection.js: resulting data, if not pure ascii, is base64 encoded in the result message. A further decoding attempt into javascript 'string' will be attempted by default, unless specified at the decrypt() method. The return value 'format' now shows which of the possibilities has been applied. The old boolean 'base64' now turns into format:'base64' if the returned payload is a base64 string after decryption. diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index 3fd1810..c4921d5 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -232,7 +232,9 @@ class Answer{ return gpgme_error('CONN_UNEXPECTED_ANSWER'); } let _decodedResponse = JSON.parse(atob(this._response_b64)); - let _response = {}; + let _response = { + format: 'ascii' + }; let messageKeys = Object.keys(_decodedResponse); let poa = permittedOperations[this.operation].answer; if (messageKeys.length === 0){ diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 5bdffeb..b86b5f1 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -55,8 +55,12 @@ import { createSignature } from './Signature'; /** * @typedef {Object} encrypt_result The result of an encrypt operation * @property {String} data The encrypted message - * @property {Boolean} base64 Indicating whether returning payload data is - * base64 encoded + * @property {String} format Indicating how the data was converted after being + * received from gpgme. + * 'ascii': Data was ascii-encoded and no further processed + * 'string': Data was decoded into an utf-8 string, + * 'base64': Data was not processed and is a base64 string + * 'uint8': Data was turned into a Uint8Array */ /** ----------------------------------------------------------------------- Summary of changes: lang/js/src/Connection.js | 4 +++- lang/js/src/gpgmejs.js | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 11:52:42 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 27 Aug 2018 11:52:42 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-242-g53c5b9a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 53c5b9a265d33f2cc54f489375a929602338aee8 (commit) via 702566b36c1138b2154ce054254641edcbe472fb (commit) from 4f28fbddd3d70eb7e3ce874b1673630142110b72 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 53c5b9a265d33f2cc54f489375a929602338aee8 Author: Werner Koch Date: Mon Aug 27 11:42:27 2018 +0200 json: Do not put FILE_NAME into the verify result. * src/gpgme-json.c (verify_result_to_json): Remove "file_name". -- Having the file name in the verify result may lead developers to assume that the file name is covered by the signature. This is not the case and can easily be checked by hex-editing a signed message. We better don't output it at all. The same is true for the is_mime flag but that is anyway only an advisory and I can't see damage from a faulty one. Note that we keep file_name in gpgme's output for ABI stability and because some tools want to display meta information even if they are subject to tampering. This is similar to the non-encrypted subject in mails. Signed-off-by: Werner Koch diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 9358269..8812024 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -1138,7 +1138,6 @@ verify_result_to_json (gpgme_verify_result_t verify_result) { cjson_t result = xjson_CreateObject (); - xjson_AddStringToObject0 (result, "file_name", verify_result->file_name); xjson_AddBoolToObject (result, "is_mime", verify_result->is_mime); if (verify_result->signatures) @@ -2107,8 +2106,8 @@ static const char hlp_verify[] = "data: The verified data. This may be base64 encoded.\n" "base64: Boolean indicating whether data is base64 encoded.\n" "info: An object with verification information (gpgme_verify_result_t).\n" - " file_name: Optional string of the plaintext file name.\n" " is_mime: Boolean that is true if the messages claims it is MIME.\n" + " Note that this flag is not covered by the signature.)\n" " signatures: Array of signatures\n" " summary: Object containing summary information.\n" " Boolean values: (Check gpgme_sigsum_t doc for meaning)\n" commit 702566b36c1138b2154ce054254641edcbe472fb Author: Werner Koch Date: Mon Aug 27 11:34:30 2018 +0200 doc: Add warning that FILE_NAME is not part of the signed data. -- diff --git a/doc/gpgme.texi b/doc/gpgme.texi index aff7240..5c1757d 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -5845,7 +5845,15 @@ verification was attempted. @item char *file_name This is the filename of the original plaintext message file if it is -known, otherwise this is a null pointer. +known, otherwise this is a null pointer. Warning: The filename is +not covered by the signature. + + at item unsigned int is_mime : 1; + at since{1.11.0} + +The message claims that the content is a MIME object. Warning: This +flag is not covered by the signature. + @end table @end deftp diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 3596801..e4ea466 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -1591,11 +1591,12 @@ struct _gpgme_op_verify_result { gpgme_signature_t signatures; - /* The original file name of the plaintext message, if - available. */ + /* The original file name of the plaintext message, if available. + * Warning: This information is not covered by the signature. */ char *file_name; /* The message claims that the content is a MIME object. */ + /* Warning: This flag is not covered by the signature. */ unsigned int is_mime : 1; /* Internal to GPGME; do not use. */ ----------------------------------------------------------------------- Summary of changes: doc/gpgme.texi | 10 +++++++++- src/gpgme-json.c | 3 +-- src/gpgme.h.in | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 12:36:33 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Mon, 27 Aug 2018 12:36:33 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-243-g766d42c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 766d42c248a8c526b831685e93d54db81492f5a8 (commit) from 53c5b9a265d33f2cc54f489375a929602338aee8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 766d42c248a8c526b831685e93d54db81492f5a8 Author: Maximilian Krambach Date: Mon Aug 27 12:32:28 2018 +0200 js: typecheck destructured parameters -- * destructuring just takes the input argument and treats it as object. In cases like in src/Keyring/generateKey, where I forgot to change the old syntax, the fingerprint as string was destructured into an object without "pattern", which caused all Keys to be retrieved. So, methods with a destructuring now check if the first argument is an object and get a default empty object if no parameter is submitted. This allows the further use of destructured parameters, while still ensuring nothing vastly incorrect is used. * src/Kering.js, unittsets.js: fixed old syntax in method usage diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 2b57e63..0c64f33 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -49,7 +49,13 @@ export class GPGME_Keyring { * @static * @async */ - getKeys ({ pattern, prepare_sync = false, search = false }){ + getKeys ({ pattern, prepare_sync = false, search = false } = {}){ + if (typeof arguments[0] !== 'object') { + return Promise.reject(gpgme_error('PARAM_WRONG')); + } + if (arguments.length && typeof arguments[0] !== 'object') { + return Promise.reject(gpgme_error('PARAM_WRONG')); + } return new Promise(function (resolve, reject) { let msg = createMessage('keylist'); if (pattern) { @@ -387,7 +393,7 @@ export class GPGME_Keyring { * @return {Promise} * @async */ - generateKey ({ userId, algo = 'default', expires= 0, subkey_algo }){ + generateKey ({ userId, algo = 'default', expires= 0, subkey_algo } = {}){ if (typeof userId !== 'string' // eslint-disable-next-line no-use-before-define || (algo && supportedKeyAlgos.indexOf(algo) < 0 ) @@ -409,13 +415,14 @@ export class GPGME_Keyring { } msg.setParameter('expires', expires); msg.post().then(function (response){ - me.getKeys(response.fingerprint, true).then( - // TODO prepare_sync? - function (result){ - resolve(result); - }, function (error){ - reject(error); - }); + me.getKeys({ + pattern: response.fingerprint, + prepare_sync: true + }).then(function (result){ + resolve(result); + }, function (error){ + reject(error); + }); }, function (error) { reject(error); }); diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index b86b5f1..592b0a1 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -142,7 +142,10 @@ export class GpgME { * @async */ encrypt ({ data, publicKeys, secretKeys, base64 = false, armor = true, - wildcard, always_trust = true, additional = {} }){ + wildcard, always_trust = true, additional = {} } = {}){ + if (typeof arguments[0] !== 'object') { + return Promise.reject(gpgme_error('PARAM_WRONG')); + } if (!data || !publicKeys){ return Promise.reject(gpgme_error('MSG_INCOMPLETE')); } @@ -203,7 +206,10 @@ export class GpgME { * @returns {Promise} Decrypted Message and information * @async */ - decrypt ({ data, base64, expect }){ + decrypt ({ data, base64, expect } = {}){ + if (typeof arguments[0] !== 'object') { + return Promise.reject(gpgme_error('PARAM_WRONG')); + } if (!data){ return Promise.reject(gpgme_error('MSG_EMPTY')); } @@ -263,7 +269,10 @@ export class GpgME { * @returns {Promise} * @async */ - sign ({ data, keys, mode = 'clearsign', base64 }){ + sign ({ data, keys, mode = 'clearsign', base64 } = {}){ + if (typeof arguments[0] !== 'object') { + return Promise.reject(gpgme_error('PARAM_WRONG')); + } if (!data){ return Promise.reject(gpgme_error('MSG_EMPTY')); } @@ -310,7 +319,10 @@ export class GpgME { * @returns {Promise} *@async */ - verify ({ data, signature, base64 }){ + verify ({ data, signature, base64 } = {}){ + if (typeof arguments[0] !== 'object') { + return Promise.reject(gpgme_error('PARAM_WRONG')); + } if (!data){ return Promise.reject(gpgme_error('PARAM_WRONG')); } diff --git a/lang/js/unittests.js b/lang/js/unittests.js index 8f1ffb6..de06320 100644 --- a/lang/js/unittests.js +++ b/lang/js/unittests.js @@ -287,13 +287,14 @@ function unittests (){ it('Querying non-existing Key from Keyring', function (done){ let keyring = new GPGME_Keyring; - keyring.getKeys(kp.invalidKeyFingerprint, true).then( - function (result){ - expect(result).to.be.an('array'); - expect(result.length).to.equal(0); - done(); - } - ); + keyring.getKeys({ + pattern: kp.invalidKeyFingerprint, + prepare_sync: true + }).then(function (result){ + expect(result).to.be.an('array'); + expect(result.length).to.equal(0); + done(); + }); }); }); ----------------------------------------------------------------------- Summary of changes: lang/js/src/Keyring.js | 25 ++++++++++++++++--------- lang/js/src/gpgmejs.js | 20 ++++++++++++++++---- lang/js/unittests.js | 15 ++++++++------- 3 files changed, 40 insertions(+), 20 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 13:04:42 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Mon, 27 Aug 2018 13:04:42 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-244-g2808625 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 28086252f15e2c124a2a00c2abc87a815d227fbe (commit) from 766d42c248a8c526b831685e93d54db81492f5a8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 28086252f15e2c124a2a00c2abc87a815d227fbe Author: Maximilian Krambach Date: Mon Aug 27 13:00:50 2018 +0200 js: make non-payload data more encoding-tolerant -- * src/Helpers.js: As non-payload data might come in different encodings, a conversion has been introduced that worked in most cases. Data like the userid might come in different encodings, which we don't know of. For now, a try..catch returns the data as they are if the utf-8 decoding fails. Sometimes this yields the correct result, sometimes it may not work, but it won't stop the whole operation anymore. diff --git a/lang/js/src/Helpers.js b/lang/js/src/Helpers.js index 9fa5775..aa267f6 100644 --- a/lang/js/src/Helpers.js +++ b/lang/js/src/Helpers.js @@ -115,7 +115,14 @@ export function isLongId (value){ */ export function decode (property){ if (typeof property === 'string'){ - return decodeURIComponent(escape(property)); + try { + return decodeURIComponent(escape(property)); + } + catch (error){ + if (error instanceof URIError) { + return property; + } + } } else if (Array.isArray(property)){ let res = []; for (let arr=0; arr < property.length; arr++){ ----------------------------------------------------------------------- Summary of changes: lang/js/src/Helpers.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 13:23:54 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Mon, 27 Aug 2018 13:23:54 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-245-g8aa61fd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 8aa61fd3a270c167bf85cdd3f4148c48f5ae9ff7 (commit) from 28086252f15e2c124a2a00c2abc87a815d227fbe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8aa61fd3a270c167bf85cdd3f4148c48f5ae9ff7 Author: Maximilian Krambach Date: Mon Aug 27 13:24:18 2018 +0200 js: small documentation update -- diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 592b0a1..08f80fc 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -33,9 +33,11 @@ import { createSignature } from './Signature'; * @property {String|Uint8Array} data The decrypted data * @property {String} format Indicating how the data was converted after being * received from gpgme. + * 'ascii': Data was ascii-encoded and no further processed * 'string': Data was decoded into an utf-8 string, * 'base64': Data was not processed and is a base64 string * 'uint8': data was turned into a Uint8Array + * * @property {Boolean} is_mime (optional) the data claims to be a MIME * object. * @property {String} file_name (optional) the original file name @@ -82,7 +84,6 @@ import { createSignature } from './Signature'; * @property {Boolean} data: The verified data * @property {Boolean} is_mime (optional) the data claims to be a MIME * object. - * @property {String} file_name (optional) the original file name * @property {signatureDetails} signatures Verification details for * signatures */ ----------------------------------------------------------------------- Summary of changes: lang/js/src/gpgmejs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Aug 27 17:06:22 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 27 Aug 2018 17:06:22 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-194-g108702c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 108702ccae8ff1e5fec3b8e710f06a03637244c7 (commit) from b823788d200902f34c632026934cf0e43152b73e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 108702ccae8ff1e5fec3b8e710f06a03637244c7 Author: Werner Koch Date: Mon Aug 27 16:57:04 2018 +0200 gpg: Prepare for longer card fingerprints. * g10/call-agent.h (agent_card_info_s): Rename the "*valid" fields to "*len". * g10/call-agent.c (unhexify_fpr): Change to take a FPRLEN and to return the actual length. (agent_release_card_info): Adjust for these changes. * g10/card-util.c (print_sha1_fpr): Rename to print_shax_fpr and add arg FPRLEN. Change all callers to pass the length. (print_sha1_fpr_colon): Rename to print_shax_fpr_colon and add arg FPRLEN. Change all callers to pass the length. (fpr_is_zero): Add arg FPRLEN. (fpr_is_ff): Ditto. (show_card_key_info): Use the new functions. * g10/skclist.c (enum_secret_keys): Use MAX_FINGERPRINT_LEN. -- This is not needed right now but we should get rid of all hard coded fingerprint lengths. Thus this change. Signed-off-by: Werner Koch diff --git a/g10/call-agent.c b/g10/call-agent.c index 1445f4e..755f2e3 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -388,22 +388,23 @@ unescape_status_string (const unsigned char *s) } -/* Take a 20 byte hexencoded string and put it into the provided - 20 byte buffer FPR in binary format. */ -static int -unhexify_fpr (const char *hexstr, unsigned char *fpr) +/* Take a 20 or 32 byte hexencoded string and put it into the provided + * FPRLEN byte long buffer FPR in binary format. Returns the actual + * used length of the FPR buffer or 0 on error. */ +static unsigned int +unhexify_fpr (const char *hexstr, unsigned char *fpr, unsigned int fprlen) { const char *s; int n; for (s=hexstr, n=0; hexdigitp (s); s++, n++) ; - if ((*s && *s != ' ') || (n != 40)) + if ((*s && *s != ' ') || !(n == 40 || n == 64)) return 0; /* no fingerprint (invalid or wrong length). */ - for (s=hexstr, n=0; *s && n < 20; s += 2, n++) + for (s=hexstr, n=0; *s && n < fprlen; s += 2, n++) fpr[n] = xtoi_2 (s); - return 1; /* okay */ + return (n == 20 || n == 32)? n : 0; } /* Take the serial number from LINE and return it verbatim in a newly @@ -488,8 +489,8 @@ agent_release_card_info (struct agent_card_info_s *info) xfree (info->disp_lang); info->disp_lang = NULL; xfree (info->pubkey_url); info->pubkey_url = NULL; xfree (info->login_data); info->login_data = NULL; - info->cafpr1valid = info->cafpr2valid = info->cafpr3valid = 0; - info->fpr1valid = info->fpr2valid = info->fpr3valid = 0; + info->cafpr1len = info->cafpr2len = info->cafpr3len = 0; + info->fpr1len = info->fpr2len = info->fpr3len = 0; for (i=0; i < DIM(info->private_do); i++) { xfree (info->private_do[i]); @@ -625,11 +626,11 @@ learn_status_cb (void *opaque, const char *line) while (spacep (line)) line++; if (no == 1) - parm->fpr1valid = unhexify_fpr (line, parm->fpr1); + parm->fpr1len = unhexify_fpr (line, parm->fpr1, sizeof parm->fpr1); else if (no == 2) - parm->fpr2valid = unhexify_fpr (line, parm->fpr2); + parm->fpr2len = unhexify_fpr (line, parm->fpr2, sizeof parm->fpr2); else if (no == 3) - parm->fpr3valid = unhexify_fpr (line, parm->fpr3); + parm->fpr3len = unhexify_fpr (line, parm->fpr3, sizeof parm->fpr3); } else if (keywordlen == 8 && !memcmp (keyword, "KEY-TIME", keywordlen)) { @@ -657,11 +658,11 @@ learn_status_cb (void *opaque, const char *line) if (strncmp (line, "OPENPGP.", 8)) ; else if ((no = atoi (line+8)) == 1) - unhexify_fpr (hexgrp, parm->grp1); + unhexify_fpr (hexgrp, parm->grp1, sizeof parm->grp1); else if (no == 2) - unhexify_fpr (hexgrp, parm->grp2); + unhexify_fpr (hexgrp, parm->grp2, sizeof parm->grp2); else if (no == 3) - unhexify_fpr (hexgrp, parm->grp3); + unhexify_fpr (hexgrp, parm->grp3, sizeof parm->grp3); } else if (keywordlen == 6 && !memcmp (keyword, "CA-FPR", keywordlen)) { @@ -671,11 +672,11 @@ learn_status_cb (void *opaque, const char *line) while (spacep (line)) line++; if (no == 1) - parm->cafpr1valid = unhexify_fpr (line, parm->cafpr1); + parm->cafpr1len = unhexify_fpr (line, parm->cafpr1,sizeof parm->cafpr1); else if (no == 2) - parm->cafpr2valid = unhexify_fpr (line, parm->cafpr2); + parm->cafpr2len = unhexify_fpr (line, parm->cafpr2,sizeof parm->cafpr2); else if (no == 3) - parm->cafpr3valid = unhexify_fpr (line, parm->cafpr3); + parm->cafpr3len = unhexify_fpr (line, parm->cafpr3,sizeof parm->cafpr3); } else if (keywordlen == 8 && !memcmp (keyword, "KEY-ATTR", keywordlen)) { @@ -823,6 +824,8 @@ agent_keytocard (const char *hexgrip, int keyno, int force, return rc; } + + /* Call the agent to retrieve a data object. This function returns the data in the same structure as used by the learn command. It is diff --git a/g10/call-agent.h b/g10/call-agent.h index 7314ae8..59e4ff4 100644 --- a/g10/call-agent.h +++ b/g10/call-agent.h @@ -39,15 +39,15 @@ struct agent_card_info_s char *pubkey_url; /* malloced. */ char *login_data; /* malloced. */ char *private_do[4]; /* malloced. */ - char cafpr1valid; - char cafpr2valid; - char cafpr3valid; + char cafpr1len; /* Length of the CA-fingerprint or 0 if invalid. */ + char cafpr2len; + char cafpr3len; char cafpr1[20]; char cafpr2[20]; char cafpr3[20]; - char fpr1valid; - char fpr2valid; - char fpr3valid; + unsigned char fpr1len; /* Length of the fingerprint or 0 if invalid. */ + unsigned char fpr2len; + unsigned char fpr3len; char fpr1[20]; char fpr2[20]; char fpr3[20]; diff --git a/g10/card-util.c b/g10/card-util.c index b7eedc0..e9c0120 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -231,13 +231,14 @@ get_manufacturer (unsigned int no) static void -print_sha1_fpr (estream_t fp, const unsigned char *fpr) +print_shax_fpr (estream_t fp, const unsigned char *fpr, unsigned int fprlen) { int i; if (fpr) { - for (i=0; i < 20 ; i+=2, fpr += 2 ) + /* FIXME: Fix formatting for FPRLEN != 20 */ + for (i=0; i < fprlen ; i+=2, fpr += 2 ) { if (i == 10 ) tty_fprintf (fp, " "); @@ -251,13 +252,14 @@ print_sha1_fpr (estream_t fp, const unsigned char *fpr) static void -print_sha1_fpr_colon (estream_t fp, const unsigned char *fpr) +print_shax_fpr_colon (estream_t fp, + const unsigned char *fpr, unsigned int fprlen) { int i; if (fpr) { - for (i=0; i < 20 ; i++, fpr++) + for (i=0; i < fprlen ; i++, fpr++) es_fprintf (fp, "%02X", *fpr); } es_putc (':', fp); @@ -356,25 +358,25 @@ print_isoname (estream_t fp, const char *text, /* Return true if the SHA1 fingerprint FPR consists only of zeroes. */ static int -fpr_is_zero (const char *fpr) +fpr_is_zero (const char *fpr, unsigned int fprlen) { int i; - for (i=0; i < 20 && !fpr[i]; i++) + for (i=0; i < fprlen && !fpr[i]; i++) ; - return (i == 20); + return (i == fprlen); } -/* Return true if the SHA1 fingerprint FPR consists only of 0xFF. */ +/* Return true if the fingerprint FPR consists only of 0xFF. */ static int -fpr_is_ff (const char *fpr) +fpr_is_ff (const char *fpr, unsigned int fprlen) { int i; - for (i=0; i < 20 && fpr[i] == '\xff'; i++) + for (i=0; i < fprlen && fpr[i] == '\xff'; i++) ; - return (i == 20); + return (i == fprlen); } @@ -389,6 +391,7 @@ current_card_status (ctrl_t ctrl, estream_t fp, int rc; unsigned int uval; const unsigned char *thefpr; + unsigned int thefprlen; int i; if (serialno && serialnobuflen) @@ -521,22 +524,25 @@ current_card_status (ctrl_t ctrl, estream_t fp, } es_fputs ("cafpr:", fp); - print_sha1_fpr_colon (fp, info.cafpr1valid? info.cafpr1:NULL); - print_sha1_fpr_colon (fp, info.cafpr2valid? info.cafpr2:NULL); - print_sha1_fpr_colon (fp, info.cafpr3valid? info.cafpr3:NULL); + print_shax_fpr_colon (fp, info.cafpr1len? info.cafpr1:NULL, + info.cafpr2len); + print_shax_fpr_colon (fp, info.cafpr2len? info.cafpr2:NULL, + info.cafpr2len); + print_shax_fpr_colon (fp, info.cafpr3len? info.cafpr3:NULL, + info.cafpr3len); es_putc ('\n', fp); es_fputs ("fpr:", fp); - print_sha1_fpr_colon (fp, info.fpr1valid? info.fpr1:NULL); - print_sha1_fpr_colon (fp, info.fpr2valid? info.fpr2:NULL); - print_sha1_fpr_colon (fp, info.fpr3valid? info.fpr3:NULL); + print_shax_fpr_colon (fp, info.fpr1len? info.fpr1:NULL, info.fpr1len); + print_shax_fpr_colon (fp, info.fpr2len? info.fpr2:NULL, info.fpr2len); + print_shax_fpr_colon (fp, info.fpr3len? info.fpr3:NULL, info.fpr3len); es_putc ('\n', fp); es_fprintf (fp, "fprtime:%lu:%lu:%lu:\n", (unsigned long)info.fpr1time, (unsigned long)info.fpr2time, (unsigned long)info.fpr3time); es_fputs ("grp:", fp); - print_sha1_fpr_colon (fp, info.grp1); - print_sha1_fpr_colon (fp, info.grp2); - print_sha1_fpr_colon (fp, info.grp3); + print_shax_fpr_colon (fp, info.grp1, sizeof info.grp1); + print_shax_fpr_colon (fp, info.grp2, sizeof info.grp2); + print_shax_fpr_colon (fp, info.grp3, sizeof info.grp3); es_putc ('\n', fp); } else @@ -566,20 +572,20 @@ current_card_status (ctrl_t ctrl, estream_t fp, print_name (fp, "Private DO 3 .....: ", info.private_do[2]); if (info.private_do[3]) print_name (fp, "Private DO 4 .....: ", info.private_do[3]); - if (info.cafpr1valid) + if (info.cafpr1len) { tty_fprintf (fp, "CA fingerprint %d .:", 1); - print_sha1_fpr (fp, info.cafpr1); + print_shax_fpr (fp, info.cafpr1, info.cafpr1len); } - if (info.cafpr2valid) + if (info.cafpr2len) { tty_fprintf (fp, "CA fingerprint %d .:", 2); - print_sha1_fpr (fp, info.cafpr2); + print_shax_fpr (fp, info.cafpr2, info.cafpr2len); } - if (info.cafpr3valid) + if (info.cafpr3len) { tty_fprintf (fp, "CA fingerprint %d .:", 3); - print_sha1_fpr (fp, info.cafpr3); + print_shax_fpr (fp, info.cafpr3, info.cafpr3len); } tty_fprintf (fp, "Signature PIN ....: %s\n", info.chv1_cached? _("not forced"): _("forced")); @@ -612,24 +618,24 @@ current_card_status (ctrl_t ctrl, estream_t fp, info.chvretry[0], info.chvretry[1], info.chvretry[2]); tty_fprintf (fp, "Signature counter : %lu\n", info.sig_counter); tty_fprintf (fp, "Signature key ....:"); - print_sha1_fpr (fp, info.fpr1valid? info.fpr1:NULL); - if (info.fpr1valid && info.fpr1time) + print_shax_fpr (fp, info.fpr1len? info.fpr1:NULL, info.fpr1len); + if (info.fpr1len && info.fpr1time) { tty_fprintf (fp, " created ....: %s\n", isotimestamp (info.fpr1time)); print_keygrip (fp, info.grp1); } tty_fprintf (fp, "Encryption key....:"); - print_sha1_fpr (fp, info.fpr2valid? info.fpr2:NULL); - if (info.fpr2valid && info.fpr2time) + print_shax_fpr (fp, info.fpr2len? info.fpr2:NULL, info.fpr2len); + if (info.fpr2len && info.fpr2time) { tty_fprintf (fp, " created ....: %s\n", isotimestamp (info.fpr2time)); print_keygrip (fp, info.grp2); } tty_fprintf (fp, "Authentication key:"); - print_sha1_fpr (fp, info.fpr3valid? info.fpr3:NULL); - if (info.fpr3valid && info.fpr3time) + print_shax_fpr (fp, info.fpr3len? info.fpr3:NULL, info.fpr3len); + if (info.fpr3len && info.fpr3time) { tty_fprintf (fp, " created ....: %s\n", isotimestamp (info.fpr3time)); @@ -637,12 +643,14 @@ current_card_status (ctrl_t ctrl, estream_t fp, } tty_fprintf (fp, "General key info..: "); - thefpr = (info.fpr1valid? info.fpr1 : info.fpr2valid? info.fpr2 : - info.fpr3valid? info.fpr3 : NULL); + thefpr = (info.fpr1len? info.fpr1 : info.fpr2len? info.fpr2 : + info.fpr3len? info.fpr3 : NULL); + thefprlen = (info.fpr1len? info.fpr1len : info.fpr2len? info.fpr2len : + info.fpr3len? info.fpr3len : 0); /* If the fingerprint is all 0xff, the key has no asssociated OpenPGP certificate. */ - if ( thefpr && !fpr_is_ff (thefpr) - && !get_pubkey_byfprint (ctrl, pk, &keyblock, thefpr, 20)) + if ( thefpr && !fpr_is_ff (thefpr, thefprlen) + && !get_pubkey_byfprint (ctrl, pk, &keyblock, thefpr, thefprlen)) { print_pubkey_info (ctrl, fp, pk); if (keyblock) @@ -845,9 +853,10 @@ fetch_url (ctrl_t ctrl) rc = keyserver_fetch (ctrl, sl, KEYORG_URL); free_strlist (sl); } - else if (info.fpr1valid) + else if (info.fpr1len) { - rc = keyserver_import_fprint (ctrl, info.fpr1, 20, opt.keyserver, 0); + rc = keyserver_import_fprint (ctrl, info.fpr1, info.fpr1len, + opt.keyserver, 0); } } @@ -1309,11 +1318,11 @@ static void show_card_key_info (struct agent_card_info_s *info) { tty_fprintf (NULL, "Signature key ....:"); - print_sha1_fpr (NULL, info->fpr1valid? info->fpr1:NULL); + print_shax_fpr (NULL, info->fpr1len? info->fpr1:NULL, info->fpr1len); tty_fprintf (NULL, "Encryption key....:"); - print_sha1_fpr (NULL, info->fpr2valid? info->fpr2:NULL); + print_shax_fpr (NULL, info->fpr2len? info->fpr2:NULL, info->fpr2len); tty_fprintf (NULL, "Authentication key:"); - print_sha1_fpr (NULL, info->fpr3valid? info->fpr3:NULL); + print_shax_fpr (NULL, info->fpr3len? info->fpr3:NULL, info->fpr3len); tty_printf ("\n"); } @@ -1324,9 +1333,9 @@ replace_existing_key_p (struct agent_card_info_s *info, int keyno) { log_assert (keyno >= 0 && keyno <= 3); - if ((keyno == 1 && info->fpr1valid) - || (keyno == 2 && info->fpr2valid) - || (keyno == 3 && info->fpr3valid)) + if ((keyno == 1 && info->fpr1len) + || (keyno == 2 && info->fpr2len) + || (keyno == 3 && info->fpr3len)) { tty_printf ("\n"); log_info ("WARNING: such a key has already been stored on the card!\n"); @@ -1620,9 +1629,9 @@ generate_card_keys (ctrl_t ctrl) else want_backup = 0; - if ( (info.fpr1valid && !fpr_is_zero (info.fpr1)) - || (info.fpr2valid && !fpr_is_zero (info.fpr2)) - || (info.fpr3valid && !fpr_is_zero (info.fpr3))) + if ( (info.fpr1len && !fpr_is_zero (info.fpr1, info.fpr1len)) + || (info.fpr2len && !fpr_is_zero (info.fpr2, info.fpr2len)) + || (info.fpr3len && !fpr_is_zero (info.fpr3, info.fpr3len))) { tty_printf ("\n"); log_info (_("Note: keys are already stored on the card!\n")); diff --git a/g10/skclist.c b/g10/skclist.c index fe24b4a..fd747fb 100644 --- a/g10/skclist.c +++ b/g10/skclist.c @@ -149,7 +149,8 @@ build_sk_list (ctrl_t ctrl, } err = get_seckey_default_or_card (ctrl, pk, - info.fpr1valid? info.fpr1 : NULL, 20); + info.fpr1len? info.fpr1 : NULL, + info.fpr1len); if (err) { free_public_key (pk); @@ -331,7 +332,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) strlist_t sl; strlist_t card_list; char *serialno; - char fpr2[43]; + char fpr2[2 * MAX_FINGERPRINT_LEN + 3 ]; struct agent_card_info_s info; kbnode_t keyblock; kbnode_t node; @@ -419,17 +420,17 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) } xfree (serialno); - c->info.fpr2valid = 0; + c->info.fpr2len = 0; err = agent_scd_getattr ("KEY-FPR", &c->info); if (err) log_error ("error retrieving key fingerprint from card: %s\n", gpg_strerror (err)); - if (c->info.fpr2valid) + if (c->info.fpr2len) { c->fpr2[0] = '0'; c->fpr2[1] = 'x'; - bin2hex (c->info.fpr2, 20, c->fpr2+2); + bin2hex (c->info.fpr2, sizeof c->info.fpr2,c->fpr2+2); name = c->fpr2; } c->sl = c->sl->next; ----------------------------------------------------------------------- Summary of changes: g10/call-agent.c | 39 +++++++++++---------- g10/call-agent.h | 12 +++---- g10/card-util.c | 103 ++++++++++++++++++++++++++++++------------------------- g10/skclist.c | 11 +++--- 4 files changed, 89 insertions(+), 76 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 08:05:52 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 28 Aug 2018 08:05:52 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-246-g7d3c13d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 7d3c13df263ed88c17005920e75e0486abeae5b9 (commit) from 8aa61fd3a270c167bf85cdd3f4148c48f5ae9ff7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7d3c13df263ed88c17005920e75e0486abeae5b9 Author: Andre Heinecke Date: Tue Aug 28 08:05:30 2018 +0200 json: Allow NULL request in encode and chunk * src/gpgme-json.c (encode_and_chunk): Don't error on NULL request. -- This fixes the error that is passed when parthing the json object failed and request would be NULL. Instead of the JSON parser error it would otherwise report that encode and chunk failed. diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 8812024..0d1ec50 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -1521,7 +1521,7 @@ encode_and_chunk (cjson_t request, cjson_t response) { char *data; gpg_error_t err = 0; - size_t chunksize; + size_t chunksize = 0; char *getmore_request = NULL; if (opt_interactive) @@ -1537,7 +1537,6 @@ encode_and_chunk (cjson_t request, cjson_t response) if (!request) { - err = GPG_ERR_INV_VALUE; goto leave; } ----------------------------------------------------------------------- Summary of changes: src/gpgme-json.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 08:37:51 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 28 Aug 2018 08:37:51 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-247-g3bdf8be Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 3bdf8be6d2c57319399fe14e27e52b323a17750a (commit) from 7d3c13df263ed88c17005920e75e0486abeae5b9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3bdf8be6d2c57319399fe14e27e52b323a17750a Author: Andre Heinecke Date: Tue Aug 28 08:35:06 2018 +0200 json: Delete primary key if subkey gen fails * src/gpgme-json.c (op_delete): Delete primary key on subkey gen error. -- This can happen for example if the user cancels the pinentry to unlock the primary key when adding the subkey. To avoid an artifact of a pimary key without an encryption capable subkey we delete the created key and treat the whole operation as failed. diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 0d1ec50..5c670eb 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -3084,7 +3084,7 @@ op_createkey (cjson_t request, cjson_t result) err = gpgme_get_key (keylistctx, new_fpr, &new_key, 1); release_onetime_context (keylistctx); - if (err) + if (err || !new_key) { gpg_error_object (result, err, "Error finding created key: %s", gpg_strerror (err)); @@ -3096,7 +3096,27 @@ op_createkey (cjson_t request, cjson_t result) 0, expires, flags |= GPGME_CREATE_ENCR); xfree (subkey_algo); if (err) - goto leave; + { + /* This can happen for example if the user cancels the + * pinentry to unlock the primary key when adding the + * subkey. To avoid an artifact of a pimary key without + * an encryption capable subkey we delete the created + * key and treat the whole operation as failed. */ + gpgme_error_t err2; + gpg_error_object (result, err, "Error creating subkey: %s", + gpg_strerror (err)); + log_info ("Deleting primary key after keygen failure.\n"); + err2 = gpgme_op_delete_ext (ctx, new_key, GPGME_DELETE_FORCE | + GPGME_DELETE_ALLOW_SECRET); + if (err2) + { + log_error ("Error deleting primary key: %s", + gpg_strerror (err)); + } + gpgme_key_unref (new_key); + goto leave; + } + gpgme_key_unref (new_key); } xjson_AddStringToObject0 (result, "fingerprint", new_fpr); ----------------------------------------------------------------------- Summary of changes: src/gpgme-json.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 08:41:10 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 28 Aug 2018 08:41:10 +0200 Subject: [git] GPG-ERROR - branch, gniibe/pkg-config-support, created. libgpg-error-1.32-3-ge91365e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, gniibe/pkg-config-support has been created at e91365ef38ce020651353691c53c17c662f6c890 (commit) - Log ----------------------------------------------------------------- commit e91365ef38ce020651353691c53c17c662f6c890 Author: NIIBE Yutaka Date: Tue Aug 28 15:37:07 2018 +0900 pkg-config compatible .pc file support. Signed-off-by: NIIBE Yutaka diff --git a/configure.ac b/configure.ac index b5c01ba..1ea2135 100644 --- a/configure.ac +++ b/configure.ac @@ -491,13 +491,26 @@ else fi GPG_ERROR_CONFIG_ISUBDIRAFTER="" GPG_ERROR_CONFIG_HOST="$host" +case "$includedir" in + '${prefix}/include'|/usr/include|/include) GPG_ERROR_CONFIG_INCLUDEDIR="" ;; + *) GPG_ERROR_CONFIG_INCLUDEDIR="-I$includedir" ;; +esac +case "$libdir" in + '${exec_prefix}/lib'|/usr/lib|/usr/lib64|/lib|/lib64) GPG_ERROR_CONFIG_LIBDIR="" ;; + *) GPG_ERROR_CONFIG_LIBDIR="-L$libdir" ;; +esac + +PKGCONF_FUNCS_SH_CONTENT=$(cat $srcdir/src/pkgconf-funcs.sh) + AC_SUBST(GPG_ERROR_CONFIG_LIBS) AC_SUBST(GPG_ERROR_CONFIG_CFLAGS) AC_SUBST(GPG_ERROR_CONFIG_MT_LIBS) AC_SUBST(GPG_ERROR_CONFIG_MT_CFLAGS) AC_SUBST(GPG_ERROR_CONFIG_ISUBDIRAFTER) AC_SUBST(GPG_ERROR_CONFIG_HOST) - +AC_SUBST(GPG_ERROR_CONFIG_INCLUDEDIR) +AC_SUBST(GPG_ERROR_CONFIG_LIBDIR) +AC_SUBST(PKGCONF_FUNCS_SH_CONTENT) # # Special defines for certain platforms @@ -625,6 +638,7 @@ AC_CONFIG_FILES([src/Makefile tests/Makefile]) AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd]) AC_CONFIG_FILES([src/versioninfo.rc src/gpg-error.w32-manifest]) AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config]) +AC_CONFIG_FILES([src/gpg-error.pc]) AC_OUTPUT diff --git a/src/gpg-error-config.in b/src/gpg-error-config.in index aa7cb67..a0a0141 100644 --- a/src/gpg-error-config.in +++ b/src/gpg-error-config.in @@ -11,10 +11,11 @@ # SPDX-License-Identifier: FSFULLR prefix=@prefix@ -exec_prefix=@exec_prefix@ -includedir=@includedir@ -libdir=@libdir@ -isubdirafter="@GPG_ERROR_CONFIG_ISUBDIRAFTER@" +datarootdir=@datarootdir@ +datadir=@datadir@ +PKG_CONFIG_PATH="${datadir}/pkgconfig" + + at PKGCONF_FUNCS_SH_CONTENT@ if echo "$0" | grep gpg-error-config 2>/dev/null >/dev/null; then myname="gpg-error-config" @@ -22,8 +23,14 @@ else myname="gpgrt-config" fi +if find_file_in_path ${myname%-config}.pc $PKG_CONFIG_PATH; then + CONFIG_FILE=$RESULT +else + echo "Can't find ${myname%-config}.pc" 1>&2 + exit 1 +fi + output="" -mt=no usage() { @@ -44,6 +51,15 @@ if test $# -eq 0; then usage 1 1>&2 fi +if [ "$1" != "--mt" ]; then + mt=no +else + mt=yes + shift +fi + +read_config_file < "$CONFIG_FILE" + while test $# -gt 0; do case "$1" in -*=*) @@ -55,54 +71,48 @@ while test $# -gt 0; do esac case $1 in - --mt) - mt=yes - ;; - --prefix) - output="$output $prefix" + --prefix) + output="$output $(get_var prefix)" ;; - --exec-prefix) - output="$output $exec_prefix" + --exec-prefix) + output="$output $(get_var exec_prefix)" ;; - --version) - echo "@PACKAGE_VERSION@" + --version) + echo "$(get_attr Version)" exit 0 ;; - --cflags) - if test "x$includedir" != "x/usr/include" -a "x$includedir" != "x/include"; then - output="$output -I$includedir" - fi - # Note: -idirafter is a gcc extension. It is only used on - # systems where gcc is the only compiler we support (WindowsCE). - for i in $isubdirafter; do - output="$output -idirafter ${includedir}/${i}" - done - output="$output @GPG_ERROR_CONFIG_CFLAGS@" + --cflags) + output="$output $(get_attr Cflags)" if test $mt = yes ; then - output="$output @GPG_ERROR_CONFIG_MT_CFLAGS@" + output="$output $(get_var mtcflags)" fi ;; --libs) - case "$libdir" in - /usr/lib|/usr/lib64|/lib|/lib64) ;; - *) - output="$output -L$libdir" - ;; - esac - output="$output @GPG_ERROR_CONFIG_LIBS@" + output="$output $(get_attr Libs)" if test $mt = yes ; then - output="$output @GPG_ERROR_CONFIG_MT_LIBS@" + output="$output $(get_var mtlibs)" fi ;; - --host) - echo "@GPG_ERROR_CONFIG_HOST@" - exit 0 - ;; + --variable=*) + echo "$(get_var ${1#*=})" + exit 0 + ;; + --host) + echo "$(get_var host)" + exit 0 + ;; *) - usage 1 1>&2 + usage 1 1>&2 ;; esac shift done +# +# Clean up +# +# eval unset $VAR_list VAR_list +# eval unset $ATTR_list ATTR_list +# + echo $output diff --git a/src/gpg-error.pc.in b/src/gpg-error.pc.in new file mode 100644 index 0000000..fe8b553 --- /dev/null +++ b/src/gpg-error.pc.in @@ -0,0 +1,15 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +libdir=@libdir@ +isubdirafter=@GPG_ERROR_CONFIG_ISUBDIRAFTER@ +host=@GPG_ERROR_CONFIG_HOST@ +mtcflags=@GPG_ERROR_CONFIG_MT_CFLAGS@ +mtlibs=@GPG_ERROR_CONFIG_MT_LIBS@ + +Name: gpg-error +Description: GPG Runtime +Version: @PACKAGE_VERSION@ +Cflags: @GPG_ERROR_CONFIG_INCLUDEDIR@ @GPG_ERROR_CONFIG_CFLAGS@ +Libs: @GPG_ERROR_CONFIG_LIBDIR@ @GPG_ERROR_CONFIG_LIBS@ +URL: https://www.gnupg.org/software/libgpg-error/index.html diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh new file mode 100644 index 0000000..381243c --- /dev/null +++ b/src/pkgconf-funcs.sh @@ -0,0 +1,119 @@ +#################### start of pkgconf-funcs + +# +# Bourne shell functions for config file in pkg-config style, so that +# we can share such a config file between pkg-config and script +# + +# +# get_var: Get the variable value of NAME +# +# Variables are recorded in the shell variables named "VAR_" +# +get_var () { + local name=$1 + + eval echo \$VAR_$name +} + +# +# get_attr: Get the attribute value of KEY +# +# Attributes are recorded in the shell variables named "ATTR_" +# +get_attr () { + local name=$1 + + eval echo \$ATTR_$name +} + +# Remove ${varname} part in the beginning of a string. +remove_var_expr () { + local varname=$1 + shift + + eval echo \"\${@#\\\$\\\{$varname\\\}}\" +} + +# Given a string, substitute variables. +substitute_vars () { + local string="$1" + local line + local varname + local result + + while [ -n "$string" ]; do + case "$string" in + \$\$*) + result="$result\$" + string="${string#\$\$}" + ;; + \${*}*) + varname="${string#\$\{}" + varname="${varname%%\}*}" + result="$result$(get_var ${varname})" + string=$(remove_var_expr ${varname} ${string}) + ;; + *) + result="${result}$(printf %c "$string")" + string="${string#$(printf %c "$string")}" + ;; + esac + done + + echo "$result" +} + +# +# Read a config file +# +# Variables: +# For VAR=VALUE, value is stored in the shell variable VAR_*. +# +# Attributes: +# For KEY: VALUE, value is stored in the shell variable ATTR_*. +# +read_config_file () { + local line + local varname + local value + local key + + while read line; do + case "$line" in + *=*) + varname="${line%%=*}" + value="${line#*=}" + VAR_list="$VAR_list VAR_$varname" + read VAR_$varname < This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via c9e39ec1bcc258a0208d2b9a2896c4ce415ac8df (commit) via ed840c43457285039006dc6b5419ed8c8970c445 (commit) via d92cb5f7548c542046e9331ecaf53d05a43b57e3 (commit) via 8d2a2acd2e1b3714d1f48fefac1510676a71c534 (commit) via 14d33bbef22af1fc4c79329241d0b8b2dabae29f (commit) via 9e991ffe846625c7c61f6cd5b8dca32283ea44bc (commit) from b09e89143d13f1d170ba2298ca412b47f2f03382 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c9e39ec1bcc258a0208d2b9a2896c4ce415ac8df Author: Andre Heinecke Date: Tue Aug 28 12:15:24 2018 +0200 Add another tracepoint in parsing_done * src/mail.cpp (Mail::parsing_done): Add tracepoint. diff --git a/src/mail.cpp b/src/mail.cpp index 7209cf8..eeddb92 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1370,6 +1370,7 @@ Mail::parsing_done() m_crypto_flags |= 2; } + TRACEPOINT; updateSigstate (); m_needs_wipe = !m_is_send_again; commit ed840c43457285039006dc6b5419ed8c8970c445 Author: Andre Heinecke Date: Tue Aug 28 12:13:19 2018 +0200 Use keycache instead of Signature::Key * src/mail.cpp (Mail::updateSigstate), (Mail::getCryptoDetails_o): Use keycache. * src/parsecontroller.cpp (Parsecontroller::parse): Use keycache. -- This is a huge performance improvement as the old code was pretty bad. The old code did three keylistings after a verify to search the key, then check if the key is secret and then update the key. diff --git a/src/mail.cpp b/src/mail.cpp index fb15b1b..7209cf8 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -2009,7 +2009,9 @@ Mail::updateSigstate () for (const auto sig: m_verify_result.signatures()) { m_is_signed = true; - m_uid = get_uid_for_sender (sig.key(), sender.c_str()); + const auto key = KeyCache::instance ()->getByFpr (sig.fingerprint(), + true); + m_uid = get_uid_for_sender (key, sender.c_str()); if ((sig.summary() & Signature::Summary::Valid) && m_uid.origin() == GpgME::Key::OriginWKD && @@ -2433,8 +2435,10 @@ Mail::getCryptoDetails_o () } bool keyFound = true; - bool isOpenPGP = m_sig.key().isNull() ? !isSMIME_m () : - m_sig.key().protocol() == Protocol::OpenPGP; + const auto sigKey = KeyCache::instance ()->getByFpr (m_sig.fingerprint (), + true); + bool isOpenPGP = sigKey.isNull() ? !isSMIME_m () : + sigKey.protocol() == Protocol::OpenPGP; char *buf; bool hasConflict = false; int level = get_signature_level (); @@ -2448,7 +2452,7 @@ Mail::getCryptoDetails_o () /* level 4 check for direct trust */ int four_check = level_4_check (m_uid); - if (four_check == 2 && m_sig.key().hasSecret ()) + if (four_check == 2 && sigKey.hasSecret ()) { message = _("You signed this message."); } @@ -2477,7 +2481,7 @@ Mail::getCryptoDetails_o () { /* Level three is the only level for trusted S/MIME keys. */ gpgrt_asprintf (&buf, _("The senders identity is certified by the trusted issuer:\n'%s'\n"), - m_sig.key().issuerName()); + sigKey.issuerName()); memdbg_alloc (buf); message = buf; xfree (buf); diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp index 04a583e..150668c 100644 --- a/src/parsecontroller.cpp +++ b/src/parsecontroller.cpp @@ -25,6 +25,8 @@ #include "attachment.h" #include "mimedataprovider.h" +#include "keycache.h" + #include #include #include @@ -254,6 +256,19 @@ is_valid_chksum(const GpgME::Signature &sig) return sum & valid_mask; } + +/* Note on stability: + + Experiments have shown that we can have a crash if parse + returns at time that is not good for the state of Outlook. + + This happend in my test instance after a delay of > 1s < 3s + with a < 1% chance :-/ + + So if you have really really bad luck this might still crash + although it usually should be either much quicker or much slower + (slower e.g. when pinentry is requrired). +*/ void ParseController::parse() { @@ -459,17 +474,16 @@ ParseController::parse() { has_valid_encrypted_checksum = is_valid_chksum (sig); - /* FIXME: This is very expensive. We need some caching here - or reduce the information */ - TRACEPOINT; - sig.key(true, true); - TRACEPOINT; + KeyCache::instance ()->update (sig.fingerprint (), protocol); + if (!ultimate_keys_queried && (sig.validity() == Signature::Validity::Full || sig.validity() == Signature::Validity::Ultimate)) { /* Ensure that we have the keys with ultimate trust cached for the ui. */ + + // TODO this is something for the keycache get_ultimate_keys (); ultimate_keys_queried = true; } @@ -489,7 +503,16 @@ ParseController::parse() ss << m_decrypt_result << '\n' << m_verify_result; for (const auto sig: m_verify_result.signatures()) { - ss << '\n' << sig.key(); + const auto key = sig.key(); + if (key.isNull()) + { + ss << '\n' << "Cached key:\n" << KeyCache::instance()->getByFpr( + sig.fingerprint(), false); + } + else + { + ss << '\n' << key; + } } log_debug ("Decrypt / Verify result: %s", ss.str().c_str()); } commit d92cb5f7548c542046e9331ecaf53d05a43b57e3 Author: Andre Heinecke Date: Tue Aug 28 12:11:23 2018 +0200 Extend keycache for fingerprint lookup * src/keycache.cpp, src/keycache.h (KeyCache::update), (KeyCache::getByFpr): New. -- This extends the keycache with a generic fingerprint to key mapping. Update inserts or updates a key in the keycache, getByFpr is the main accessor. diff --git a/src/keycache.cpp b/src/keycache.cpp index a0eadba..95c27fe 100644 --- a/src/keycache.cpp +++ b/src/keycache.cpp @@ -32,9 +32,12 @@ #include #include +#include #include GPGRT_LOCK_DEFINE (keycache_lock); +GPGRT_LOCK_DEFINE (fpr_map_lock); +GPGRT_LOCK_DEFINE (update_lock); static KeyCache* singleton = nullptr; /** At some point we need to set a limit. There @@ -84,6 +87,53 @@ namespace }; } // namespace +typedef std::pair update_arg_t; + +static DWORD WINAPI +do_update (LPVOID arg) +{ + auto args = std::unique_ptr ((update_arg_t*) arg); + + log_mime_parser ("%s:%s updating: \"%s\" with protocol %s", + SRCNAME, __func__, args->first.c_str (), + to_cstr (args->second)); + + auto ctx = std::unique_ptr (GpgME::Context::createForProtocol + (args->second)); + + if (!ctx) + { + TRACEPOINT; + KeyCache::instance ()->onUpdateJobDone (args->first.c_str(), + GpgME::Key ()); + return 0; + } + + ctx->setKeyListMode (GpgME::KeyListMode::Local | + GpgME::KeyListMode::Signatures | + GpgME::KeyListMode::Validate | + GpgME::KeyListMode::WithTofu); + GpgME::Error err; + const auto newKey = ctx->key (args->first.c_str (), err, false); + TRACEPOINT; + + if (newKey.isNull()) + { + log_debug ("%s:%s Failed to find key for %s", + SRCNAME, __func__, args->first.c_str ()); + } + if (err) + { + log_debug ("%s:%s Failed to find key for %s err: ", + SRCNAME, __func__, err.asString ()); + } + KeyCache::instance ()->onUpdateJobDone (args->first.c_str(), + newKey); + log_debug ("%s:%s Update job done", + SRCNAME, __func__); + return 0; +} + class KeyCache::Private { public: @@ -105,6 +155,7 @@ public: { it->second = key; } + insertOrUpdateInFprMap (key); gpgrt_lock_unlock (&keycache_lock); } @@ -121,6 +172,7 @@ public: { it->second = key; } + insertOrUpdateInFprMap (key); gpgrt_lock_unlock (&keycache_lock); } @@ -137,6 +189,7 @@ public: { it->second = key; } + insertOrUpdateInFprMap (key); gpgrt_lock_unlock (&keycache_lock); } @@ -153,6 +206,7 @@ public: { it->second = key; } + insertOrUpdateInFprMap (key); gpgrt_lock_unlock (&keycache_lock); } @@ -260,7 +314,8 @@ public: return key; } - std::vector getEncryptionKeys (const std::vector &recipients, + std::vector getEncryptionKeys (const std::vector + &recipients, GpgME::Protocol proto) { std::vector ret; @@ -323,10 +378,219 @@ public: return ret; } + void insertOrUpdateInFprMap (const GpgME::Key &key) + { + if (key.isNull() || !key.primaryFingerprint()) + { + TRACEPOINT; + return; + } + gpgrt_lock_lock (&fpr_map_lock); + + /* First ensure that we have the subkeys mapped to the primary + fpr */ + const char *primaryFpr = key.primaryFingerprint (); + + for (const auto &sub: key.subkeys()) + { + const char *subFpr = sub.fingerprint(); + auto it = m_sub_fpr_map.find (subFpr); + if (it == m_sub_fpr_map.end ()) + { + m_sub_fpr_map.insert (std::make_pair( + std::string (subFpr), + std::string (primaryFpr))); + } + } + + auto it = m_fpr_map.find (primaryFpr); + + log_mime_parser ("%s:%s \"%s\" updated.", + SRCNAME, __func__, primaryFpr); + if (it == m_fpr_map.end ()) + { + m_fpr_map.insert (std::make_pair (primaryFpr, key)); + + gpgrt_lock_unlock (&fpr_map_lock); + return; + } + + if (it->second.hasSecret () && !key.hasSecret()) + { + log_debug ("%s:%s Lost secret info on update. Merging.", + SRCNAME, __func__); + auto merged = key; + merged.mergeWith (it->second); + it->second = merged; + } + else + { + it->second = key; + } + gpgrt_lock_unlock (&fpr_map_lock); + return; + } + + GpgME::Key getFromMap (const char *fpr) const + { + if (!fpr) + { + TRACEPOINT; + return GpgME::Key(); + } + + gpgrt_lock_lock (&fpr_map_lock); + std::string primaryFpr; + const auto it = m_sub_fpr_map.find (fpr); + if (it != m_sub_fpr_map.end ()) + { + log_debug ("%s:%s using \"%s\" for \"%s\"", + SRCNAME, __func__, it->second.c_str(), fpr); + primaryFpr = it->second; + } + else + { + primaryFpr = fpr; + } + + const auto keyIt = m_fpr_map.find (primaryFpr); + if (keyIt != m_fpr_map.end ()) + { + gpgrt_lock_unlock (&fpr_map_lock); + return keyIt->second; + } + gpgrt_lock_unlock (&fpr_map_lock); + return GpgME::Key(); + } + + GpgME::Key getByFpr (const char *fpr, bool block) const + { + if (!fpr) + { + TRACEPOINT; + return GpgME::Key (); + } + + TRACEPOINT; + const auto ret = getFromMap (fpr); + if (ret.isNull()) + { + // If the key was not found we need to check if there is + // an update running. + if (block) + { + const std::string sFpr (fpr); + int i = 0; + + gpgrt_lock_lock (&update_lock); + while (std::find (m_update_jobs.begin(), m_update_jobs.end(), + sFpr) + != m_update_jobs.end ()) + { + i++; + if (i % 100 == 0) + { + log_debug ("%s:%s Waiting on update for \"%s\"", + SRCNAME, __func__, fpr); + } + gpgrt_lock_unlock (&update_lock); + Sleep (10); + gpgrt_lock_lock (&update_lock); + if (i == 3000) + { + /* Just to be on the save side */ + log_error ("%s:%s Waiting on update for \"%s\" " + "failed! Bug!", + SRCNAME, __func__, fpr); + break; + } + } + gpgrt_lock_unlock (&update_lock); + + TRACEPOINT; + const auto ret2 = getFromMap (fpr); + if (ret2.isNull ()) + { + log_debug ("%s:%s Cache miss after blocking check %s.", + SRCNAME, __func__, fpr); + } + else + { + log_debug ("%s:%s Cache hit after wait for %s.", + SRCNAME, __func__, fpr); + return ret2; + } + } + log_debug ("%s:%s Cache miss for %s.", + SRCNAME, __func__, fpr); + return GpgME::Key(); + } + + log_debug ("%s:%s Cache hit for %s.", + SRCNAME, __func__, fpr); + return ret; + } + + void update (const char *fpr, GpgME::Protocol proto) + { + if (!fpr) + { + return; + } + const std::string sFpr (fpr); + gpgrt_lock_lock (&update_lock); + if (std::find (m_update_jobs.begin(), m_update_jobs.end(), sFpr) + != m_update_jobs.end ()) + { + log_debug ("%s:%s Update for \"%s\" already in progress.", + SRCNAME, __func__, fpr); + gpgrt_lock_unlock (&update_lock); + } + + m_update_jobs.push_back (sFpr); + gpgrt_lock_unlock (&update_lock); + update_arg_t * args = new update_arg_t; + args->first = sFpr; + args->second = proto; + CloseHandle (CreateThread (NULL, 0, do_update, + (LPVOID) args, 0, + NULL)); + } + + void onUpdateJobDone (const char *fpr, const GpgME::Key &key) + { + if (!fpr) + { + return; + } + TRACEPOINT; + insertOrUpdateInFprMap (key); + const std::string sFpr (fpr); + gpgrt_lock_lock (&update_lock); + const auto it = std::find (m_update_jobs.begin(), + m_update_jobs.end(), + sFpr); + + if (it == m_update_jobs.end()) + { + log_error ("%s:%s Update for \"%s\" already finished.", + SRCNAME, __func__, fpr); + gpgrt_lock_unlock (&update_lock); + return; + } + m_update_jobs.erase (it); + gpgrt_lock_unlock (&update_lock); + TRACEPOINT; + return; + } + std::map m_pgp_key_map; std::map m_smime_key_map; std::map m_pgp_skey_map; std::map m_smime_skey_map; + std::unordered_map m_fpr_map; + std::unordered_map m_sub_fpr_map; + std::vector m_update_jobs; }; KeyCache::KeyCache(): @@ -392,7 +656,8 @@ do_locate (LPVOID arg) } // We need to validate here to fetch CRL's ctx->setKeyListMode (GpgME::KeyListMode::Local | - GpgME::KeyListMode::Validate); + GpgME::KeyListMode::Validate | + GpgME::KeyListMode::Signatures); GpgME::Error e = ctx->startKeyListing (addr.c_str()); if (e) { @@ -663,3 +928,21 @@ KeyCache::isMailResolvable(Mail *mail) return !encKeys.empty() && !sigKey.isNull(); } + +void +KeyCache::update (const char *fpr, GpgME::Protocol proto) +{ + d->update (fpr, proto); +} + +GpgME::Key +KeyCache::getByFpr (const char *fpr, bool block) const +{ + return d->getByFpr (fpr, block); +} + +void +KeyCache::onUpdateJobDone (const char *fpr, const GpgME::Key &key) +{ + return d->onUpdateJobDone (fpr, key); +} diff --git a/src/keycache.h b/src/keycache.h index 9cdf499..ea90863 100644 --- a/src/keycache.h +++ b/src/keycache.h @@ -80,11 +80,29 @@ public: **/ bool isMailResolvable (Mail *mail); + /* Search / Update a key in the cache. This is meant to be + called e.g. after a verify to update the key. + + A known issue is that a get right after it might + still return an outdated key but the get after that + would return the updated one. This is acceptable as + it only poses a minor problem with TOFU while we + can show the correct state in the tooltip. */ + void update (const char *fpr, GpgME::Protocol proto); + + /* Get a cached key. If block is true it will block + if the key is currently searched for. + + This function will not search a key. Call update + to insert keys into the cache */ + GpgME::Key getByFpr (const char *fpr, bool block = true) const; + // Internal for thread void setSmimeKey(const std::string &mbox, const GpgME::Key &key); void setPgpKey(const std::string &mbox, const GpgME::Key &key); void setSmimeKeySecret(const std::string &mbox, const GpgME::Key &key); void setPgpKeySecret(const std::string &mbox, const GpgME::Key &key); + void onUpdateJobDone (const char *fpr, const GpgME::Key &key); private: commit 8d2a2acd2e1b3714d1f48fefac1510676a71c534 Author: Andre Heinecke Date: Tue Aug 28 12:10:18 2018 +0200 Fix confusing debug output * src/windowmessages.cpp (delayed_invalidate_ui): Print waiting before sleep, not after. diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index e3dfd45..e9ec1e5 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -460,15 +460,14 @@ delayed_invalidate_ui (LPVOID minsleep) int i = 0; while (invalidation_blocked) { - Sleep (100); i++; - if (i % 10 == 0) { log_debug ("%s:%s: Waiting for invalidation.", SRCNAME, __func__); } + Sleep (100); /* Do we need an abort statement here? */ } do_in_ui_thread (INVALIDATE_UI, nullptr); commit 14d33bbef22af1fc4c79329241d0b8b2dabae29f Author: Andre Heinecke Date: Thu Aug 23 09:21:41 2018 +0200 Change mime data log category * src/mimedataprovider.cpp: Change data logging from log_mime_parser to log_mime_data. diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp index 52c7834..e869cc5 100644 --- a/src/mimedataprovider.cpp +++ b/src/mimedataprovider.cpp @@ -561,18 +561,18 @@ MimeDataProvider::read(void *buffer, size_t size) log_mime_parser ("%s:%s: Reading: " SIZE_T_FORMAT "Bytes", SRCNAME, __func__, size); ssize_t bRead = m_crypto_data.read (buffer, size); - if (opt.enable_debug & DBG_MIME_PARSER && bRead) + if (opt.enable_debug & DBG_MIME_DATA && bRead) { std::string buf ((char *)buffer, bRead); if (!is_binary (buf)) { - log_mime_parser ("%s:%s: Data: \n------\n%s\n------", + log_mime_data ("%s:%s: Data: \n------\n%s\n------", SRCNAME, __func__, buf.c_str()); } else { - log_mime_parser ("%s:%s: Hex Data: \n------\n%s\n------", + log_mime_data ("%s:%s: Hex Data: \n------\n%s\n------", SRCNAME, __func__, string_to_hex (buf).c_str ()); } @@ -614,8 +614,8 @@ MimeDataProvider::collect_input_lines(const char *input, size_t insize) pos--; } - log_mime_parser("%s:%s: Parsing line=`%.*s'\n", - SRCNAME, __func__, (int)pos, linebuf); + log_mime_data ("%s:%s: Parsing line=`%.*s'\n", + SRCNAME, __func__, (int)pos, linebuf); /* Check the next state */ if (rfc822parse_insert (m_mime_ctx->msg, (unsigned char*) linebuf, @@ -653,7 +653,7 @@ MimeDataProvider::collect_input_lines(const char *input, size_t insize) { m_crypto_data.write ("\r\n", 2); } - log_mime_parser ("Writing raw crypto data: %.*s", + log_mime_data ("Writing raw crypto data: %.*s", (int)pos, linebuf); m_crypto_data.write (linebuf, pos); m_mime_ctx->collect_crypto_data = 2; commit 9e991ffe846625c7c61f6cd5b8dca32283ea44bc Author: Andre Heinecke Date: Wed Aug 22 13:33:11 2018 +0200 Ignore disable async crypto option * src/mail.cpp (Mail::isAsyncCryptDisabled): We assume that Async crypto is now stable. So ignore this option. -- We assume that T3838 is fixed. GnuPG-Bug-Id: T3838 diff --git a/src/mail.cpp b/src/mail.cpp index 26fa366..fb15b1b 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -3033,6 +3033,8 @@ Mail::setWindowEnabled_o (bool value) bool Mail::check_inline_response () { +#if 0 // Should be fixed + /* Async sending might lead to crashes when the send invocation is done. * For now we treat every mail as an inline response to disable async * encryption. :-( For more details see: T3838 */ @@ -3042,6 +3044,7 @@ Mail::check_inline_response () m_async_crypt_disabled = true; return m_async_crypt_disabled; } +#endif m_async_crypt_disabled = false; LPDISPATCH app = GpgolAddin::get_instance ()->get_application (); ----------------------------------------------------------------------- Summary of changes: src/keycache.cpp | 287 ++++++++++++++++++++++++++++++++++++++++++++++- src/keycache.h | 18 +++ src/mail.cpp | 18 ++- src/mimedataprovider.cpp | 12 +- src/parsecontroller.cpp | 35 +++++- src/windowmessages.cpp | 3 +- 6 files changed, 352 insertions(+), 21 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 12:40:34 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 28 Aug 2018 12:40:34 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-152-g94fd4b9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 94fd4b9a6868bd25f91c040565ca8b8a0f6454f9 (commit) from c9e39ec1bcc258a0208d2b9a2896c4ce415ac8df (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 94fd4b9a6868bd25f91c040565ca8b8a0f6454f9 Author: Andre Heinecke Date: Tue Aug 28 12:20:55 2018 +0200 Improve keycache performance a bit * src/keycache.cpp: Use unordered_map and set for better speed. diff --git a/src/keycache.cpp b/src/keycache.cpp index 95c27fe..58e7c67 100644 --- a/src/keycache.cpp +++ b/src/keycache.cpp @@ -31,7 +31,7 @@ #include -#include +#include #include #include @@ -483,9 +483,7 @@ public: int i = 0; gpgrt_lock_lock (&update_lock); - while (std::find (m_update_jobs.begin(), m_update_jobs.end(), - sFpr) - != m_update_jobs.end ()) + while (m_update_jobs.find(sFpr) != m_update_jobs.end ()) { i++; if (i % 100 == 0) @@ -539,15 +537,14 @@ public: } const std::string sFpr (fpr); gpgrt_lock_lock (&update_lock); - if (std::find (m_update_jobs.begin(), m_update_jobs.end(), sFpr) - != m_update_jobs.end ()) + if (m_update_jobs.find(sFpr) != m_update_jobs.end ()) { log_debug ("%s:%s Update for \"%s\" already in progress.", SRCNAME, __func__, fpr); gpgrt_lock_unlock (&update_lock); } - m_update_jobs.push_back (sFpr); + m_update_jobs.insert (sFpr); gpgrt_lock_unlock (&update_lock); update_arg_t * args = new update_arg_t; args->first = sFpr; @@ -565,11 +562,8 @@ public: } TRACEPOINT; insertOrUpdateInFprMap (key); - const std::string sFpr (fpr); gpgrt_lock_lock (&update_lock); - const auto it = std::find (m_update_jobs.begin(), - m_update_jobs.end(), - sFpr); + const auto it = m_update_jobs.find(fpr); if (it == m_update_jobs.end()) { @@ -584,13 +578,13 @@ public: return; } - std::map m_pgp_key_map; - std::map m_smime_key_map; - std::map m_pgp_skey_map; - std::map m_smime_skey_map; + std::unordered_map m_pgp_key_map; + std::unordered_map m_smime_key_map; + std::unordered_map m_pgp_skey_map; + std::unordered_map m_smime_skey_map; std::unordered_map m_fpr_map; std::unordered_map m_sub_fpr_map; - std::vector m_update_jobs; + std::set m_update_jobs; }; KeyCache::KeyCache(): ----------------------------------------------------------------------- Summary of changes: src/keycache.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 14:22:30 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 28 Aug 2018 14:22:30 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-154-g25f501f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 25f501f29ea2c1b617aaba0be747797fcc05dc16 (commit) via 4de0bb646fede9a94d72a1ec2893d32734860fe6 (commit) from 94fd4b9a6868bd25f91c040565ca8b8a0f6454f9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 25f501f29ea2c1b617aaba0be747797fcc05dc16 Author: Andre Heinecke Date: Tue Aug 28 14:22:25 2018 +0200 Update NEWS -- diff --git a/NEWS b/NEWS index 2825cc7..847889b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,18 @@ -Noteworthy changes for version 2.2.1 (unreleased) +Noteworthy changes for version 2.3.0 (unreleased) ================================================= + * Massive stability and performance improvements. + + * New configuration dialog. + + * New option to automatically encrypt if possible. + + * Moving mails is now possible. + + * Improvements to attachment handling with long filenames. + + * Support for contact Groups has been added. + Noteworthy changes for version 2.2.0 (2018-06-15) ================================================= commit 4de0bb646fede9a94d72a1ec2893d32734860fe6 Author: Andre Heinecke Date: Tue Aug 28 13:59:54 2018 +0200 Minor indentation fix -- diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp index 150668c..5a5d63d 100644 --- a/src/parsecontroller.cpp +++ b/src/parsecontroller.cpp @@ -499,8 +499,8 @@ ParseController::parse() if (opt.enable_debug) { - std::stringstream ss; - ss << m_decrypt_result << '\n' << m_verify_result; + std::stringstream ss; + ss << m_decrypt_result << '\n' << m_verify_result; for (const auto sig: m_verify_result.signatures()) { const auto key = sig.key(); ----------------------------------------------------------------------- Summary of changes: NEWS | 14 +++++++++++++- src/parsecontroller.cpp | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 15:34:00 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 28 Aug 2018 15:34:00 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-196-g7f17240 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 7f172404bfcf719b9b1af4a182d4803525ebff7c (commit) via db67ccb759426c1173761574b14bdfe6a76394c2 (commit) from 108702ccae8ff1e5fec3b8e710f06a03637244c7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7f172404bfcf719b9b1af4a182d4803525ebff7c Author: Werner Koch Date: Tue Aug 28 15:22:35 2018 +0200 gpg: Refresh expired keys originating from the WKD. * g10/getkey.c (getkey_ctx_s): New field found_via_akl. (get_pubkey_byname): Set it. (only_expired_enc_subkeys): New. (get_best_pubkey_byname): Add support to refresh expired keys from the WKD. -- A little drawback of that code is that if the WKD has no update for an expired key each access of the key will trigger a WKD lookup (unless cached by the dirmngr). To avoid this we need to record the last time we have checked for an update but that would in turn require that we update the keyring for each check. We defer this until we have a better key database which allows for fast updates of meta data. Testing the code is currently a bit cumbersome because it requires to update a key in the WKD several times. Eventually we we need a network emulation layer to provide sample data for the regression tests. GnuPG-bug-id: 2917 Signed-off-by: Werner Koch diff --git a/g10/getkey.c b/g10/getkey.c index b0ee10e..b8fdb0c 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -88,6 +88,9 @@ struct getkey_ctx_s their address used in ITEMS. */ strlist_t extra_list; + /* Hack to return the mechanism (AKL_foo) used to find the key. */ + int found_via_akl; + /* Part of the search criteria: The low-level search specification as passed to keydb_search. */ int nitems; @@ -1265,6 +1268,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, int is_mbox; int nodefault = 0; int anylocalfirst = 0; + int mechanism_type = AKL_NODEFAULT; /* If RETCTX is not NULL, then RET_KDBHD must be NULL. */ log_assert (retctx == NULL || ret_kdbhd == NULL); @@ -1354,18 +1358,19 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, size_t fpr_len; int did_akl_local = 0; int no_fingerprint = 0; - const char *mechanism = "?"; + const char *mechanism_string = "?"; - switch (akl->type) + mechanism_type = akl->type; + switch (mechanism_type) { case AKL_NODEFAULT: /* This is a dummy mechanism. */ - mechanism = "None"; + mechanism_string = "None"; rc = GPG_ERR_NO_PUBKEY; break; case AKL_LOCAL: - mechanism = "Local"; + mechanism_string = "Local"; did_akl_local = 1; if (retctx) { @@ -1379,35 +1384,35 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, break; case AKL_CERT: - mechanism = "DNS CERT"; + mechanism_string = "DNS CERT"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_cert (ctrl, name, 0, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; break; case AKL_PKA: - mechanism = "PKA"; + mechanism_string = "PKA"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_pka (ctrl, name, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; break; case AKL_DANE: - mechanism = "DANE"; + mechanism_string = "DANE"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_cert (ctrl, name, 1, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; break; case AKL_WKD: - mechanism = "WKD"; + mechanism_string = "WKD"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_wkd (ctrl, name, 0, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; break; case AKL_LDAP: - mechanism = "LDAP"; + mechanism_string = "LDAP"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_ldap (ctrl, name, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; @@ -1420,7 +1425,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, * and getting a whole lot of keys back. */ if (keyserver_any_configured (ctrl)) { - mechanism = "keyserver"; + mechanism_string = "keyserver"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_name (ctrl, name, &fpr, &fpr_len, opt.keyserver); @@ -1428,7 +1433,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, } else { - mechanism = "Unconfigured keyserver"; + mechanism_string = "Unconfigured keyserver"; rc = GPG_ERR_NO_PUBKEY; } break; @@ -1437,7 +1442,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, { struct keyserver_spec *keyserver; - mechanism = akl->spec->uri; + mechanism_string = akl->spec->uri; keyserver = keyserver_match (akl->spec); glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_name (ctrl, @@ -1499,13 +1504,13 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, /* Key found. */ if (opt.verbose) log_info (_("automatically retrieved '%s' via %s\n"), - name, mechanism); + name, mechanism_string); break; } if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY || opt.verbose || no_fingerprint) log_info (_("error retrieving '%s' via %s: %s\n"), - name, mechanism, + name, mechanism_string, no_fingerprint ? _("No fingerprint") : gpg_strerror (rc)); } } @@ -1521,6 +1526,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, { log_assert (!(*retctx)->extra_list); (*retctx)->extra_list = namelist; + (*retctx)->found_via_akl = mechanism_type; } else free_strlist (namelist); @@ -1568,6 +1574,34 @@ subkey_is_ok (const PKT_public_key *sub) return ! sub->flags.revoked && sub->flags.valid && ! sub->flags.disabled; } +/* Return true if KEYBLOCK has only expired encryption subkyes. Note + * that the function returns false if the key has no encryption + * subkeys at all or the subkecys are revoked. */ +static int +only_expired_enc_subkeys (kbnode_t keyblock) +{ + kbnode_t node; + PKT_public_key *sub; + int any = 0; + + for (node = find_next_kbnode (keyblock, PKT_PUBLIC_SUBKEY); + node; node = find_next_kbnode (node, PKT_PUBLIC_SUBKEY)) + { + sub = node->pkt->pkt.public_key; + + if (!(sub->pubkey_usage & PUBKEY_USAGE_ENC)) + continue; + + if (!subkey_is_ok (sub)) + continue; + + any = 1; + if (!sub->has_expired) + return 0; + } + + return any? 1 : 0; +} /* Finally this function compares a NEW key to the former candidate * OLD. Returns < 0 if the old key is worse, > 0 if the old key is @@ -1640,10 +1674,23 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, { gpg_error_t err; struct getkey_ctx_s *ctx = NULL; + int is_mbox = is_valid_mailbox (name); + int wkd_tried = 0; if (retctx) *retctx = NULL; + start_over: + if (ctx) /* Clear in case of a start over. */ + { + if (ret_keyblock) + { + release_kbnode (*ret_keyblock); + *ret_keyblock = NULL; + } + getkey_end (ctrl, ctx); + ctx = NULL; + } err = get_pubkey_byname (ctrl, &ctx, pk, name, ret_keyblock, NULL, include_unusable, 0); if (err) @@ -1652,7 +1699,39 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, return err; } - if (is_valid_mailbox (name) && ctx) + /* If the keyblock was retrieved from the local database and the key + * has expired, do further checks. However, we can do this only if + * the caller requested a keyblock. */ + if (is_mbox && ctx && ctx->found_via_akl == AKL_LOCAL && ret_keyblock) + { + u32 now = make_timestamp (); + PKT_public_key *pk2 = (*ret_keyblock)->pkt->pkt.public_key; + int found; + + /* If the key has expired and its origin was the WKD then try to + * get a fresh key from the WKD. We also try this if the key + * has any only expired encryption subkeys. In case we checked + * for a fresh copy in the last 3 hours we won't do that again. + * Unfortunately that does not yet work because KEYUPDATE is + * only updated during import iff the key has actually changed + * (see import.c:import_one). */ + if (!wkd_tried && pk2->keyorg == KEYORG_WKD + && (pk2->keyupdate + 3*3600) < now + && (pk2->has_expired || only_expired_enc_subkeys (*ret_keyblock))) + { + if (opt.verbose) + log_info (_("checking for a fresh copy of an expired key via %s\n"), + "WKD"); + wkd_tried = 1; + glo_ctrl.in_auto_key_retrieve++; + found = !keyserver_import_wkd (ctrl, name, 0, NULL, NULL); + glo_ctrl.in_auto_key_retrieve--; + if (found) + goto start_over; + } + } + + if (is_mbox && ctx) { /* Rank results and return only the most relevant key. */ struct pubkey_cmp_cookie best = { 0 }; diff --git a/g10/import.c b/g10/import.c index 1eb3ecc..73f795c 100644 --- a/g10/import.c +++ b/g10/import.c @@ -2088,9 +2088,12 @@ import_one (ctrl_t ctrl, keydb_release (hd); hd = NULL; - /* Fixme: we do not track the time we last checked a key for + /* FIXME: We do not track the time we last checked a key for * updates. To do this we would need to rewrite even the - * keys which have no changes. */ + * keys which have no changes. Adding this would be useful + * for the automatic update of expired keys via the WKD in + * case the WKD still carries the expired key. See + * get_best_pubkey_byname. */ same_key = 1; if (is_status_enabled ()) print_import_ok (pk, 0); commit db67ccb759426c1173761574b14bdfe6a76394c2 Author: Werner Koch Date: Tue Aug 28 15:11:10 2018 +0200 gpg: Remove unused arg from a function. * g10/getkey.c (get_best_pubkey_byname): Remove unused arg 'no_akl'. Change both callers. Signed-off-by: Werner Koch diff --git a/g10/getkey.c b/g10/getkey.c index 41afeb9..b0ee10e 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1636,7 +1636,7 @@ pubkey_cmp (ctrl_t ctrl, const char *name, struct pubkey_cmp_cookie *old, gpg_error_t get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, - int include_unusable, int no_akl) + int include_unusable) { gpg_error_t err; struct getkey_ctx_s *ctx = NULL; @@ -1645,7 +1645,7 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, *retctx = NULL; err = get_pubkey_byname (ctrl, &ctx, pk, name, ret_keyblock, - NULL, include_unusable, no_akl); + NULL, include_unusable, 0); if (err) { getkey_end (ctrl, ctx); diff --git a/g10/keydb.h b/g10/keydb.h index 9748e57..5ab0d58 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -368,7 +368,7 @@ int get_pubkey_byname (ctrl_t ctrl, gpg_error_t get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, - int include_unusable, int no_akl); + int include_unusable); /* Get a public key directly from file FNAME. */ gpg_error_t get_pubkey_fromfile (ctrl_t ctrl, diff --git a/g10/keylist.c b/g10/keylist.c index 39b87e4..8b7da76 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -653,7 +653,7 @@ locate_one (ctrl_t ctrl, strlist_t names) for (sl = names; sl; sl = sl->next) { - rc = get_best_pubkey_byname (ctrl, &ctx, NULL, sl->d, &keyblock, 1, 0); + rc = get_best_pubkey_byname (ctrl, &ctx, NULL, sl->d, &keyblock, 1); if (rc) { if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY) diff --git a/g10/pkclist.c b/g10/pkclist.c index e748443..46258bf 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -834,7 +834,7 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use, if (from_file) rc = get_pubkey_fromfile (ctrl, pk, name); else - rc = get_best_pubkey_byname (ctrl, NULL, pk, name, &keyblock, 0, 0); + rc = get_best_pubkey_byname (ctrl, NULL, pk, name, &keyblock, 0); if (rc) { int code; ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++--------- g10/import.c | 7 ++-- g10/keydb.h | 2 +- g10/keylist.c | 2 +- g10/pkclist.c | 2 +- 5 files changed, 104 insertions(+), 22 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 15:37:43 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 28 Aug 2018 15:37:43 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-9-g0709f35 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 0709f358cd13abc82e0f97f055fcaa712f0fd44f (commit) via 11a9fe1c5820b97d7e0f4b3e91f016df9dc466a9 (commit) from 0786ac78423c7c05b2d373f34fcf3316f94198a7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0709f358cd13abc82e0f97f055fcaa712f0fd44f Author: Werner Koch Date: Tue Aug 28 15:22:35 2018 +0200 gpg: Refresh expired keys originating from the WKD. * g10/getkey.c (getkey_ctx_s): New field found_via_akl. (get_pubkey_byname): Set it. (only_expired_enc_subkeys): New. (get_best_pubkey_byname): Add support to refresh expired keys from the WKD. -- A little drawback of that code is that if the WKD has no update for an expired key each access of the key will trigger a WKD lookup (unless cached by the dirmngr). To avoid this we need to record the last time we have checked for an update but that would in turn require that we update the keyring for each check. We defer this until we have a better key database which allows for fast updates of meta data. Testing the code is currently a bit cumbersome because it requires to update a key in the WKD several times. Eventually we we need a network emulation layer to provide sample data for the regression tests. GnuPG-bug-id: 2917 Signed-off-by: Werner Koch (cherry picked from commit 7f172404bfcf719b9b1af4a182d4803525ebff7c) diff --git a/g10/getkey.c b/g10/getkey.c index e8722a3..be81d99 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -88,6 +88,9 @@ struct getkey_ctx_s their address used in ITEMS. */ strlist_t extra_list; + /* Hack to return the mechanism (AKL_foo) used to find the key. */ + int found_via_akl; + /* Part of the search criteria: The low-level search specification as passed to keydb_search. */ int nitems; @@ -1265,6 +1268,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, int is_mbox; int nodefault = 0; int anylocalfirst = 0; + int mechanism_type = AKL_NODEFAULT; /* If RETCTX is not NULL, then RET_KDBHD must be NULL. */ log_assert (retctx == NULL || ret_kdbhd == NULL); @@ -1354,18 +1358,19 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, size_t fpr_len; int did_akl_local = 0; int no_fingerprint = 0; - const char *mechanism = "?"; + const char *mechanism_string = "?"; - switch (akl->type) + mechanism_type = akl->type; + switch (mechanism_type) { case AKL_NODEFAULT: /* This is a dummy mechanism. */ - mechanism = "None"; + mechanism_string = "None"; rc = GPG_ERR_NO_PUBKEY; break; case AKL_LOCAL: - mechanism = "Local"; + mechanism_string = "Local"; did_akl_local = 1; if (retctx) { @@ -1379,35 +1384,35 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, break; case AKL_CERT: - mechanism = "DNS CERT"; + mechanism_string = "DNS CERT"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_cert (ctrl, name, 0, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; break; case AKL_PKA: - mechanism = "PKA"; + mechanism_string = "PKA"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_pka (ctrl, name, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; break; case AKL_DANE: - mechanism = "DANE"; + mechanism_string = "DANE"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_cert (ctrl, name, 1, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; break; case AKL_WKD: - mechanism = "WKD"; + mechanism_string = "WKD"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_wkd (ctrl, name, 0, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; break; case AKL_LDAP: - mechanism = "LDAP"; + mechanism_string = "LDAP"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_ldap (ctrl, name, &fpr, &fpr_len); glo_ctrl.in_auto_key_retrieve--; @@ -1420,7 +1425,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, * and getting a whole lot of keys back. */ if (keyserver_any_configured (ctrl)) { - mechanism = "keyserver"; + mechanism_string = "keyserver"; glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_name (ctrl, name, &fpr, &fpr_len, opt.keyserver); @@ -1428,7 +1433,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, } else { - mechanism = "Unconfigured keyserver"; + mechanism_string = "Unconfigured keyserver"; rc = GPG_ERR_NO_PUBKEY; } break; @@ -1437,7 +1442,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, { struct keyserver_spec *keyserver; - mechanism = akl->spec->uri; + mechanism_string = akl->spec->uri; keyserver = keyserver_match (akl->spec); glo_ctrl.in_auto_key_retrieve++; rc = keyserver_import_name (ctrl, @@ -1499,13 +1504,13 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, /* Key found. */ if (opt.verbose) log_info (_("automatically retrieved '%s' via %s\n"), - name, mechanism); + name, mechanism_string); break; } if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY || opt.verbose || no_fingerprint) log_info (_("error retrieving '%s' via %s: %s\n"), - name, mechanism, + name, mechanism_string, no_fingerprint ? _("No fingerprint") : gpg_strerror (rc)); } } @@ -1521,6 +1526,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, { log_assert (!(*retctx)->extra_list); (*retctx)->extra_list = namelist; + (*retctx)->found_via_akl = mechanism_type; } else free_strlist (namelist); @@ -1568,6 +1574,34 @@ subkey_is_ok (const PKT_public_key *sub) return ! sub->flags.revoked && sub->flags.valid && ! sub->flags.disabled; } +/* Return true if KEYBLOCK has only expired encryption subkyes. Note + * that the function returns false if the key has no encryption + * subkeys at all or the subkecys are revoked. */ +static int +only_expired_enc_subkeys (kbnode_t keyblock) +{ + kbnode_t node; + PKT_public_key *sub; + int any = 0; + + for (node = find_next_kbnode (keyblock, PKT_PUBLIC_SUBKEY); + node; node = find_next_kbnode (node, PKT_PUBLIC_SUBKEY)) + { + sub = node->pkt->pkt.public_key; + + if (!(sub->pubkey_usage & PUBKEY_USAGE_ENC)) + continue; + + if (!subkey_is_ok (sub)) + continue; + + any = 1; + if (!sub->has_expired) + return 0; + } + + return any? 1 : 0; +} /* Finally this function compares a NEW key to the former candidate * OLD. Returns < 0 if the old key is worse, > 0 if the old key is @@ -1640,10 +1674,23 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, { gpg_error_t err; struct getkey_ctx_s *ctx = NULL; + int is_mbox = is_valid_mailbox (name); + int wkd_tried = 0; if (retctx) *retctx = NULL; + start_over: + if (ctx) /* Clear in case of a start over. */ + { + if (ret_keyblock) + { + release_kbnode (*ret_keyblock); + *ret_keyblock = NULL; + } + getkey_end (ctrl, ctx); + ctx = NULL; + } err = get_pubkey_byname (ctrl, &ctx, pk, name, ret_keyblock, NULL, include_unusable, 0); if (err) @@ -1652,7 +1699,39 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, return err; } - if (is_valid_mailbox (name) && ctx) + /* If the keyblock was retrieved from the local database and the key + * has expired, do further checks. However, we can do this only if + * the caller requested a keyblock. */ + if (is_mbox && ctx && ctx->found_via_akl == AKL_LOCAL && ret_keyblock) + { + u32 now = make_timestamp (); + PKT_public_key *pk2 = (*ret_keyblock)->pkt->pkt.public_key; + int found; + + /* If the key has expired and its origin was the WKD then try to + * get a fresh key from the WKD. We also try this if the key + * has any only expired encryption subkeys. In case we checked + * for a fresh copy in the last 3 hours we won't do that again. + * Unfortunately that does not yet work because KEYUPDATE is + * only updated during import iff the key has actually changed + * (see import.c:import_one). */ + if (!wkd_tried && pk2->keyorg == KEYORG_WKD + && (pk2->keyupdate + 3*3600) < now + && (pk2->has_expired || only_expired_enc_subkeys (*ret_keyblock))) + { + if (opt.verbose) + log_info (_("checking for a fresh copy of an expired key via %s\n"), + "WKD"); + wkd_tried = 1; + glo_ctrl.in_auto_key_retrieve++; + found = !keyserver_import_wkd (ctrl, name, 0, NULL, NULL); + glo_ctrl.in_auto_key_retrieve--; + if (found) + goto start_over; + } + } + + if (is_mbox && ctx) { /* Rank results and return only the most relevant key. */ struct pubkey_cmp_cookie best = { 0 }; diff --git a/g10/import.c b/g10/import.c index 6dad8ee..11de592 100644 --- a/g10/import.c +++ b/g10/import.c @@ -2070,9 +2070,12 @@ import_one (ctrl_t ctrl, keydb_release (hd); hd = NULL; - /* Fixme: we do not track the time we last checked a key for + /* FIXME: We do not track the time we last checked a key for * updates. To do this we would need to rewrite even the - * keys which have no changes. */ + * keys which have no changes. Adding this would be useful + * for the automatic update of expired keys via the WKD in + * case the WKD still carries the expired key. See + * get_best_pubkey_byname. */ same_key = 1; if (is_status_enabled ()) print_import_ok (pk, 0); commit 11a9fe1c5820b97d7e0f4b3e91f016df9dc466a9 Author: Werner Koch Date: Tue Aug 28 15:11:10 2018 +0200 gpg: Remove unused arg from a function. * g10/getkey.c (get_best_pubkey_byname): Remove unused arg 'no_akl'. Change both callers. Signed-off-by: Werner Koch (cherry picked from commit db67ccb759426c1173761574b14bdfe6a76394c2) diff --git a/g10/getkey.c b/g10/getkey.c index d76e7cc..e8722a3 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1636,7 +1636,7 @@ pubkey_cmp (ctrl_t ctrl, const char *name, struct pubkey_cmp_cookie *old, gpg_error_t get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, - int include_unusable, int no_akl) + int include_unusable) { gpg_error_t err; struct getkey_ctx_s *ctx = NULL; @@ -1645,7 +1645,7 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, *retctx = NULL; err = get_pubkey_byname (ctrl, &ctx, pk, name, ret_keyblock, - NULL, include_unusable, no_akl); + NULL, include_unusable, 0); if (err) { getkey_end (ctrl, ctx); diff --git a/g10/keydb.h b/g10/keydb.h index 8e1a724..7cd628d 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -367,7 +367,7 @@ int get_pubkey_byname (ctrl_t ctrl, gpg_error_t get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, - int include_unusable, int no_akl); + int include_unusable); /* Get a public key directly from file FNAME. */ gpg_error_t get_pubkey_fromfile (ctrl_t ctrl, diff --git a/g10/keylist.c b/g10/keylist.c index c9121a1..7942558 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -652,7 +652,7 @@ locate_one (ctrl_t ctrl, strlist_t names) for (sl = names; sl; sl = sl->next) { - rc = get_best_pubkey_byname (ctrl, &ctx, NULL, sl->d, &keyblock, 1, 0); + rc = get_best_pubkey_byname (ctrl, &ctx, NULL, sl->d, &keyblock, 1); if (rc) { if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY) diff --git a/g10/pkclist.c b/g10/pkclist.c index 6f04249..56c9385 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -834,7 +834,7 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use, if (from_file) rc = get_pubkey_fromfile (ctrl, pk, name); else - rc = get_best_pubkey_byname (ctrl, NULL, pk, name, &keyblock, 0, 0); + rc = get_best_pubkey_byname (ctrl, NULL, pk, name, &keyblock, 0); if (rc) { int code; ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++--------- g10/import.c | 7 ++-- g10/keydb.h | 2 +- g10/keylist.c | 2 +- g10/pkclist.c | 2 +- 5 files changed, 104 insertions(+), 22 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 17:02:32 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 28 Aug 2018 17:02:32 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-12-g38eb7c3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 38eb7c360bc4867cbaf37e3c2c0865bc6452ba4a (commit) via 1189df2cd7d4b6896ba22aa204c159ff2a425ead (commit) via a22a55b994e06dd06157fbdabf5a402d8daf69c2 (commit) from 0709f358cd13abc82e0f97f055fcaa712f0fd44f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 38eb7c360bc4867cbaf37e3c2c0865bc6452ba4a Author: Werner Koch Date: Wed Nov 15 15:30:21 2017 +0100 assuan: Fix exponential decay for first second. * common/asshelp.c (wait_for_sock): Round SECSLEFT. * dirmngr/dirmngr.c (main): Take care of --debug-wait also in dameon mode. * common/sysutils.c (gnupg_usleep) [HAVE_NANOSLEEP]: Fix nanosleep use. -- Without the rounding we saw in verbose mose [...]to come up ... (5s) [...]to come up ... (4s) immediately without the expected one second delay. Waiting for the next seconds did not work if nanosleep was used due to improper passed parameters in gnupg_usleep. Adding --debug-wait for dirmngr in daemon mode is required to test this change. GnuPG-bug-id: 3490 Signed-off-by: Werner Koch (cherry picked from commit 0cfdd3b57d592fb6baa7dafe8fde124e8a6c7798) Fixes-commit: 1189df2cd7d4b6896ba22aa204c159ff2a425ead Signed-off-by: Werner Koch diff --git a/common/asshelp.c b/common/asshelp.c index 76f812d..d87017e 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -326,7 +326,10 @@ wait_for_sock (int secs, const char *name, const char *sockname, int verbose, as { if (verbose) { - secsleft = (target_us - elapsed_us)/1000000; + secsleft = (target_us - elapsed_us + 999999)/1000000; + /* log_clock ("left=%d last=%d targ=%d elap=%d next=%d\n", */ + /* secsleft, lastalert, target_us, elapsed_us, */ + /* next_sleep_us); */ if (secsleft < lastalert) { log_info (_("waiting for the %s to come up ... (%ds)\n"), diff --git a/common/sysutils.c b/common/sysutils.c index e90010c..55a7ee9 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -340,11 +340,10 @@ gnupg_usleep (unsigned int usecs) struct timespec req; struct timespec rem; - req.tv_sec = 0; - req.tv_nsec = usecs * 1000; - + req.tv_sec = usecs / 1000000; + req.tv_nsec = (usecs % 1000000) * 1000; while (nanosleep (&req, &rem) < 0 && errno == EINTR) - req = rem; + req = rem; } #else /*Standard Unix*/ diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 31f8e0f..5965f84 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -1203,6 +1203,14 @@ main (int argc, char **argv) current_logfile = xstrdup (logfile); } + if (debug_wait) + { + log_debug ("waiting for debugger - my pid is %u .....\n", + (unsigned int)getpid()); + gnupg_sleep (debug_wait); + log_debug ("... okay\n"); + } + #ifndef HAVE_W32_SYSTEM if (strchr (socket_name, ':')) { commit 1189df2cd7d4b6896ba22aa204c159ff2a425ead Author: Daniel Kahn Gillmor Date: Wed Nov 8 16:26:40 2017 +0100 assuan: Use exponential decay for first 1s of spinlock. * common/asshelp.c (wait_for_sock): instead of checking the socket every second, we check 10 times in the first second (with exponential decay). -- This cuts the wall clock time for the standard test suite roughly by half. GnuPG-bug-id: 3490 Signed-off-by: Daniel Kahn Gillmor (cherry picked from commit 149041b0b917f4298239fe18b5ebd5ead71584a6) diff --git a/common/asshelp.c b/common/asshelp.c index 68a41be..76f812d 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -310,14 +310,32 @@ unlock_spawning (lock_spawn_t *lock, const char *name) static gpg_error_t wait_for_sock (int secs, const char *name, const char *sockname, int verbose, assuan_context_t ctx, int *did_success_msg) { - int i; gpg_error_t err = 0; - for (i=0; i < secs; i++) + int target_us = secs * 1000000; + int elapsed_us = 0; + /* + * 977us * 1024 = just a little more than 1s. + * so we will double this timeout 10 times in the first + * second, and then switch over to 1s checkins. + */ + int next_sleep_us = 977; + int lastalert = secs+1; + int secsleft; + + while (elapsed_us < target_us) { if (verbose) - log_info (_("waiting for the %s to come up ... (%ds)\n"), - name, secs - i); - gnupg_sleep (1); + { + secsleft = (target_us - elapsed_us)/1000000; + if (secsleft < lastalert) + { + log_info (_("waiting for the %s to come up ... (%ds)\n"), + name, secsleft); + lastalert = secsleft; + } + } + gnupg_usleep (next_sleep_us); + elapsed_us += next_sleep_us; err = assuan_socket_connect (ctx, sockname, 0, 0); if (!err) { @@ -329,6 +347,9 @@ wait_for_sock (int secs, const char *name, const char *sockname, int verbose, as } break; } + next_sleep_us *= 2; + if (next_sleep_us > 1000000) + next_sleep_us = 1000000; } return err; } commit a22a55b994e06dd06157fbdabf5a402d8daf69c2 Author: Daniel Kahn Gillmor Date: Wed Nov 8 16:15:30 2017 +0100 assuan: Reorganize waiting for socket. * common/asshelp.c (wait_for_sock): New function, collecting codepaths from... (start_new_gpg_agent) here and... (start_new_dirmngr) here. -- This has no functional change, but makes it easier to make this function more efficient. GnuPG-bug-id: 3490 Signed-off-by: Daniel Kahn Gillmor (cherry picked from commit 0471ff9d3bf8d6b9a359f3c426d70d0935066907) diff --git a/common/asshelp.c b/common/asshelp.c index f3a92f9..68a41be 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -307,6 +307,32 @@ unlock_spawning (lock_spawn_t *lock, const char *name) } } +static gpg_error_t +wait_for_sock (int secs, const char *name, const char *sockname, int verbose, assuan_context_t ctx, int *did_success_msg) +{ + int i; + gpg_error_t err = 0; + for (i=0; i < secs; i++) + { + if (verbose) + log_info (_("waiting for the %s to come up ... (%ds)\n"), + name, secs - i); + gnupg_sleep (1); + err = assuan_socket_connect (ctx, sockname, 0, 0); + if (!err) + { + if (verbose) + { + log_info (_("connection to %s established\n"), + name); + *did_success_msg = 1; + } + break; + } + } + return err; +} + /* Try to connect to the agent via socket or start it if it is not running and AUTOSTART is set. Handle the server's initial greeting. Returns a new assuan context at R_CTX or an error @@ -433,25 +459,8 @@ start_new_gpg_agent (assuan_context_t *r_ctx, log_error ("failed to start agent '%s': %s\n", agent_program, gpg_strerror (err)); else - { - for (i=0; i < SECS_TO_WAIT_FOR_AGENT; i++) - { - if (verbose) - log_info (_("waiting for the agent to come up ... (%ds)\n"), - SECS_TO_WAIT_FOR_AGENT - i); - gnupg_sleep (1); - err = assuan_socket_connect (ctx, sockname, 0, 0); - if (!err) - { - if (verbose) - { - log_info (_("connection to agent established\n")); - did_success_msg = 1; - } - break; - } - } - } + err = wait_for_sock (SECS_TO_WAIT_FOR_AGENT, "agent", + sockname, verbose, ctx, &did_success_msg); } unlock_spawning (&lock, "agent"); @@ -584,29 +593,8 @@ start_new_dirmngr (assuan_context_t *r_ctx, log_error ("failed to start the dirmngr '%s': %s\n", dirmngr_program, gpg_strerror (err)); else - { - int i; - - for (i=0; i < SECS_TO_WAIT_FOR_DIRMNGR; i++) - { - if (verbose) - log_info (_("waiting for the dirmngr " - "to come up ... (%ds)\n"), - SECS_TO_WAIT_FOR_DIRMNGR - i); - gnupg_sleep (1); - err = assuan_socket_connect (ctx, sockname, 0, 0); - if (!err) - { - if (verbose) - { - log_info (_("connection to the dirmngr" - " established\n")); - did_success_msg = 1; - } - break; - } - } - } + err = wait_for_sock (SECS_TO_WAIT_FOR_DIRMNGR, "dirmngr", + sockname, verbose, ctx, &did_success_msg); } unlock_spawning (&lock, "dirmngr"); ----------------------------------------------------------------------- Summary of changes: common/asshelp.c | 96 +++++++++++++++++++++++++++++++------------------------ common/sysutils.c | 7 ++-- dirmngr/dirmngr.c | 8 +++++ 3 files changed, 65 insertions(+), 46 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 17:53:49 2018 From: cvs at cvs.gnupg.org (by Ineiev) Date: Tue, 28 Aug 2018 17:53:49 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-13-gb02ad56 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via b02ad56a9041273df58ded4cc70cf5ffa9e58c16 (commit) from 38eb7c360bc4867cbaf37e3c2c0865bc6452ba4a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b02ad56a9041273df58ded4cc70cf5ffa9e58c16 Author: Ineiev Date: Sat Jul 14 07:44:22 2018 +0000 po: Update Russian translation. diff --git a/po/ru.po b/po/ru.po index 893a782..8a8c3eb 100644 --- a/po/ru.po +++ b/po/ru.po @@ -4,14 +4,14 @@ # !-- no such user (2011-01-11) # Thanks Pawel I. Shajdo . # Thanks Cmecb for the inspiration. -# Ineiev , 2014, 2015, 2016, 2017 +# Ineiev , 2014, 2015, 2016, 2017, 2018 # # Designated-Translator: none msgid "" msgstr "" "Project-Id-Version: GnuPG 2.2.0\n" "Report-Msgid-Bugs-To: translations at gnupg.org\n" -"PO-Revision-Date: 2018-05-05 17:41+0100\n" +"PO-Revision-Date: 2018-07-14 17:41+0100\n" "Last-Translator: Ineiev \n" "Language-Team: Russian \n" "Language: ru\n" @@ -4501,15 +4501,17 @@ msgid "" "likely that this message is legitimate. This is because back\n" "then integrity protection was not widely used.\n" msgstr "" +"?????????: ???? ??? ????????? ??????? ?? 2003 ????, ????????, ???\n" +"??? ??????????, ????????? ? ?? ??????? ?????? ??????????? ??????\n" +"?? ???????????.\n" #, c-format msgid "Use the option '%s' to decrypt anyway.\n" -msgstr "" +msgstr "?????????????? ?????????? '%s', ????? ??? ?? ????? ????????????.\n" -#, fuzzy, c-format -#| msgid "decryption failed: %s\n" +#, c-format msgid "decryption forced to fail!\n" -msgstr "???? ???????????: %s\n" +msgstr "?????????????? ???? ???????????!\n" #, c-format msgid "decryption okay\n" @@ -5390,12 +5392,11 @@ msgstr "?????????: ???? ??? ???????? %s ???????\n #, c-format msgid "bad key signature from key %s: %s (0x%02x, 0x%x)\n" -msgstr "?????? ??????? ?????? %s: %s (0x%02x 0x%x)\n" +msgstr "?????? ??????? ????? ?????? %s: %s (0x%02x 0x%x)\n" -#, fuzzy, c-format -#| msgid "bad key signature from key %s: %s (0x%02x, 0x%x)\n" +#, c-format msgid "bad data signature from key %s: %s (0x%02x, 0x%x)\n" -msgstr "?????? ??????? ?????? %s: %s (0x%02x 0x%x)\n" +msgstr "?????? ??????? ?????? ?????? %s: %s (0x%02x 0x%x)\n" #, c-format msgid "assuming bad signature from key %s due to an unknown critical bit\n" ----------------------------------------------------------------------- Summary of changes: po/ru.po | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Aug 28 20:17:44 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Tue, 28 Aug 2018 20:17:44 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-252-g16e566f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 16e566f319004d49f55197238380cc4c03e01f48 (commit) via 02d0b97bfedc732351cc4e89c92fcd9d31209535 (commit) via a8a983c5bc0f0deeeebda455ad73309fff48b61f (commit) via c2831e2377843c8625df158ef32e01f8c19494eb (commit) via 1c261b9fa3462360b6c3f43b243091cd50534903 (commit) from 3bdf8be6d2c57319399fe14e27e52b323a17750a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 16e566f319004d49f55197238380cc4c03e01f48 Merge: 02d0b97 3bdf8be Author: Ben McGinnes Date: Wed Aug 29 04:16:37 2018 +1000 Merge branch 'master' of ssh+git://playfair.gnupg.org/git/gpgme commit 02d0b97bfedc732351cc4e89c92fcd9d31209535 Author: Ben McGinnes Date: Wed Aug 29 04:14:24 2018 +1000 docs: python bindings HOWTO * Finished CFFI vs SWIG bit in known issues. * tidied up some of the structure. * Fixed some minor errors and links. diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org index ffe5034..84ba6a3 100644 --- a/lang/python/docs/GPGMEpythonHOWTOen.org +++ b/lang/python/docs/GPGMEpythonHOWTOen.org @@ -15,7 +15,7 @@ :CUSTOM_ID: intro :END: -| Version: | 0.1.3 | +| Version: | 0.1.4 | | Author: | Ben McGinnes | | Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E2373590E5D | | Language: | Australian English, British English | @@ -207,6 +207,9 @@ include a package in PyPI which actually built correctly would require either statically built libraries for every architecture bundled with it or a full implementation of C for each architecture. +See the additional notes regarding CFFI and SWIG at the end of this +section for further details. + ** Requirements :PROPERTIES: @@ -217,7 +220,7 @@ The GPGME Python bindings only have three requirements: 1. A suitable version of Python 2 or Python 3. With Python 2 that means Python 2.7 and with Python 3 that means Python 3.4 or higher. -2. [[https://www.swig.org][SWIG]].. +2. [[https://www.swig.org][SWIG]]. 3. GPGME itself. Which also means that all of GPGME's dependencies must be installed too. @@ -243,7 +246,7 @@ For Python 2 it checks for these executables in this order: =python=, =python2= and =python2.7=. For Python 3 it checks for these executables in this order: =python3=, -=python3.6=, =python3.5=, =python3.4= and =python3.7=.[fn:4] +=python3.6=, =python3.5=, =python3.4= and =python3.7=.[fn:3] *** Installing GPGME @@ -290,7 +293,7 @@ build directory missing a lot of expected files. Even when this occurs, the solution is actually quite simple and will always work. That solution is simply to run the following commands as either the -*root* user or prepended with =sudo -H=[fn:5] in the =lang/python/= +*root* user or prepended with =sudo -H=[fn:4] in the =lang/python/= directory: #+BEGIN_SRC shell @@ -398,7 +401,7 @@ ongoing. :CUSTOM_ID: snafu-foad :END: -There are many reasons for favouring CFFI and proponents of it are +There are many reasons for favouring [[https://cffi.readthedocs.io/en/latest/overview.html][CFFI]] and proponents of it are quite happy to repeat these things as if all it would take to switch from SWIG to CFFI is repeating that list as if it were a new concept. @@ -421,6 +424,14 @@ project to switch to CFFI then rather than just insisting that it should, I'd suggest you volunteer to bring CFFI up to the level this project needs. +If you're actually seriously considering doing so, then I'd suggest +taking the =gpgme-tool.c= file in the GPGME =src/= directory and +getting that to work with any of the CFFI API methods (not the ABI +methods, they'll work with pretty much anything). When you start +running into trouble with "ifdefs" then you'll know what sort of +things are lacking. That doesn't even take into account the amount of +work saved via SWIG's code generation techniques either. + * Fundamentals :PROPERTIES: @@ -1167,7 +1178,7 @@ Encrypting to multiple keys essentially just expands upon the key selection process and the recipients from the previous examples. The following example encrypts a message (=text=) to everyone with an -email address on the =gnupg.org= domain,[fn:3] but does /not/ encrypt +email address on the =gnupg.org= domain,[fn:5] but does /not/ encrypt to a default key or other key which is configured to normally encrypt to. @@ -2017,19 +2028,19 @@ PURPOSE. [fn:2] The =lang/python/docs/= directory in the GPGME source. -[fn:3] You probably don't really want to do this. Searching the -keyservers for "gnupg.org" produces over 400 results, the majority of -which aren't actually at the gnupg.org domain, but just included a -comment regarding the project in their key somewhere. - -[fn:4] As Python 3.7 is a very recent release, it is not given +[fn:3] As Python 3.7 is a very recent release, it is not given priority over 3.6 yet, but will probably be prioritised by the release of Python 3.7.2. -[fn:5] Yes, even if you use virtualenv with everything you do in +[fn:4] Yes, even if you use virtualenv with everything you do in Python. If you want to install this module as just your user account then you will need to manually configure, compile and install the /entire/ GnuPG stack as that user as well. This includes libraries which are not often installed that way. It can be done and there are circumstances under which it is worthwhile, but generally only on POSIX systems which utilise single user mode (some even require it). + +[fn:5] You probably don't really want to do this. Searching the +keyservers for "gnupg.org" produces over 400 results, the majority of +which aren't actually at the gnupg.org domain, but just included a +comment regarding the project in their key somewhere. commit a8a983c5bc0f0deeeebda455ad73309fff48b61f Author: Ben McGinnes Date: Wed Aug 29 03:42:46 2018 +1000 docs: python bindings * Added section on why no CFFI. diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org index b5d6ca8..ffe5034 100644 --- a/lang/python/docs/GPGMEpythonHOWTOen.org +++ b/lang/python/docs/GPGMEpythonHOWTOen.org @@ -398,9 +398,28 @@ ongoing. :CUSTOM_ID: snafu-foad :END: -Obscenis, peream, CFFI_lover, si non uti me pudet improbisque verbis -sed cum tu posito degenerem pudore ostendas mihi coleos patentes cum -cunno mihi mentula est vocanda. +There are many reasons for favouring CFFI and proponents of it are +quite happy to repeat these things as if all it would take to switch +from SWIG to CFFI is repeating that list as if it were a new concept. + +The fact is that there are things which Python's CFFI implementation +cannot handle in the GPGME C code. Beyond that there are features of +SWIG which are simply not available with CFFI at all. SWIG generates +the bindings to Python using the =gpgme.h= file, but that file is not +a single version shipped with each release, it too is generated when +GPGME is compiled. + +CFFI is currently unable to adapt to such a potentially mutable +codebase. If there were some means of applying SWIG's dynamic code +generation to produce CFFI API modes of accessing the GPGME libraries +(or the source source code directly), but such a thing does not exist +yet either and it currently appears that work is needed in at least +one of CFFI's dependencies before any of this can be addressed. + +So if you're a massive fan of CFFI; that's great, but if you want this +project to switch to CFFI then rather than just insisting that it +should, I'd suggest you volunteer to bring CFFI up to the level this +project needs. * Fundamentals commit c2831e2377843c8625df158ef32e01f8c19494eb Author: Ben McGinnes Date: Tue Aug 28 18:45:37 2018 +1000 docs: python howto * Added another key import example using ProtonMail's new keyserver. diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org index 9154289..b5d6ca8 100644 --- a/lang/python/docs/GPGMEpythonHOWTOen.org +++ b/lang/python/docs/GPGMEpythonHOWTOen.org @@ -661,6 +661,100 @@ relative ease by which such key IDs can be reproduced, as demonstrated by the Evil32 Project in 2014 (which was subsequently exploited in 2016). +Here is a variation on the above which checks the constrained +ProtonMail keyserver for ProtonMail public keys. + +#+BEGIN_SRC python -i +import gpg +import requests +import sys + +print(""" +This script searches the ProtonMail key server for the specified key and +imports it. +""") + +c = gpg.Context(armor=True) +url = "https://api.protonmail.ch/pks/lookup" +ksearch = [] + +if len(sys.argv) >= 2: + keyterm = sys.argv[1] +else: + keyterm = input("Enter the key ID, UID or search string: ") + +if keyterm.count("@") == 2 and keyterm.startswith("@") is True: + ksearch.append(keyterm[1:]) + ksearch.append(keyterm[1:]) + ksearch.append(keyterm[1:]) +elif keyterm.count("@") == 1 and keyterm.startswith("@") is True: + ksearch.append("{0}@protonmail.com".format(keyterm[1:])) + ksearch.append("{0}@protonmail.ch".format(keyterm[1:])) + ksearch.append("{0}@pm.me".format(keyterm[1:])) +elif keyterm.count("@") == 0: + ksearch.append("{0}@protonmail.com".format(keyterm)) + ksearch.append("{0}@protonmail.ch".format(keyterm)) + ksearch.append("{0}@pm.me".format(keyterm)) +elif keyterm.count("@") == 2 and keyterm.startswith("@") is False: + uidlist = keyterm.split("@") + for uid in uidlist: + ksearch.append("{0}@protonmail.com".format(uid)) + ksearch.append("{0}@protonmail.ch".format(uid)) + ksearch.append("{0}@pm.me".format(uid)) +elif keyterm.count("@") > 2: + uidlist = keyterm.split("@") + for uid in uidlist: + ksearch.append("{0}@protonmail.com".format(uid)) + ksearch.append("{0}@protonmail.ch".format(uid)) + ksearch.append("{0}@pm.me".format(uid)) +else: + ksearch.append(keyterm) + +for k in ksearch: + payload = {"op": "get", "search": k} + try: + r = requests.get(url, verify=True, params=payload) + if r.ok is True: + result = c.key_import(r.content) + elif r.ok is False: + result = r.content + except Exception as e: + result = None + + if result is not None and hasattr(result, "considered") is False: + print("{0} for {1}".format(result.decode(), k)) + elif result is not None and hasattr(result, "considered") is True: + num_keys = len(result.imports) + new_revs = result.new_revocations + new_sigs = result.new_signatures + new_subs = result.new_sub_keys + new_uids = result.new_user_ids + new_scrt = result.secret_imported + nochange = result.unchanged + print(""" +The total number of keys considered for import was: {0} + +With UIDs wholely or partially matching the following string: + + {1} + + Number of keys revoked: {2} + Number of new signatures: {3} + Number of new subkeys: {4} + Number of new user IDs: {5} +Number of new secret keys: {6} + Number of unchanged keys: {7} + +The key IDs for all considered keys were: +""".format(num_keys, k, new_revs, new_sigs, new_subs, new_uids, new_scrt, + nochange)) + for i in range(num_keys): + print(result.imports[i].fpr) + print("") + elif result is None: + print(e) +#+END_SRC + ** Exporting keys :PROPERTIES: commit 1c261b9fa3462360b6c3f43b243091cd50534903 Author: Ben McGinnes Date: Tue Aug 28 06:42:27 2018 +1000 docs: python bindings * Added details on installation troubleshooting. diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org index a712ec2..9154289 100644 --- a/lang/python/docs/GPGMEpythonHOWTOen.org +++ b/lang/python/docs/GPGMEpythonHOWTOen.org @@ -217,7 +217,7 @@ The GPGME Python bindings only have three requirements: 1. A suitable version of Python 2 or Python 3. With Python 2 that means Python 2.7 and with Python 3 that means Python 3.4 or higher. -2. SWIG. +2. [[https://www.swig.org][SWIG]].. 3. GPGME itself. Which also means that all of GPGME's dependencies must be installed too. @@ -255,6 +255,154 @@ See the GPGME =README= file for details of how to install GPGME from source. +** Known Issues + :PROPERTIES: + :CUSTOM_ID: snafu + :END: + +There are a few known issues with the current build process and the +Python bindings. For the most part these are easily addressed should +they be encountered. + + +*** Breaking Builds + :PROPERTIES: + :CUSTOM_ID: snafu-a-swig-of-this-builds-character + :END: + +Occasionally when installing GPGME with the Python bindings included +it may be observed that the =make= portion of that process induces a +large very number of warnings and, eventually errors which end that +part of the build process. Yet following that with =make check= and +=make install= appears to work seamlessly. + +The cause of this is related to the way SWIG needs to be called to +dynamically generate the C bindings for GPGME in the first place. So +the entire process will always produce =lang/python/python2-gpg/= and +=lang/python/python3-gpg/= directories. These should contain the +build output generated during compilation, including the complete +bindings and module installed into =site-packages=. + +Occasionally the errors in the early part or some other conflict +(e.g. not installing as */root/* or */su/*) may result in nothing +being installed to the relevant =site-packages= directory and the +build directory missing a lot of expected files. Even when this +occurs, the solution is actually quite simple and will always work. + +That solution is simply to run the following commands as either the +*root* user or prepended with =sudo -H=[fn:5] in the =lang/python/= +directory: + +#+BEGIN_SRC shell + /path/to/pythonX.Y setup.py build + /path/to/pythonX.Y setup.py build + /path/to/pythonX.Y setup.py install +#+END_SRC + +Yes, the build command does need to be run twice. Yes, you still need +to run the potentially failing or incomplete steps during the +=configure=, =make= and =make install= steps with installing GPGME. +This is because those steps generate a lot of essential files needed, +both by and in order to create, the bindings (including both the +=setup.py= and =gpgme.h= files). + + +**** IMPORTANT Note + :PROPERTIES: + :CUSTOM_ID: snafu-swig-build-note + :END: + +If specifying a selected number of languages to create bindings for, +always leave Python last. Currently the other languages are also +preceding Python of either version when listed alphabetically and so +that just happens by default currently. If Python is set to precede +one of the other languages then it is possible that the errors +described here may interrupt the build process before generating +bindings for those other languages. + + +*** Multiple installations + :PROPERTIES: + :CUSTOM_ID: snafu-the-full-monty + :END: + +For a veriety of reasons it may be either necessary or just preferable +to install the bindings to alternative installed Python versions which +meet the requirements of these bindings. + +On POSIX systens this will generally be most simply achieved by +running the manual installation commands (build, build, install) as +described in the previous section for each Python installation the +bindings need to be installed to. + +As per the SWIG documentation: the compilers, libraries and runtime +used to build GPGME and the Python Bindings *must* match those used to +compile Python itself, including the version number(s) (at least going +by major version numbers and probably minor numbers too). + +On most POSIX systems, including OS X, this will very likely be the +case in most, if not all, cases. + + +*** Won't Work With Windows + :PROPERTIES: + :CUSTOM_ID: snafu-runtime-not-funtime + :END: + +There are semi-regular reports of Windows users having considerable +difficulty in installing and using the Python bindings at all. Very +often, possibly even always, these reports come from Cygwin users +and/or MinGW users and/or Msys2 users. Though not all of them have +been confirmed, it appears that these reports have also come from +people who installed Python using the Windows installer files from the +[[https://python.org][Python website]] (i.e. mostly MSI installers, sometimes self-extracting +=.exe= files). + +The Windows versions of Python are not built using Cygwin, MinGW or +Msys2; they're built using Microsoft Visual Studio. Furthermore the +version used is /considerably/ more advanced than the version which +MinGWobtained a small number of files from many years ago in order to +be able to compile anything at all. Not only that, but there are +changes to the version of Visual Studio between some micro releases, +though that is is particularly the case with Python 2.7, since it has +been kept around far longer than it should have been. + +There are two theoretical solutions to this issue: + + 1. Compile and install the GnuPG stack, including GPGME and the + Python bibdings using the same version of Microsoft Visual Studio + used by the Python Foundation to compile the version of Python + installed. + + If there are multiple versions of Python then this will need to be + done with each different version of Visual Studio used. + + 2. Compile and install Python using the same tools used by choice, + such as MinGW or Msys2. + +Do *NOT* use the official Windows installer for Python unless +following the first method. + +In this type of situation it may even be for the best to accept that +there are less limitations on permissive software than free software +and simply opt to use a recent version of the Community Edition of +Microsoft Visual Studio to compile and build all of it, no matter +what. + +Investigations into the extent or the limitations of this issue are +ongoing. + + +*** I don't like SWIG, Use CFFI instead + :PROPERTIES: + :CUSTOM_ID: snafu-foad + :END: + +Obscenis, peream, CFFI_lover, si non uti me pudet improbisque verbis +sed cum tu posito degenerem pudore ostendas mihi coleos patentes cum +cunno mihi mentula est vocanda. + + * Fundamentals :PROPERTIES: :CUSTOM_ID: howto-fund-a-mental @@ -1764,3 +1912,11 @@ comment regarding the project in their key somewhere. [fn:4] As Python 3.7 is a very recent release, it is not given priority over 3.6 yet, but will probably be prioritised by the release of Python 3.7.2. + +[fn:5] Yes, even if you use virtualenv with everything you do in +Python. If you want to install this module as just your user account +then you will need to manually configure, compile and install the +/entire/ GnuPG stack as that user as well. This includes libraries +which are not often installed that way. It can be done and there are +circumstances under which it is worthwhile, but generally only on +POSIX systems which utilise single user mode (some even require it). ----------------------------------------------------------------------- Summary of changes: lang/python/docs/GPGMEpythonHOWTOen.org | 298 +++++++++++++++++++++++++++++++- 1 file changed, 289 insertions(+), 9 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 04:05:46 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 29 Aug 2018 04:05:46 +0200 Subject: [git] GPG-ERROR - branch, gniibe/pkg-config-support, updated. libgpg-error-1.32-4-gc5f0403 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, gniibe/pkg-config-support has been updated via c5f040325b59fccf5f895ab94a3027c1650628dc (commit) from e91365ef38ce020651353691c53c17c662f6c890 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c5f040325b59fccf5f895ab94a3027c1650628dc Author: NIIBE Yutaka Date: Wed Aug 29 11:01:53 2018 +0900 More changes for new gpg-error-config. * configure.ac: Change generating gpg-error-config. (GPG_ERROR_CONFIG_ISUBDIRAFTER): Remove. (GPG_ERROR_CONFIG_CFLAGS): Put -idirafter here. * src/Makefile.am (pkgconfig_DATA): Add. (EXTRA_DIST): Add gpg-error-config-head.in, pkgconf-funcs.sh, gpg-error-config-main.sh, gpg-error.pc.in. * src/gpg-error-config-head.in: New. * src/gpg-error-config-main.sh: Rename from src/gpg-error-config.in. * src/gpg-error.pc.in (isubdirafter): Remove. Signed-off-by: NIIBE Yutaka diff --git a/configure.ac b/configure.ac index 1ea2135..5b460bf 100644 --- a/configure.ac +++ b/configure.ac @@ -483,13 +483,16 @@ if test "x$LIBMULTITHREAD" != x; then else GPG_ERROR_CONFIG_MT_LIBS="" fi -GPG_ERROR_CONFIG_CFLAGS="" +if test "$have_w32ce_system" = yes; then + GPG_ERROR_CONFIG_CFLAGS="-idirafter \${includedir}/gpg-extra" +else + GPG_ERROR_CONFIG_CFLAGS="" +fi if test "x$THREADLIB_CPPFLAGS" != x; then GPG_ERROR_CONFIG_MT_CFLAGS="${THREADLIB_CPPFLAGS}" else GPG_ERROR_CONFIG_MT_CFLAGS="" fi -GPG_ERROR_CONFIG_ISUBDIRAFTER="" GPG_ERROR_CONFIG_HOST="$host" case "$includedir" in '${prefix}/include'|/usr/include|/include) GPG_ERROR_CONFIG_INCLUDEDIR="" ;; @@ -500,17 +503,13 @@ case "$libdir" in *) GPG_ERROR_CONFIG_LIBDIR="-L$libdir" ;; esac -PKGCONF_FUNCS_SH_CONTENT=$(cat $srcdir/src/pkgconf-funcs.sh) - AC_SUBST(GPG_ERROR_CONFIG_LIBS) AC_SUBST(GPG_ERROR_CONFIG_CFLAGS) AC_SUBST(GPG_ERROR_CONFIG_MT_LIBS) AC_SUBST(GPG_ERROR_CONFIG_MT_CFLAGS) -AC_SUBST(GPG_ERROR_CONFIG_ISUBDIRAFTER) AC_SUBST(GPG_ERROR_CONFIG_HOST) AC_SUBST(GPG_ERROR_CONFIG_INCLUDEDIR) AC_SUBST(GPG_ERROR_CONFIG_LIBDIR) -AC_SUBST(PKGCONF_FUNCS_SH_CONTENT) # # Special defines for certain platforms @@ -523,7 +522,6 @@ if test "$have_w32_system" = yes; then fi if test "$have_w32ce_system" = yes; then AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE]) - GPG_ERROR_CONFIG_ISUBDIRAFTER="gpg-extra" fi force_use_syscfg=yes fi @@ -637,8 +635,14 @@ AC_CONFIG_FILES([doc/Makefile po/Makefile.in m4/Makefile]) AC_CONFIG_FILES([src/Makefile tests/Makefile]) AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd]) AC_CONFIG_FILES([src/versioninfo.rc src/gpg-error.w32-manifest]) -AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config]) AC_CONFIG_FILES([src/gpg-error.pc]) +AC_CONFIG_FILES([src/gpg-error-config-head]) +AC_CONFIG_COMMANDS([gen-gpg-error-config], [ +cat src/gpg-error-config-head \ + $srcdir/src/pkgconf-funcs.sh \ + $srcdir/src/gpg-error-config-main.sh > src/gpg-error-config +chmod +x src/gpg-error-config +]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index fcfbb83..98e3b94 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -88,11 +88,17 @@ nodist_bin_SCRIPTS = gpgrt-config m4datadir = $(datadir)/aclocal m4data_DATA = gpg-error.m4 gpgrt.m4 +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = gpg-error.pc + EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \ mkerrnos.awk errnos.in README \ mkerrcodes.awk mkerrcodes1.awk mkerrcodes2.awk mkerrcodes.c \ mkheader.c gpg-error.h.in mkw32errmap.c w32-add.h w32ce-add.h \ - err-sources.h err-codes.h gpg-error-config.in gpg-error.m4 gpgrt.m4 \ + err-sources.h err-codes.h \ + gpg-error-config-head.in pkgconf-funcs.sh gpg-error-config-main.sh \ + gpg-error.pc.in \ + gpg-error.m4 gpgrt.m4 \ gpg-error.vers gpg-error.def.in \ versioninfo.rc.in gpg-error.w32-manifest.in \ $(lock_obj_pub) diff --git a/src/gpg-error-config-head.in b/src/gpg-error-config-head.in new file mode 100644 index 0000000..1c50fa0 --- /dev/null +++ b/src/gpg-error-config-head.in @@ -0,0 +1,17 @@ +#!/bin/sh +# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# SPDX-License-Identifier: FSFULLR + +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +PKG_CONFIG_PATH="${datadir}/pkgconfig" +# diff --git a/src/gpg-error-config.in b/src/gpg-error-config-main.sh similarity index 70% rename from src/gpg-error-config.in rename to src/gpg-error-config-main.sh index a0a0141..e2ff26d 100644 --- a/src/gpg-error-config.in +++ b/src/gpg-error-config-main.sh @@ -1,21 +1,3 @@ -#!/bin/sh -# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This file is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# SPDX-License-Identifier: FSFULLR - -prefix=@prefix@ -datarootdir=@datarootdir@ -datadir=@datadir@ -PKG_CONFIG_PATH="${datadir}/pkgconfig" - - at PKGCONF_FUNCS_SH_CONTENT@ if echo "$0" | grep gpg-error-config 2>/dev/null >/dev/null; then myname="gpg-error-config" diff --git a/src/gpg-error.pc.in b/src/gpg-error.pc.in index fe8b553..3e8d328 100644 --- a/src/gpg-error.pc.in +++ b/src/gpg-error.pc.in @@ -2,7 +2,6 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ includedir=@includedir@ libdir=@libdir@ -isubdirafter=@GPG_ERROR_CONFIG_ISUBDIRAFTER@ host=@GPG_ERROR_CONFIG_HOST@ mtcflags=@GPG_ERROR_CONFIG_MT_CFLAGS@ mtlibs=@GPG_ERROR_CONFIG_MT_LIBS@ diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index 381243c..d06b68b 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -1,4 +1,4 @@ -#################### start of pkgconf-funcs +#### start of pkgconf-funcs # # Bourne shell functions for config file in pkg-config style, so that @@ -116,4 +116,4 @@ find_file_in_path () { RESULT="" return 1 } -#################### end of pkgconf-funcs +#### end of pkgconf-funcs ----------------------------------------------------------------------- Summary of changes: configure.ac | 20 ++++++++++++-------- src/Makefile.am | 8 +++++++- po/POTFILES.in => src/gpg-error-config-head.in | 14 ++++++++------ ...{gpg-error-config.in => gpg-error-config-main.sh} | 18 ------------------ src/gpg-error.pc.in | 1 - src/pkgconf-funcs.sh | 4 ++-- 6 files changed, 29 insertions(+), 36 deletions(-) copy po/POTFILES.in => src/gpg-error-config-head.in (66%) rename src/{gpg-error-config.in => gpg-error-config-main.sh} (70%) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 08:14:33 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 29 Aug 2018 08:14:33 +0200 Subject: [git] GPG-ERROR - branch, gniibe/pkg-config-support, updated. libgpg-error-1.32-5-g07fcb27 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, gniibe/pkg-config-support has been updated via 07fcb271f7610e7a174bd6a6d54aaa84b01ec060 (commit) from c5f040325b59fccf5f895ab94a3027c1650628dc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 07fcb271f7610e7a174bd6a6d54aaa84b01ec060 Author: NIIBE Yutaka Date: Wed Aug 29 15:13:14 2018 +0900 Fix gpg-error.m4 to use pkg-config compatible way. * src/gpg-error.m4: Use --variable=xx. Signed-off-by: NIIBE Yutaka diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 index 60c88d8..ab29273 100644 --- a/src/gpg-error.m4 +++ b/src/gpg-error.m4 @@ -88,11 +88,11 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs` - GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --cflags 2>/dev/null` - GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --libs 2>/dev/null` + GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --variable=mtcflags 2>/dev/null` + GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --variable=mtlibs 2>/dev/null` AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) - gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --host 2>/dev/null || echo none` + gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --variable=host 2>/dev/null || echo none` if test x"$gpg_error_config_host" != xnone ; then if test x"$gpg_error_config_host" != x"$host" ; then AC_MSG_WARN([[ ----------------------------------------------------------------------- Summary of changes: src/gpg-error.m4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 09:45:18 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 09:45:18 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-197-g3da8357 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 3da835713fb6220112d988e1953f3d84beabbf6a (commit) from 7f172404bfcf719b9b1af4a182d4803525ebff7c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3da835713fb6220112d988e1953f3d84beabbf6a Author: Werner Koch Date: Wed Aug 29 09:36:09 2018 +0200 gpg: New option --known-notation. * g10/gpg.c (oKnownNotation): New const. (opts): Add option --known-notation. (main): Set option. * g10/parse-packet.c (known_notations_list): New local var. (register_known_notation): New. (can_handle_critical_notation): Rewrite to handle the new feature. Also print the name of unknown notations in verbose mode. -- GnuPG-bug-id: 4060 Signed-off-by: Werner Koch diff --git a/doc/gpg.texi b/doc/gpg.texi index 7c27fba..6df8d4c 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -2970,6 +2970,13 @@ smartcard, and "%%" results in a single "%". %k, %K, and %f are only meaningful when making a key signature (certification), and %c is only meaningful when using the OpenPGP smartcard. + at item --known-notation @var{name} + at opindex known-notation +Adds @var{name} to a list of known critical signature notations. The +effect of this is that gpg will not mark a signature with a critical +signature notation of that name as bad. Note that gpg already knows +by default about a few critical signatures notation names. + @item --sig-policy-url @var{string} @itemx --cert-policy-url @var{string} @itemx --set-policy-url @var{string} diff --git a/g10/gpg.c b/g10/gpg.c index 36af918..f04a340 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -110,6 +110,7 @@ enum cmd_and_opt_values oCertNotation, oShowNotation, oNoShowNotation, + oKnownNotation, aEncrFiles, aEncrSym, aDecryptFiles, @@ -682,6 +683,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_s (oSetNotation, "set-notation", "@"), ARGPARSE_s_s (oSigNotation, "sig-notation", "@"), ARGPARSE_s_s (oCertNotation, "cert-notation", "@"), + ARGPARSE_s_s (oKnownNotation, "known-notation", "@"), ARGPARSE_group (302, N_( "@\n(See the man page for a complete listing of all commands and options)\n" @@ -3365,6 +3367,7 @@ main (int argc, char **argv) break; case oSigNotation: add_notation_data( pargs.r.ret_str, 0 ); break; case oCertNotation: add_notation_data( pargs.r.ret_str, 1 ); break; + case oKnownNotation: register_known_notation (pargs.r.ret_str); break; case oShowNotation: deprecated_warning(configname,configlineno,"--show-notation", "--list-options ","show-notations"); diff --git a/g10/packet.h b/g10/packet.h index 3f87294..6e1438b 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -636,6 +636,9 @@ char *issuer_fpr_string (PKT_signature *sig); /*-- parse-packet.c --*/ + +void register_known_notation (const char *string); + /* Sets the packet list mode to MODE (i.e., whether we are dumping a packet or not). Returns the current mode. This allows for temporarily suspending dumping by doing the following: diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 0fa8be6..92c6529 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -43,11 +43,15 @@ #define MAX_COMMENT_PACKET_LENGTH ( 64 * 1024) #define MAX_ATTR_PACKET_LENGTH ( 16 * 1024*1024) - static int mpi_print_mode; static int list_mode; static estream_t listfp; +/* A linked list of known notation names. Note that the FLAG is used + * to store the length of the name to speed up the check. */ +static strlist_t known_notations_list; + + static int parse (parse_packet_ctx_t ctx, PACKET *pkt, int onlykeypkts, off_t * retpos, int *skip, IOBUF out, int do_skip #if DEBUG_PARSE_PACKET @@ -189,6 +193,36 @@ mpi_read (iobuf_t inp, unsigned int *ret_nread, int secure) } +/* Register STRING as a known critical notation name. */ +void +register_known_notation (const char *string) +{ + strlist_t sl; + + if (!known_notations_list) + { + sl = add_to_strlist (&known_notations_list, + "preferred-email-encoding at pgp.com"); + sl->flags = 32; + sl = add_to_strlist (&known_notations_list, "pka-address at gnupg.org"); + sl->flags = 21; + } + if (!string) + return; /* Only initialized the default known notations. */ + + /* In --set-notation we use an exclamation mark to indicate a + * critical notation. As a convenience skip this here. */ + if (*string == '!') + string++; + + if (!*string || strlist_find (known_notations_list, string)) + return; /* Empty string or already registered. */ + + sl = add_to_strlist (&known_notations_list, string); + sl->flags = strlen (string); +} + + int set_packet_list_mode (int mode) { @@ -1640,14 +1674,24 @@ parse_one_sig_subpkt (const byte * buffer, size_t n, int type) /* Return true if we understand the critical notation. */ static int -can_handle_critical_notation (const byte * name, size_t len) +can_handle_critical_notation (const byte *name, size_t len) { - if (len == 32 && memcmp (name, "preferred-email-encoding at pgp.com", 32) == 0) - return 1; - if (len == 21 && memcmp (name, "pka-address at gnupg.org", 21) == 0) - return 1; + strlist_t sl; - return 0; + register_known_notation (NULL); /* Make sure it is initialized. */ + + for (sl = known_notations_list; sl; sl = sl->next) + if (sl->flags == len && !memcmp (sl->d, name, len)) + return 1; /* Known */ + + if (opt.verbose) + { + log_info(_("Unknown critical signature notation: ") ); + print_utf8_buffer (log_get_stream(), name, len); + log_printf ("\n"); + } + + return 0; /* Unknown. */ } ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 7 +++++++ g10/gpg.c | 3 +++ g10/packet.h | 3 +++ g10/parse-packet.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 64 insertions(+), 7 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 09:46:51 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 09:46:51 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-14-ga59a996 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via a59a9962f48f828ea7d22362dfa6d82841551110 (commit) from b02ad56a9041273df58ded4cc70cf5ffa9e58c16 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a59a9962f48f828ea7d22362dfa6d82841551110 Author: Werner Koch Date: Wed Aug 29 09:36:09 2018 +0200 gpg: New option --known-notation. * g10/gpg.c (oKnownNotation): New const. (opts): Add option --known-notation. (main): Set option. * g10/parse-packet.c (known_notations_list): New local var. (register_known_notation): New. (can_handle_critical_notation): Rewrite to handle the new feature. Also print the name of unknown notations in verbose mode. -- GnuPG-bug-id: 4060 Signed-off-by: Werner Koch (cherry picked from commit 3da835713fb6220112d988e1953f3d84beabbf6a) diff --git a/doc/gpg.texi b/doc/gpg.texi index d0aa010..a72505f 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -2933,6 +2933,13 @@ smartcard, and "%%" results in a single "%". %k, %K, and %f are only meaningful when making a key signature (certification), and %c is only meaningful when using the OpenPGP smartcard. + at item --known-notation @var{name} + at opindex known-notation +Adds @var{name} to a list of known critical signature notations. The +effect of this is that gpg will not mark a signature with a critical +signature notation of that name as bad. Note that gpg already knows +by default about a few critical signatures notation names. + @item --sig-policy-url @var{string} @itemx --cert-policy-url @var{string} @itemx --set-policy-url @var{string} diff --git a/g10/gpg.c b/g10/gpg.c index c117de3..e18eefe 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -109,6 +109,7 @@ enum cmd_and_opt_values oCertNotation, oShowNotation, oNoShowNotation, + oKnownNotation, aEncrFiles, aEncrSym, aDecryptFiles, @@ -673,6 +674,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_s (oSetNotation, "set-notation", "@"), ARGPARSE_s_s (oSigNotation, "sig-notation", "@"), ARGPARSE_s_s (oCertNotation, "cert-notation", "@"), + ARGPARSE_s_s (oKnownNotation, "known-notation", "@"), ARGPARSE_group (302, N_( "@\n(See the man page for a complete listing of all commands and options)\n" @@ -3301,6 +3303,7 @@ main (int argc, char **argv) break; case oSigNotation: add_notation_data( pargs.r.ret_str, 0 ); break; case oCertNotation: add_notation_data( pargs.r.ret_str, 1 ); break; + case oKnownNotation: register_known_notation (pargs.r.ret_str); break; case oShowNotation: deprecated_warning(configname,configlineno,"--show-notation", "--list-options ","show-notations"); diff --git a/g10/packet.h b/g10/packet.h index e76e6af..6d01b10 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -610,6 +610,9 @@ char *issuer_fpr_string (PKT_signature *sig); /*-- parse-packet.c --*/ + +void register_known_notation (const char *string); + /* Sets the packet list mode to MODE (i.e., whether we are dumping a packet or not). Returns the current mode. This allows for temporarily suspending dumping by doing the following: diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 8d0be19..ff348ec 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -43,11 +43,15 @@ #define MAX_COMMENT_PACKET_LENGTH ( 64 * 1024) #define MAX_ATTR_PACKET_LENGTH ( 16 * 1024*1024) - static int mpi_print_mode; static int list_mode; static estream_t listfp; +/* A linked list of known notation names. Note that the FLAG is used + * to store the length of the name to speed up the check. */ +static strlist_t known_notations_list; + + static int parse (parse_packet_ctx_t ctx, PACKET *pkt, int onlykeypkts, off_t * retpos, int *skip, IOBUF out, int do_skip #if DEBUG_PARSE_PACKET @@ -186,6 +190,36 @@ mpi_read (iobuf_t inp, unsigned int *ret_nread, int secure) } +/* Register STRING as a known critical notation name. */ +void +register_known_notation (const char *string) +{ + strlist_t sl; + + if (!known_notations_list) + { + sl = add_to_strlist (&known_notations_list, + "preferred-email-encoding at pgp.com"); + sl->flags = 32; + sl = add_to_strlist (&known_notations_list, "pka-address at gnupg.org"); + sl->flags = 21; + } + if (!string) + return; /* Only initialized the default known notations. */ + + /* In --set-notation we use an exclamation mark to indicate a + * critical notation. As a convenience skip this here. */ + if (*string == '!') + string++; + + if (!*string || strlist_find (known_notations_list, string)) + return; /* Empty string or already registered. */ + + sl = add_to_strlist (&known_notations_list, string); + sl->flags = strlen (string); +} + + int set_packet_list_mode (int mode) { @@ -1602,14 +1636,24 @@ parse_one_sig_subpkt (const byte * buffer, size_t n, int type) /* Return true if we understand the critical notation. */ static int -can_handle_critical_notation (const byte * name, size_t len) +can_handle_critical_notation (const byte *name, size_t len) { - if (len == 32 && memcmp (name, "preferred-email-encoding at pgp.com", 32) == 0) - return 1; - if (len == 21 && memcmp (name, "pka-address at gnupg.org", 21) == 0) - return 1; + strlist_t sl; - return 0; + register_known_notation (NULL); /* Make sure it is initialized. */ + + for (sl = known_notations_list; sl; sl = sl->next) + if (sl->flags == len && !memcmp (sl->d, name, len)) + return 1; /* Known */ + + if (opt.verbose) + { + log_info(_("Unknown critical signature notation: ") ); + print_utf8_buffer (log_get_stream(), name, len); + log_printf ("\n"); + } + + return 0; /* Unknown. */ } ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 7 +++++++ g10/gpg.c | 3 +++ g10/packet.h | 3 +++ g10/parse-packet.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 64 insertions(+), 7 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 10:02:16 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 10:02:16 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-198-g53bbac0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 53bbac0865719076f7ad7bb57e13f656bd6edf39 (commit) from 3da835713fb6220112d988e1953f3d84beabbf6a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 53bbac0865719076f7ad7bb57e13f656bd6edf39 Author: Werner Koch Date: Wed Aug 29 09:53:06 2018 +0200 doc: Show how to list envvars send to gpg-agent. -- GnuPG-bug: 3353 Signed-off-by: Werner Koch diff --git a/doc/gpg.texi b/doc/gpg.texi index 6df8d4c..c4bc354 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -3650,6 +3650,15 @@ Operation is further controlled by a few environment variables: @end table +When calling the gpg-agent component @command{@gpgname} sends a set of +environment variables to gpg-agent. The names of these variables can +be listed using the command: + + at example + gpg-connect-agent 'getinfo std_env_names' /bye | awk '$1=="D" @{print $2@}' + at end example + + @c ******************************************* @c *************** **************** ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 9 +++++++++ 1 file changed, 9 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 10:02:47 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 10:02:47 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-15-g3169b5a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 3169b5ae3f21849354b1413644d3e545c0b08c73 (commit) from a59a9962f48f828ea7d22362dfa6d82841551110 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3169b5ae3f21849354b1413644d3e545c0b08c73 Author: Werner Koch Date: Wed Aug 29 09:53:06 2018 +0200 doc: Show how to list envvars send to gpg-agent. -- GnuPG-bug: 3353 Signed-off-by: Werner Koch (cherry picked from commit 53bbac0865719076f7ad7bb57e13f656bd6edf39) diff --git a/doc/gpg.texi b/doc/gpg.texi index a72505f..dc7e021 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -3610,6 +3610,15 @@ Operation is further controlled by a few environment variables: @end table +When calling the gpg-agent component @command{@gpgname} sends a set of +environment variables to gpg-agent. The names of these variables can +be listed using the command: + + at example + gpg-connect-agent 'getinfo std_env_names' /bye | awk '$1=="D" @{print $2@}' + at end example + + @c ******************************************* @c *************** **************** ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 9 +++++++++ 1 file changed, 9 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 11:30:07 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 29 Aug 2018 11:30:07 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-161-g4c573f3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 4c573f3c898429628c3344c88379319f271b900a (commit) via ab6b52deb626714fb5bab7ff98cb7f36254b4645 (commit) via 9e5ad3f129751f0d4d236b34850d7127780f6ae8 (commit) via 59e8a7ee3bcd16275091c9535626e49fc2a6c4af (commit) via b6cfbd077e9453dd16e09fff22ec014bc1ee282d (commit) via 283892c73ddeb20a16262a0f66ea2e2e9507e57c (commit) via c2c93b0814955019c8a64a2cb8b4721fff100bd7 (commit) from 25f501f29ea2c1b617aaba0be747797fcc05dc16 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4c573f3c898429628c3344c88379319f271b900a Author: Andre Heinecke Date: Wed Aug 29 11:28:15 2018 +0200 Cache icons * src/ribbon-callbacks.cpp (getIcon): Use dispcache. (getIconDisp): New. -- While this may not be much it felt excessive to initialize GDIPlus and convert the icon from PNG to bitmap for each getIcon call even though the icons never change over the lifetime of GpgOL GnuPG-Bug-Id: T4113 diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp index 43ab432..e9f8a5e 100644 --- a/src/ribbon-callbacks.cpp +++ b/src/ribbon-callbacks.cpp @@ -42,6 +42,7 @@ #include "mimemaker.h" #include "filetype.h" #include "mail.h" +#include "dispcache.h" #include #include @@ -73,15 +74,15 @@ HRESULT getContext (LPDISPATCH ctrl, LPDISPATCH *context) return context ? S_OK : E_FAIL; } -/* getIcon +/* getIconDisp Loads a PNG image from the resurce converts it into a Bitmap and Wraps it in an PictureDispatcher that is returned as result. Based on documentation from: http://www.codeproject.com/Articles/3537/Loading-JPG-PNG-resources-using-GDI */ -HRESULT -getIcon (int id, VARIANT* result) +static LPDISPATCH +getIconDisp (int id) { PICTDESC pdesc; LPDISPATCH pPict; @@ -98,12 +99,6 @@ getIcon (int id, VARIANT* result) pdesc.cbSizeofstruct = sizeof pdesc; pdesc.picType = PICTYPE_BITMAP; - if (!result) - { - log_error ("getIcon called without result variant."); - return E_POINTER; - } - /* Initialize GDI */ gdiplusStartupInput.DebugEventCallback = NULL; gdiplusStartupInput.SuppressBackgroundThread = FALSE; @@ -117,12 +112,12 @@ getIcon (int id, VARIANT* result) { log_error ("%s:%s: failed to find image: %i", SRCNAME, __func__, id); - return E_FAIL; + return nullptr; } imageSize = SizeofResource (glob_hinst, hResource); if (!imageSize) - return E_FAIL; + return nullptr; pResourceData = LockResource (LoadResource(glob_hinst, hResource)); @@ -130,7 +125,7 @@ getIcon (int id, VARIANT* result) { log_error ("%s:%s: failed to load image: %i", SRCNAME, __func__, id); - return E_FAIL; + return nullptr; } hBuffer = GlobalAlloc (GMEM_MOVEABLE, imageSize); @@ -168,11 +163,36 @@ getIcon (int id, VARIANT* result) { log_error ("%s:%s: OleCreatePictureIndirect failed: hr=%#lx\n", SRCNAME, __func__, hr); - return -1; + return nullptr; } - result->pdispVal = pPict; - result->vt = VT_DISPATCH; + return pPict; +} + +HRESULT +getIcon (int id, VARIANT* result) +{ + if (!result) + { + TRACEPOINT; + return S_OK; + } + + auto cache = DispCache::instance (); + result->pdispVal = cache->getDisp (id); + + if (!result->pdispVal) + { + result->pdispVal = getIconDisp (id); + cache->addDisp (id, result->pdispVal); + memdbg_addRef (result->pdispVal); + } + + if (result->pdispVal) + { + result->vt = VT_DISPATCH; + result->pdispVal->AddRef(); + } return S_OK; } commit ab6b52deb626714fb5bab7ff98cb7f36254b4645 Author: Andre Heinecke Date: Wed Aug 29 11:02:52 2018 +0200 Accept sent on behalf of as the sender address * src/mail.cpp (Mail::updateOOMData_o): Cache sent on behalf. (Mail::updateSigstate): Fallback to sent on behalf. (m_sent_on_behalf): New cache variable. * src/oomhelp.cpp (get_sender_SentRepresentingAddress): New. -- Outlook clearly shows in the mail: "foo at bar.baz at behalf of foo2 at bar.baz" So we can accept "foo2 at bar.baz" also as the sender address as it is visible. GnuPG-Bug-ID: T4110 diff --git a/src/mail.cpp b/src/mail.cpp index eeddb92..04d0b8e 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1601,6 +1601,16 @@ Mail::updateOOMData_o () /* Try the sender Object */ buf = get_sender_Sender (m_mailitem); } + + /* We also want to cache sent representing email address so that + we can use it for verification information. */ + char *buf2 = get_sender_SentRepresentingAddress (m_mailitem); + + if (buf2) + { + m_sent_on_behalf = buf2; + xfree (buf2); + } } if (!buf) @@ -2014,6 +2024,17 @@ Mail::updateSigstate () true); m_uid = get_uid_for_sender (key, sender.c_str()); + if (m_uid.isNull() && !m_sent_on_behalf.empty ()) + { + m_uid = get_uid_for_sender (key, m_sent_on_behalf.c_str ()); + if (!m_uid.isNull()) + { + log_debug ("%s:%s: Using sent on behalf '%s' instead of '%s'", + SRCNAME, __func__, m_sent_on_behalf.c_str(), + sender.c_str ()); + } + } + if ((sig.summary() & Signature::Summary::Valid) && m_uid.origin() == GpgME::Key::OriginWKD && (sig.validity() == Signature::Validity::Unknown || diff --git a/src/mail.h b/src/mail.h index ee7fcac..7865336 100644 --- a/src/mail.h +++ b/src/mail.h @@ -617,6 +617,7 @@ private: int m_moss_position; /* The number of the original message attachment. */ int m_crypto_flags; std::string m_sender; + std::string m_sent_on_behalf; char *m_cached_html_body; /* Cached html body. */ char *m_cached_plain_body; /* Cached plain body. */ std::vector m_cached_recipients; diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp index 06fd72d..0870b34 100644 --- a/src/oomhelp.cpp +++ b/src/oomhelp.cpp @@ -2213,6 +2213,21 @@ get_sender_SenderEMailAddress (LPDISPATCH mailitem) } char * +get_sender_SentRepresentingAddress (LPDISPATCH mailitem) +{ + char *buf = get_pa_string (mailitem, + PR_SENT_REPRESENTING_EMAIL_ADDRESS_W_DASL); + if (buf && strlen (buf)) + { + log_debug ("%s:%s Found sent representing address \"%s\"", + SRCNAME, __func__, buf); + return buf; + } + xfree (buf); + return nullptr; +} + +char * get_inline_body () { LPDISPATCH app = GpgolAddin::get_instance ()->get_application (); diff --git a/src/oomhelp.h b/src/oomhelp.h index ca7c1fd..0ef2c01 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -135,6 +135,8 @@ DEFINE_OLEGUID(IID_IOleWindow, 0x00000114, 0, 0); "http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/content-type/0x0000001F" #define PR_BLOCK_STATUS_DASL \ "http://schemas.microsoft.com/mapi/proptag/0x10960003" +#define PR_SENT_REPRESENTING_EMAIL_ADDRESS_W_DASL \ + "http://schemas.microsoft.com/mapi/proptag/0x0065001F" #define DISTRIBUTION_LIST_ADDRESS_ENTRY_TYPE 11 @@ -357,6 +359,7 @@ char *get_sender_CurrentUser (LPDISPATCH mailitem); char *get_sender_Sender (LPDISPATCH mailitem); char *get_sender_SenderEMailAddress (LPDISPATCH mailitem); + /* Get the body of the active inline response */ char *get_inline_body (void); @@ -370,6 +373,9 @@ int get_ol_ui_language (void); char *get_sender_SendUsingAccount (LPDISPATCH mailitem, bool *r_is_GSuite); +/* Get the SentRepresentingAddress */ +char *get_sender_SentRepresentingAddress (LPDISPATCH mailitem); + /* memtracing query interface */ HRESULT gpgol_queryInterface (LPUNKNOWN pObj, REFIID riid, LPVOID FAR *ppvObj); commit 9e5ad3f129751f0d4d236b34850d7127780f6ae8 Author: Andre Heinecke Date: Wed Aug 29 10:37:11 2018 +0200 Fix minor locking issue * src/keycache.cpp (KeyCache::Private::getByFpr): Use a copy to return after unlocking the map. -- I'm not sure if this is neccessary as the iterator is const but better be safe. diff --git a/src/keycache.cpp b/src/keycache.cpp index 58e7c67..2331c89 100644 --- a/src/keycache.cpp +++ b/src/keycache.cpp @@ -456,8 +456,9 @@ public: const auto keyIt = m_fpr_map.find (primaryFpr); if (keyIt != m_fpr_map.end ()) { + const auto ret = keyIt->second; gpgrt_lock_unlock (&fpr_map_lock); - return keyIt->second; + return ret; } gpgrt_lock_unlock (&fpr_map_lock); return GpgME::Key(); commit 59e8a7ee3bcd16275091c9535626e49fc2a6c4af Author: Andre Heinecke Date: Wed Aug 29 10:30:02 2018 +0200 Use dispcache for Multilanguage COM interface * src/dialogs.h (DISPID_MULTILANG): New. * src/mlang-charset.cpp (ansi_charset_to_utf8): Use dispcache. -- Using CoCreateInstance for every string to convert seemed excessive so we better cache it. GnuPG-Bug-Id: T4114 diff --git a/src/dialogs.h b/src/dialogs.h index 217b0d0..4510fb5 100644 --- a/src/dialogs.h +++ b/src/dialogs.h @@ -75,4 +75,7 @@ #define IDI_LEVEL_3_ENC (IDI_LEVEL_3 + ENCRYPT_ICON_OFFSET) #define IDI_LEVEL_4_ENC (IDI_LEVEL_4 + ENCRYPT_ICON_OFFSET) +/* Other ids */ +#define DISPID_MLANG_CHARSET 0x7000 + #endif /*DIALOGS_H*/ diff --git a/src/mlang-charset.cpp b/src/mlang-charset.cpp index e9b327a..0529856 100644 --- a/src/mlang-charset.cpp +++ b/src/mlang-charset.cpp @@ -29,6 +29,9 @@ DEFINE_GUID (IID_IMultiLanguage, 0x275c23e1,0x3747,0x11d0,0x9f, #include #undef INITGUID +#include "dialogs.h" +#include "dispcache.h" + #include "mlang-charset.h" char *ansi_charset_to_utf8 (const char *charset, const char *input, @@ -51,9 +54,21 @@ char *ansi_charset_to_utf8 (const char *charset, const char *input, return xstrdup (input); } - CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, - IID_IMultiLanguage, (void**)&multilang); - memdbg_addRef (multilang); + auto cache = DispCache::instance (); + LPDISPATCH cachedLang = cache->getDisp (DISPID_MLANG_CHARSET); + + if (!cachedLang) + { + CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, + IID_IMultiLanguage, (void**)&multilang); + memdbg_addRef (multilang); + cache->addDisp (DISPID_MLANG_CHARSET, (LPDISPATCH) multilang); + } + else + { + multilang = (LPMULTILANGUAGE) cachedLang; + } + if (!multilang) { @@ -108,7 +123,6 @@ char *ansi_charset_to_utf8 (const char *charset, const char *input, err = multilang->ConvertStringToUnicode(&mode, enc, const_cast(input), &uinlen, buf, &wlen); - gpgol_release (multilang); if (FAILED (err)) { log_error ("%s:%s: Failed conversion 2.", commit b6cfbd077e9453dd16e09fff22ec014bc1ee282d Author: Andre Heinecke Date: Wed Aug 29 10:24:14 2018 +0200 Add generic cache for IDispatch objects * src/dispcache.cpp, src/dispcache.h: New. * src/gpgoladdin.cpp, src/gpgoladdin.h: Carry dispcache as member. * src/Makefile.am: Add new Files. -- The cache shares the lifetime of the addin object and can be used to keep IDispatch object around without having to create them again and again. diff --git a/src/Makefile.am b/src/Makefile.am index 599394f..7906794 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,6 +35,7 @@ gpgol_SOURCES = \ cpphelp.cpp cpphelp.h \ cryptcontroller.cpp cryptcontroller.h \ dialogs.h \ + dispcache.h dispcache.cpp \ eventsink.h \ eventsinks.h \ exechelp.c exechelp.h \ diff --git a/src/dispcache.cpp b/src/dispcache.cpp new file mode 100644 index 0000000..7b1bbf3 --- /dev/null +++ b/src/dispcache.cpp @@ -0,0 +1,114 @@ +/* Copyright (C) 2018 Intevation GmbH + * + * This file is part of GpgOL. + * + * GpgOL is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * GpgOL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, see . + */ + +#include "dispcache.h" +#include "gpg-error.h" + +#include "common.h" +#include "gpgoladdin.h" + +#include + +GPGRT_LOCK_DEFINE (cache_lock); + +class DispCache::Private +{ +public: + Private() + { + + } + + void addDisp (int id, LPDISPATCH obj) + { + if (!id || !obj) + { + TRACEPOINT; + return; + } + gpgrt_lock_lock (&cache_lock); + auto it = m_cache.find (id); + if (it != m_cache.end ()) + { + log_debug ("%s:%s Item \"%i\" already cached. Replacing it.", + SRCNAME, __func__, id); + gpgol_release (it->second); + it->second = obj; + gpgrt_lock_unlock (&cache_lock); + return; + } + m_cache.insert (std::make_pair (id, obj)); + gpgrt_lock_unlock (&cache_lock); + return; + } + + LPDISPATCH getDisp (int id) + { + if (!id) + { + TRACEPOINT; + return nullptr; + } + gpgrt_lock_lock (&cache_lock); + + const auto it = m_cache.find (id); + if (it != m_cache.end()) + { + LPDISPATCH ret = it->second; + gpgrt_lock_unlock (&cache_lock); + return ret; + } + gpgrt_lock_unlock (&cache_lock); + return nullptr; + } + + ~Private () + { + gpgrt_lock_lock (&cache_lock); + for (const auto it: m_cache) + { + gpgol_release (it.second); + } + gpgrt_lock_unlock (&cache_lock); + } + +private: + std::unordered_map m_cache; +}; + +DispCache::DispCache (): d (new Private) +{ +} + +void +DispCache::addDisp (int id, LPDISPATCH obj) +{ + d->addDisp (id, obj); +} + +LPDISPATCH +DispCache::getDisp (int id) +{ + return d->getDisp (id); +} + +DispCache * +DispCache::instance () +{ + return GpgolAddin::get_instance ()->get_dispcache ().get (); +} diff --git a/src/dispcache.h b/src/dispcache.h new file mode 100644 index 0000000..465665d --- /dev/null +++ b/src/dispcache.h @@ -0,0 +1,60 @@ +/* @file dispcache.h + * @brief Cache for IDispatch objects that are reusable. + * + * Copyright (C) 2018 Intevation GmbH + * + * This file is part of GpgOL. + * + * GpgOL is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * GpgOL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, see . + */ +#ifndef DISPCACHE_H +#define DISPCACHE_H + +#include "config.h" + +#include + +#include "oomhelp.h" + +class GpgolAddin; + +class DispCache +{ + friend class GpgolAddin; +protected: + DispCache (); + +public: + /* Accessor. Returns the instance carried by + gpgoladdin. */ + static DispCache *instance (); + + /* Add a IDispatch with the id id to the cache. + + The IDispatch is released on destruction of + the cache. + + Id's are meant to be defined in dialogs.h + */ + void addDisp (int id, LPDISPATCH obj); + + /* Get the according IDispatch object. */ + LPDISPATCH getDisp (int id); + +private: + class Private; + std::shared_ptr d; +}; + +#endif diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp index abf8e71..e331b86 100644 --- a/src/gpgoladdin.cpp +++ b/src/gpgoladdin.cpp @@ -47,6 +47,7 @@ #include "mail.h" #include "addin-options.h" #include "cpphelp.h" +#include "dispcache.h" #include #include @@ -178,7 +179,8 @@ GpgolAddin::GpgolAddin (void) : m_lRef(0), m_explorersEventSink(nullptr), m_disabled(false), m_shutdown(false), - m_hook(nullptr) + m_hook(nullptr), + m_dispcache(new DispCache) { read_options (); /* RibbonExtender is it's own object to avoid the pitfalls of diff --git a/src/gpgoladdin.h b/src/gpgoladdin.h index a8c121b..1641942 100644 --- a/src/gpgoladdin.h +++ b/src/gpgoladdin.h @@ -27,9 +27,11 @@ #include "mymapi.h" #include +#include class GpgolAddinRibbonExt; class ApplicationEventListener; +class DispCache; /* Enums for the IDTExtensibility2 interface*/ typedef enum @@ -212,6 +214,7 @@ public: crypto mails. */ void shutdown (); LPDISPATCH get_application () { return m_application; } + std::shared_ptr get_dispcache () { return m_dispcache; } bool isShutdown() { return m_shutdown; }; private: @@ -227,6 +230,7 @@ private: bool m_shutdown; HHOOK m_hook; std::vector m_explorerEventSinks; + std::shared_ptr m_dispcache; }; class GpgolAddinFactory: public IClassFactory commit 283892c73ddeb20a16262a0f66ea2e2e9507e57c Author: Andre Heinecke Date: Wed Aug 29 10:14:10 2018 +0200 Add missing word from config dialog to i18n * src/addin-options.cpp: Add (Technical) diff --git a/src/addin-options.cpp b/src/addin-options.cpp index f81bed8..05848a6 100644 --- a/src/addin-options.cpp +++ b/src/addin-options.cpp @@ -41,6 +41,7 @@ i18n_noops[] = { N_("Configure GpgOL"), N_("Automation"), N_("General"), + N_("(Technical)"), N_("Automatically secure &messages"), N_("Configure GnuPG"), commit c2c93b0814955019c8a64a2cb8b4721fff100bd7 Author: Andre Heinecke Date: Wed Aug 29 09:10:13 2018 +0200 Remove attic * src/attic.c: Deleted. -- This was dead / old code that was just confusing to have lying around. diff --git a/src/attic.c b/src/attic.c deleted file mode 100644 index 4c30f9a..0000000 --- a/src/attic.c +++ /dev/null @@ -1,147 +0,0 @@ -/* Check whether the preview pane is visisble. Returns: - -1 := Don't know. - 0 := No - 1 := Yes. - */ -int -is_preview_pane_visible (LPEXCHEXTCALLBACK eecb) -{ - HRESULT hr; - LPDISPATCH pDisp; - DISPID dispid; - DISPPARAMS dispparams; - VARIANT aVariant, rVariant; - - pDisp = find_outlook_property (eecb, - "Application.ActiveExplorer.IsPaneVisible", - &dispid); - if (!pDisp) - { - log_debug ("%s:%s: ActiveExplorer.IsPaneVisible NOT found\n", - SRCNAME, __func__); - return -1; - } - - dispparams.rgvarg = &aVariant; - dispparams.rgvarg[0].vt = VT_INT; - dispparams.rgvarg[0].intVal = 3; /* olPreview */ - dispparams.cArgs = 1; - dispparams.cNamedArgs = 0; - rVariant.bstrVal = NULL; - hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, - DISPATCH_METHOD, &dispparams, - &rVariant, NULL, NULL); - gpgol_release (pDisp); - pDisp = NULL; - if (hr == S_OK && rVariant.vt != VT_BOOL) - { - log_debug ("%s:%s: invoking IsPaneVisible succeeded but vt is %d", - SRCNAME, __func__, rVariant.vt); - if (rVariant.vt == VT_BSTR && rVariant.bstrVal) - SysFreeString (rVariant.bstrVal); - return -1; - } - if (hr != S_OK) - { - log_debug ("%s:%s: invoking IsPaneVisible failed: %#lx", - SRCNAME, __func__, hr); - return -1; - } - - return !!rVariant.boolVal; - -} - - -/* Set the preview pane to visible if visble is true or to invisible - if visible is false. */ -void -show_preview_pane (LPEXCHEXTCALLBACK eecb, int visible) -{ - HRESULT hr; - LPDISPATCH pDisp; - DISPID dispid; - DISPPARAMS dispparams; - VARIANT aVariant[2]; - - pDisp = find_outlook_property (eecb, - "Application.ActiveExplorer.ShowPane", - &dispid); - if (!pDisp) - { - log_debug ("%s:%s: ActiveExplorer.ShowPane NOT found\n", - SRCNAME, __func__); - return; - } - - dispparams.rgvarg = aVariant; - dispparams.rgvarg[0].vt = VT_BOOL; - dispparams.rgvarg[0].boolVal = !!visible; - dispparams.rgvarg[1].vt = VT_INT; - dispparams.rgvarg[1].intVal = 3; /* olPreview */ - dispparams.cArgs = 2; - dispparams.cNamedArgs = 0; - hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, - DISPATCH_METHOD, &dispparams, - NULL, NULL, NULL); - gpgol_release (pDisp); - pDisp = NULL; - if (hr != S_OK) - log_debug ("%s:%s: invoking ShowPane(%d) failed: %#lx", - SRCNAME, __func__, visible, hr); -} - - -/*** -Outlook interop ? stopping user properties appearing on Outlook message print - -Here?s a weird one? we were adding user properties to a message using the IUserProperties interface, but whenever we did this the property would render when the message was printed. This included whenever the message was sent to a recipient within the same Exchange organisation. - -Last time I had to ask Microsoft PSS to help was 1992, and in that case they were nice enough to send me a handcrafted sample application on a 3.5? floppy. This time however they got back to me in a day with this little code snippet: - -void MarkPropNoPrint(Outlook.MailItem message, string propertyName) -{ -// Late Binding in .NET -// http://support.microsoft.com/default.aspx?scid=kb;EN-US;302902 -Type userPropertyType; -long dispidMember = 107; -long ulPropPrintable = 0?4; -string dispMemberName = String.Format(?[DispID={0}]?, dispidMember); -object[] dispParams; -Microsoft.Office.Interop.Outlook.UserProperty userProperty = message.UserProperties[propertyName]; - -if (null == userProperty) return; -userPropertyType = userProperty.GetType(); - -// Call IDispatch::Invoke to get the current flags -object flags = userPropertyType.InvokeMember(dispMemberName, System.Reflection.BindingFlags.GetProperty, null, userProperty, null); -long lFlags = long.Parse(flags.ToString()); - -// Remove the hidden property Printable flag -lFlags &= ~ulPropPrintable; - -// Place the new flags property into an argument array -dispParams = new object[] {lFlags}; - -// Call IDispatch::Invoke to set the current flags -userPropertyType.InvokeMember(dispMemberName, -System.Reflection.BindingFlags.SetProperty, null, userProperty, dispParams); -} - -Srsly? there is no way I would have worked that out for myself? - -*/ - - - -/* HOWTO get the Window handle */ - -/* Use FindWindow. Use the Inspector.Caption property (be aware that on long */ -/* captions the result will be truncated at about 255 characters). The class */ -/* name to use for the Inspector window is "rctrl_renwnd32". */ - -/* I usually set any dialogs as modal to the Inspector window using */ -/* SetWindowLong, then the dialog would end up in front of the mail window, */ -/* which would be in front of the Outlook Explorer window. */ - - ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 1 + src/addin-options.cpp | 1 + src/attic.c | 147 ----------------------------------------- src/dialogs.h | 3 + src/dispcache.cpp | 114 ++++++++++++++++++++++++++++++++ src/{overlay.h => dispcache.h} | 51 ++++++++------ src/gpgoladdin.cpp | 4 +- src/gpgoladdin.h | 4 ++ src/keycache.cpp | 3 +- src/mail.cpp | 21 ++++++ src/mail.h | 1 + src/mlang-charset.cpp | 22 ++++-- src/oomhelp.cpp | 15 +++++ src/oomhelp.h | 6 ++ src/ribbon-callbacks.cpp | 50 +++++++++----- 15 files changed, 256 insertions(+), 187 deletions(-) delete mode 100644 src/attic.c create mode 100644 src/dispcache.cpp copy src/{overlay.h => dispcache.h} (50%) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 12:06:27 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 12:06:27 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-199-ged8fe21 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via ed8fe21e6612401846fc4af8631f0136dc633c67 (commit) from 53bbac0865719076f7ad7bb57e13f656bd6edf39 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ed8fe21e6612401846fc4af8631f0136dc633c67 Author: Werner Koch Date: Wed Aug 29 11:53:59 2018 +0200 gpg: Remove unused function get_pubkeys. * g10/getkey.c (get_pubkeys): Remove. (pubkey_free): Remove and use code directly ... (pubkeys_free): ... here. Signed-off-by: Werner Koch diff --git a/g10/getkey.c b/g10/getkey.c index b8fdb0c..ea2dee2 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -394,280 +394,21 @@ getkey_disable_caches () } -void -pubkey_free (pubkey_t key) -{ - if (key) - { - xfree (key->pk); - release_kbnode (key->keyblock); - xfree (key); - } -} - +/* Free a list of pubkey_t objects. */ void pubkeys_free (pubkey_t keys) { while (keys) { pubkey_t next = keys->next; - pubkey_free (keys); + xfree (keys->pk); + release_kbnode (keys->keyblock); + xfree (keys); keys = next; } } -/* Returns all keys that match the search specification SEARCH_TERMS. - * - * This function also checks for and warns about duplicate entries in - * the keydb, which can occur if the user has configured multiple - * keyrings or keyboxes or if a keyring or keybox was corrupted. - * - * Note: SEARCH_TERMS will not be expanded (i.e., it may not be a - * group). - * - * USE is the operation for which the key is required. It must be - * either PUBKEY_USAGE_ENC, PUBKEY_USAGE_SIG, PUBKEY_USAGE_CERT or - * PUBKEY_USAGE_AUTH. - * - * INCLUDE_UNUSABLE indicates whether disabled keys are allowed. - * (Recipients specified with --encrypt-to and --hidden-encrypt-to may - * be disabled. It is possible to edit disabled keys.) - * - * SOURCE is the context in which SEARCH_TERMS was specified, e.g., - * "--encrypt-to", etc. If this function is called interactively, - * then this should be NULL. - * - * If WARN_POSSIBLY_AMBIGUOUS is set, then emits a warning if the user - * does not specify a long key id or a fingerprint. - * - * The results are placed in *KEYS. *KEYS must be NULL! - * - * Fixme: Currently, only PUBKEY_USAGE_ENC and PUBKEY_USAGE_SIG are - * implemented. */ -gpg_error_t -get_pubkeys (ctrl_t ctrl, - char *search_terms, int use, int include_unusable, char *source, - int warn_possibly_ambiguous, - pubkey_t *r_keys) -{ - /* We show a warning when a key appears multiple times in the DB. - * This can happen for two reasons: - * - * - The user has configured multiple keyrings or keyboxes. - * - * - The keyring or keybox has been corrupted in some way, e.g., a - * bug or a random process changing them. - * - * For each duplicate, we only want to show the key once. Hence, - * this list. */ - static strlist_t key_dups; - gpg_error_t err; - char *use_str; /* USE transformed to a string. */ - KEYDB_SEARCH_DESC desc; - GETKEY_CTX ctx; - pubkey_t results = NULL; - pubkey_t r; - int count; - char fingerprint[2 * MAX_FINGERPRINT_LEN + 1]; - - if (DBG_LOOKUP) - { - log_debug ("\n"); - log_debug ("%s: Checking %s=%s\n", - __func__, source ? source : "user input", search_terms); - } - - if (*r_keys) - log_bug ("%s: KEYS should be NULL!\n", __func__); - - switch (use) - { - case PUBKEY_USAGE_ENC: use_str = "encrypt"; break; - case PUBKEY_USAGE_SIG: use_str = "sign"; break; - case PUBKEY_USAGE_CERT: use_str = "cetify"; break; - case PUBKEY_USAGE_AUTH: use_str = "authentication"; break; - default: log_bug ("%s: Bad value for USE (%d)\n", __func__, use); - } - - if (use == PUBKEY_USAGE_CERT || use == PUBKEY_USAGE_AUTH) - log_bug ("%s: use=%s is unimplemented.\n", __func__, use_str); - - err = classify_user_id (search_terms, &desc, 1); - if (err) - { - log_info (_("key \"%s\" not found: %s\n"), - search_terms, gpg_strerror (err)); - if (!opt.quiet && source) - log_info (_("(check argument of option '%s')\n"), source); - goto leave; - } - - if (warn_possibly_ambiguous - && ! (desc.mode == KEYDB_SEARCH_MODE_LONG_KID - || desc.mode == KEYDB_SEARCH_MODE_FPR16 - || desc.mode == KEYDB_SEARCH_MODE_FPR20 - || desc.mode == KEYDB_SEARCH_MODE_FPR)) - { - log_info (_("Warning: '%s' should be a long key ID or a fingerprint\n"), - search_terms); - if (!opt.quiet && source) - log_info (_("(check argument of option '%s')\n"), source); - } - - /* Gather all of the results. */ - ctx = NULL; - count = 0; - do - { - PKT_public_key *pk; - KBNODE kb; - - pk = xtrycalloc (1, sizeof *pk); - if (!pk) - { - err = gpg_error_from_syserror (); - goto leave; - } - - pk->req_usage = use; - - if (! ctx) - err = get_pubkey_byname (ctrl, &ctx, pk, search_terms, &kb, NULL, - include_unusable, 1); - else - err = getkey_next (ctrl, ctx, pk, &kb); - - if (gpg_err_code (err) == GPG_ERR_NOT_FOUND) /* No more results. */ - { - xfree (pk); - break; - } - else if (err) /* An error (other than "not found"). */ - { - log_error (_("error looking up: %s\n"), gpg_strerror (err)); - xfree (pk); - break; - } - - /* Another result! */ - count ++; - - r = xtrycalloc (1, sizeof (*r)); - if (!r) - { - err = gpg_error_from_syserror (); - xfree (pk); - goto leave; - } - r->pk = pk; - r->keyblock = kb; - r->next = results; - results = r; - } - while (ctx); - getkey_end (ctrl, ctx); - - if (DBG_LOOKUP) - { - log_debug ("%s resulted in %d matches.\n", search_terms, count); - for (r = results; r; r = r->next) - log_debug (" %s\n", - hexfingerprint (r->keyblock->pkt->pkt.public_key, - fingerprint, sizeof (fingerprint))); - } - - if (! results && gpg_err_code (err) == GPG_ERR_NOT_FOUND) - { /* No match. */ - if (DBG_LOOKUP) - log_debug ("%s: '%s' not found.\n", __func__, search_terms); - - log_info (_("key \"%s\" not found\n"), search_terms); - if (!opt.quiet && source) - log_info (_("(check argument of option '%s')\n"), source); - - goto leave; - } - else if (gpg_err_code (err) == GPG_ERR_NOT_FOUND) - ; /* No more matches. */ - else if (err) - { /* Some other error. An error message was already printed out. - * Free RESULTS and continue. */ - goto leave; - } - - /* Check for duplicates. */ - if (DBG_LOOKUP) - log_debug ("%s: Checking results of %s='%s' for dups\n", - __func__, source ? source : "user input", search_terms); - count = 0; - for (r = results; r; r = r->next) - { - pubkey_t *prevp; - pubkey_t next; - pubkey_t r2; - int dups = 0; - - prevp = &r->next; - next = r->next; - while ((r2 = next)) - { - if (cmp_public_keys (r->keyblock->pkt->pkt.public_key, - r2->keyblock->pkt->pkt.public_key) != 0) - { /* Not a dup. */ - prevp = &r2->next; - next = r2->next; - continue; - } - - dups ++; - count ++; - - /* Remove R2 from the list. */ - *prevp = r2->next; - release_kbnode (r2->keyblock); - next = r2->next; - xfree (r2); - } - - if (dups) - { - hexfingerprint (r->keyblock->pkt->pkt.public_key, - fingerprint, sizeof fingerprint); - if (! strlist_find (key_dups, fingerprint)) - { - char fingerprint_formatted[MAX_FORMATTED_FINGERPRINT_LEN + 1]; - - log_info (_("Warning: %s appears in the keyring %d times\n"), - format_hexfingerprint (fingerprint, - fingerprint_formatted, - sizeof fingerprint_formatted), - 1 + dups); - add_to_strlist (&key_dups, fingerprint); - } - } - } - - if (DBG_LOOKUP && count) - { - log_debug ("After removing %d dups:\n", count); - for (r = results, count = 0; r; r = r->next) - log_debug (" %d: %s\n", - count, - hexfingerprint (r->keyblock->pkt->pkt.public_key, - fingerprint, sizeof fingerprint)); - } - - leave: - if (err) - pubkeys_free (results); - else - *r_keys = results; - - return err; -} - - static void pk_from_block (PKT_public_key *pk, kbnode_t keyblock, kbnode_t found_key) { diff --git a/g10/keydb.h b/g10/keydb.h index 5ab0d58..1def2bb 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -342,20 +342,9 @@ struct pubkey_s }; typedef struct pubkey_s *pubkey_t; -/* Free a single key. This does not remove key from any list! */ -void pubkey_free (pubkey_t key); - /* Free a list of public keys. */ void pubkeys_free (pubkey_t keys); -/* Returns all keys that match the search specification SEARCH_TERMS. - The returned keys should be freed using pubkeys_free. */ -gpg_error_t -get_pubkeys (ctrl_t ctrl, - char *search_terms, int use, int include_unusable, char *source, - int warn_possibly_ambiguous, - pubkey_t *r_keys); - /* Find a public key identified by NAME. */ int get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 267 +---------------------------------------------------------- g10/keydb.h | 11 --- 2 files changed, 4 insertions(+), 274 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 12:31:08 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 12:31:08 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-16-g719fc94 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 719fc941b6eceb75c2326335d9d73011823ff3f9 (commit) from 3169b5ae3f21849354b1413644d3e545c0b08c73 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 719fc941b6eceb75c2326335d9d73011823ff3f9 Author: Werner Koch Date: Wed Aug 29 11:53:59 2018 +0200 gpg: Remove unused function get_pubkeys. * g10/getkey.c (get_pubkeys): Remove. (pubkey_free): Remove and use code directly ... (pubkeys_free): ... here. Signed-off-by: Werner Koch (cherry picked from commit ed8fe21e6612401846fc4af8631f0136dc633c67) diff --git a/g10/getkey.c b/g10/getkey.c index be81d99..c4afe45 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -394,280 +394,21 @@ getkey_disable_caches () } -void -pubkey_free (pubkey_t key) -{ - if (key) - { - xfree (key->pk); - release_kbnode (key->keyblock); - xfree (key); - } -} - +/* Free a list of pubkey_t objects. */ void pubkeys_free (pubkey_t keys) { while (keys) { pubkey_t next = keys->next; - pubkey_free (keys); + xfree (keys->pk); + release_kbnode (keys->keyblock); + xfree (keys); keys = next; } } -/* Returns all keys that match the search specification SEARCH_TERMS. - * - * This function also checks for and warns about duplicate entries in - * the keydb, which can occur if the user has configured multiple - * keyrings or keyboxes or if a keyring or keybox was corrupted. - * - * Note: SEARCH_TERMS will not be expanded (i.e., it may not be a - * group). - * - * USE is the operation for which the key is required. It must be - * either PUBKEY_USAGE_ENC, PUBKEY_USAGE_SIG, PUBKEY_USAGE_CERT or - * PUBKEY_USAGE_AUTH. - * - * INCLUDE_UNUSABLE indicates whether disabled keys are allowed. - * (Recipients specified with --encrypt-to and --hidden-encrypt-to may - * be disabled. It is possible to edit disabled keys.) - * - * SOURCE is the context in which SEARCH_TERMS was specified, e.g., - * "--encrypt-to", etc. If this function is called interactively, - * then this should be NULL. - * - * If WARN_POSSIBLY_AMBIGUOUS is set, then emits a warning if the user - * does not specify a long key id or a fingerprint. - * - * The results are placed in *KEYS. *KEYS must be NULL! - * - * Fixme: Currently, only PUBKEY_USAGE_ENC and PUBKEY_USAGE_SIG are - * implemented. */ -gpg_error_t -get_pubkeys (ctrl_t ctrl, - char *search_terms, int use, int include_unusable, char *source, - int warn_possibly_ambiguous, - pubkey_t *r_keys) -{ - /* We show a warning when a key appears multiple times in the DB. - * This can happen for two reasons: - * - * - The user has configured multiple keyrings or keyboxes. - * - * - The keyring or keybox has been corrupted in some way, e.g., a - * bug or a random process changing them. - * - * For each duplicate, we only want to show the key once. Hence, - * this list. */ - static strlist_t key_dups; - gpg_error_t err; - char *use_str; /* USE transformed to a string. */ - KEYDB_SEARCH_DESC desc; - GETKEY_CTX ctx; - pubkey_t results = NULL; - pubkey_t r; - int count; - char fingerprint[2 * MAX_FINGERPRINT_LEN + 1]; - - if (DBG_LOOKUP) - { - log_debug ("\n"); - log_debug ("%s: Checking %s=%s\n", - __func__, source ? source : "user input", search_terms); - } - - if (*r_keys) - log_bug ("%s: KEYS should be NULL!\n", __func__); - - switch (use) - { - case PUBKEY_USAGE_ENC: use_str = "encrypt"; break; - case PUBKEY_USAGE_SIG: use_str = "sign"; break; - case PUBKEY_USAGE_CERT: use_str = "cetify"; break; - case PUBKEY_USAGE_AUTH: use_str = "authentication"; break; - default: log_bug ("%s: Bad value for USE (%d)\n", __func__, use); - } - - if (use == PUBKEY_USAGE_CERT || use == PUBKEY_USAGE_AUTH) - log_bug ("%s: use=%s is unimplemented.\n", __func__, use_str); - - err = classify_user_id (search_terms, &desc, 1); - if (err) - { - log_info (_("key \"%s\" not found: %s\n"), - search_terms, gpg_strerror (err)); - if (!opt.quiet && source) - log_info (_("(check argument of option '%s')\n"), source); - goto leave; - } - - if (warn_possibly_ambiguous - && ! (desc.mode == KEYDB_SEARCH_MODE_LONG_KID - || desc.mode == KEYDB_SEARCH_MODE_FPR16 - || desc.mode == KEYDB_SEARCH_MODE_FPR20 - || desc.mode == KEYDB_SEARCH_MODE_FPR)) - { - log_info (_("Warning: '%s' should be a long key ID or a fingerprint\n"), - search_terms); - if (!opt.quiet && source) - log_info (_("(check argument of option '%s')\n"), source); - } - - /* Gather all of the results. */ - ctx = NULL; - count = 0; - do - { - PKT_public_key *pk; - KBNODE kb; - - pk = xtrycalloc (1, sizeof *pk); - if (!pk) - { - err = gpg_error_from_syserror (); - goto leave; - } - - pk->req_usage = use; - - if (! ctx) - err = get_pubkey_byname (ctrl, &ctx, pk, search_terms, &kb, NULL, - include_unusable, 1); - else - err = getkey_next (ctrl, ctx, pk, &kb); - - if (gpg_err_code (err) == GPG_ERR_NOT_FOUND) /* No more results. */ - { - xfree (pk); - break; - } - else if (err) /* An error (other than "not found"). */ - { - log_error (_("error looking up: %s\n"), gpg_strerror (err)); - xfree (pk); - break; - } - - /* Another result! */ - count ++; - - r = xtrycalloc (1, sizeof (*r)); - if (!r) - { - err = gpg_error_from_syserror (); - xfree (pk); - goto leave; - } - r->pk = pk; - r->keyblock = kb; - r->next = results; - results = r; - } - while (ctx); - getkey_end (ctrl, ctx); - - if (DBG_LOOKUP) - { - log_debug ("%s resulted in %d matches.\n", search_terms, count); - for (r = results; r; r = r->next) - log_debug (" %s\n", - hexfingerprint (r->keyblock->pkt->pkt.public_key, - fingerprint, sizeof (fingerprint))); - } - - if (! results && gpg_err_code (err) == GPG_ERR_NOT_FOUND) - { /* No match. */ - if (DBG_LOOKUP) - log_debug ("%s: '%s' not found.\n", __func__, search_terms); - - log_info (_("key \"%s\" not found\n"), search_terms); - if (!opt.quiet && source) - log_info (_("(check argument of option '%s')\n"), source); - - goto leave; - } - else if (gpg_err_code (err) == GPG_ERR_NOT_FOUND) - ; /* No more matches. */ - else if (err) - { /* Some other error. An error message was already printed out. - * Free RESULTS and continue. */ - goto leave; - } - - /* Check for duplicates. */ - if (DBG_LOOKUP) - log_debug ("%s: Checking results of %s='%s' for dups\n", - __func__, source ? source : "user input", search_terms); - count = 0; - for (r = results; r; r = r->next) - { - pubkey_t *prevp; - pubkey_t next; - pubkey_t r2; - int dups = 0; - - prevp = &r->next; - next = r->next; - while ((r2 = next)) - { - if (cmp_public_keys (r->keyblock->pkt->pkt.public_key, - r2->keyblock->pkt->pkt.public_key) != 0) - { /* Not a dup. */ - prevp = &r2->next; - next = r2->next; - continue; - } - - dups ++; - count ++; - - /* Remove R2 from the list. */ - *prevp = r2->next; - release_kbnode (r2->keyblock); - next = r2->next; - xfree (r2); - } - - if (dups) - { - hexfingerprint (r->keyblock->pkt->pkt.public_key, - fingerprint, sizeof fingerprint); - if (! strlist_find (key_dups, fingerprint)) - { - char fingerprint_formatted[MAX_FORMATTED_FINGERPRINT_LEN + 1]; - - log_info (_("Warning: %s appears in the keyring %d times\n"), - format_hexfingerprint (fingerprint, - fingerprint_formatted, - sizeof fingerprint_formatted), - 1 + dups); - add_to_strlist (&key_dups, fingerprint); - } - } - } - - if (DBG_LOOKUP && count) - { - log_debug ("After removing %d dups:\n", count); - for (r = results, count = 0; r; r = r->next) - log_debug (" %d: %s\n", - count, - hexfingerprint (r->keyblock->pkt->pkt.public_key, - fingerprint, sizeof fingerprint)); - } - - leave: - if (err) - pubkeys_free (results); - else - *r_keys = results; - - return err; -} - - static void pk_from_block (PKT_public_key *pk, kbnode_t keyblock, kbnode_t found_key) { diff --git a/g10/keydb.h b/g10/keydb.h index 7cd628d..6fb4e5e 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -341,20 +341,9 @@ struct pubkey_s }; typedef struct pubkey_s *pubkey_t; -/* Free a single key. This does not remove key from any list! */ -void pubkey_free (pubkey_t key); - /* Free a list of public keys. */ void pubkeys_free (pubkey_t keys); -/* Returns all keys that match the search specification SEARCH_TERMS. - The returned keys should be freed using pubkeys_free. */ -gpg_error_t -get_pubkeys (ctrl_t ctrl, - char *search_terms, int use, int include_unusable, char *source, - int warn_possibly_ambiguous, - pubkey_t *r_keys); - /* Find a public key identified by NAME. */ int get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 267 +---------------------------------------------------------- g10/keydb.h | 11 --- 2 files changed, 4 insertions(+), 274 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 12:33:55 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Wed, 29 Aug 2018 12:33:55 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-253-gf7e5ae7 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via f7e5ae7f1618bd355b885c5c32dd028afad35453 (commit) from 16e566f319004d49f55197238380cc4c03e01f48 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f7e5ae7f1618bd355b885c5c32dd028afad35453 Author: Ben McGinnes Date: Wed Aug 29 20:30:57 2018 +1000 docs: python bindings - protonmail examples * lang/python/docs/GPGMEpythonHOWTOen.org: Updated links to the ProtonMail keyserver import scripts and added a warning regarding being unable to update third party keys. * lang/python/examples/howto/pmkey-import-alt.py: added usage. * lang/python/examples/howto/pmkey-import.py: added usage. diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org index 84ba6a3..4dd3098 100644 --- a/lang/python/docs/GPGMEpythonHOWTOen.org +++ b/lang/python/docs/GPGMEpythonHOWTOen.org @@ -383,7 +383,7 @@ There are two theoretical solutions to this issue: 2. Compile and install Python using the same tools used by choice, such as MinGW or Msys2. -Do *NOT* use the official Windows installer for Python unless +Do *not* use the official Windows installer for Python unless following the first method. In this type of situation it may even be for the best to accept that @@ -785,6 +785,18 @@ The key IDs for all considered keys were: print(e) #+END_SRC +Both the above example, [[../examples/howto/pmkey-import.py][pmkey-import.py]], and a version which prompts +for an alternative GnuPG home directory, [[../examples/howto/pmkey-import-alt.py][pmkey-import-alt.py]], are +available with the other examples and are executable scripts. + +Note that while the ProtonMail servers are based on the SKS servers, +their server is related more to their API and is not feature complete +by comparison to the servers in the SKS pool. One notable difference +being that the ProtonMail server does not permit non ProtonMail users +to update their own keys, which could be a vector for attacking +ProtonMail users who may not receive a key's revocation if it had been +compromised. + ** Exporting keys :PROPERTIES: diff --git a/lang/python/examples/howto/pmkey-import-alt.py b/lang/python/examples/howto/pmkey-import-alt.py index e9521b7..1b260e1 100755 --- a/lang/python/examples/howto/pmkey-import-alt.py +++ b/lang/python/examples/howto/pmkey-import-alt.py @@ -34,6 +34,8 @@ del absolute_import, division, unicode_literals print(""" This script searches the ProtonMail key server for the specified key and imports it. Optionally enables specifying a different GnuPG home directory. + +Usage: pmkey-import-alt.py [search string] [homedir] """) c = gpg.Context(armor=True) diff --git a/lang/python/examples/howto/pmkey-import.py b/lang/python/examples/howto/pmkey-import.py index edbd18e..66ad8aa 100755 --- a/lang/python/examples/howto/pmkey-import.py +++ b/lang/python/examples/howto/pmkey-import.py @@ -33,6 +33,8 @@ del absolute_import, division, unicode_literals print(""" This script searches the ProtonMail key server for the specified key and imports it. + +Usage: pmkey-import.py [search string] """) c = gpg.Context(armor=True) ----------------------------------------------------------------------- Summary of changes: lang/python/docs/GPGMEpythonHOWTOen.org | 14 +++++++++++++- lang/python/examples/howto/pmkey-import-alt.py | 2 ++ lang/python/examples/howto/pmkey-import.py | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 14:33:51 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 29 Aug 2018 14:33:51 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-254-g1420c3b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 1420c3bd681648b032d756536311621a3627bedb (commit) from f7e5ae7f1618bd355b885c5c32dd028afad35453 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1420c3bd681648b032d756536311621a3627bedb Author: Andre Heinecke Date: Wed Aug 29 14:32:36 2018 +0200 json: Fix detached verify * src/gpgme-json.c (op_verify): Only create output and use it for clearsigned and opaque signed. -- Just passing output to gpgme_op_verify changes the behavior to no longer do a verify of the signature. diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 5c670eb..2a8f1d3 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -2173,24 +2173,24 @@ op_verify (cjson_t request, cjson_t result) if (err && err != gpg_error (GPG_ERR_NO_DATA)) goto leave; - /* Create an output data object. */ - err = gpgme_data_new (&output); - if (err) - { - gpg_error_object (result, err, "Error creating output data object: %s", - gpg_strerror (err)); - goto leave; - } - - /* Verify. */ - if (signature) + if (!signature) { - err = gpgme_op_verify (ctx, signature, input, output); + /* Verify opaque or clearsigned we need an output data object. */ + err = gpgme_data_new (&output); + if (err) + { + gpg_error_object (result, err, + "Error creating output data object: %s", + gpg_strerror (err)); + goto leave; + } + err = gpgme_op_verify (ctx, input, 0, output); } else { - err = gpgme_op_verify (ctx, input, 0, output); + err = gpgme_op_verify (ctx, signature, input, NULL); } + if (err) { gpg_error_object (result, err, "Verify failed: %s", gpg_strerror (err)); @@ -2208,14 +2208,17 @@ op_verify (cjson_t request, cjson_t result) verify_result_to_json (verify_result)); } - err = make_data_object (result, output, "plaintext", -1); - output = NULL; - - if (err) + if (output) { - gpg_error_object (result, err, "Plaintext output failed: %s", - gpg_strerror (err)); - goto leave; + err = make_data_object (result, output, "plaintext", -1); + output = NULL; + + if (err) + { + gpg_error_object (result, err, "Plaintext output failed: %s", + gpg_strerror (err)); + goto leave; + } } leave: ----------------------------------------------------------------------- Summary of changes: src/gpgme-json.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 15:13:53 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 15:13:53 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-200-g420dc2b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 420dc2b49ad816bdd27b40db45d900551c71476f (commit) from ed8fe21e6612401846fc4af8631f0136dc633c67 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 420dc2b49ad816bdd27b40db45d900551c71476f Author: Werner Koch Date: Wed Aug 29 15:04:44 2018 +0200 doc: Minor additions to the gpg man page -- Includes a fix for GnuPG-bug-id: 3906 Signed-off-by: Werner Koch diff --git a/doc/gpg.texi b/doc/gpg.texi index c4bc354..7f55cc7 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -675,6 +675,10 @@ supplied passphrase is used for the new key and the agent does not ask for it. To create a key without any protection @code{--passphrase ''} may be used. +Note that it is possible to create a primary key and a subkey using +non-default algorithms by using ``default'' and changing the default +parameters using the option @option{--default-new-key-algo}. + @item --quick-set-expire @var{fpr} @var{expire} [*|@var{subfprs}] @opindex quick-set-expire With two arguments given, directly set the expiration time of the @@ -702,7 +706,8 @@ and other ECC curves. For example the string ``rsa'' adds an RSA key with the default key length; a string ``rsa4096'' requests that the key length is 4096 bits. The string ``future-default'' is an alias for the algorithm which will likely be used as default algorithm in -future versions of gpg. +future versions of gpg. To list the supported ECC curves the command + at code{gpg --with-colons --list-config curve} can be used. Depending on the given @var{algo} the subkey may either be an encryption subkey or a signing subkey. If an algorithm is capable of @@ -3353,13 +3358,14 @@ user. @opindex override-session-key Don't use the public key but the session key @var{string} respective the session key taken from the first line read from file descriptor - at var{fd}. The format of this string is the same as the one printed -by @option{--show-session-key}. This option is normally not used but + at var{fd}. The format of this string is the same as the one printed by + at option{--show-session-key}. This option is normally not used but comes handy in case someone forces you to reveal the content of an encrypted message; using this option you can do this without handing out the secret key. Note that using @option{--override-session-key} may reveal the session key to all local users via the global process -table. +table. Often it is useful to combine this option with + at option{--no-keyring}. @item --ask-sig-expire @itemx --no-ask-sig-expire ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 15:14:43 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 15:14:43 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-17-g2d700f2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 2d700f2c6c1831d8a113b6cf4b8ca81db363b09a (commit) from 719fc941b6eceb75c2326335d9d73011823ff3f9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2d700f2c6c1831d8a113b6cf4b8ca81db363b09a Author: Werner Koch Date: Wed Aug 29 15:04:44 2018 +0200 doc: Minor additions to the gpg man page -- Includes a fix for GnuPG-bug-id: 3906 Signed-off-by: Werner Koch (cherry picked from commit 420dc2b49ad816bdd27b40db45d900551c71476f) diff --git a/doc/gpg.texi b/doc/gpg.texi index dc7e021..3f8f6b9 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -675,6 +675,10 @@ supplied passphrase is used for the new key and the agent does not ask for it. To create a key without any protection @code{--passphrase ''} may be used. +Note that it is possible to create a primary key and a subkey using +non-default algorithms by using ``default'' and changing the default +parameters using the option @option{--default-new-key-algo}. + @item --quick-set-expire @var{fpr} @var{expire} [*|@var{subfprs}] @opindex quick-set-expire With two arguments given, directly set the expiration time of the @@ -702,7 +706,8 @@ and other ECC curves. For example the string ``rsa'' adds an RSA key with the default key length; a string ``rsa4096'' requests that the key length is 4096 bits. The string ``future-default'' is an alias for the algorithm which will likely be used as default algorithm in -future versions of gpg. +future versions of gpg. To list the supported ECC curves the command + at code{gpg --with-colons --list-config curve} can be used. Depending on the given @var{algo} the subkey may either be an encryption subkey or a signing subkey. If an algorithm is capable of @@ -3304,13 +3309,14 @@ user. @opindex override-session-key Don't use the public key but the session key @var{string} respective the session key taken from the first line read from file descriptor - at var{fd}. The format of this string is the same as the one printed -by @option{--show-session-key}. This option is normally not used but + at var{fd}. The format of this string is the same as the one printed by + at option{--show-session-key}. This option is normally not used but comes handy in case someone forces you to reveal the content of an encrypted message; using this option you can do this without handing out the secret key. Note that using @option{--override-session-key} may reveal the session key to all local users via the global process -table. +table. Often it is useful to combine this option with + at option{--no-keyring}. @item --ask-sig-expire @itemx --no-ask-sig-expire ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 15:23:31 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 15:23:31 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-201-g1bfe766 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 1bfe766bcf3959135333900934f1a15c9b96c3cf (commit) from 420dc2b49ad816bdd27b40db45d900551c71476f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1bfe766bcf3959135333900934f1a15c9b96c3cf Author: Werner Koch Date: Wed Aug 29 15:14:29 2018 +0200 gpg: Explain error message in key generation with --batch * g10/keygen.c (generate_keypair): Show more info. -- GnuPG-bug-id: 3912 Signed-off-by: Werner Koch diff --git a/g10/keygen.c b/g10/keygen.c index fbead10..8177040 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -4238,8 +4238,10 @@ generate_keypair (ctrl_t ctrl, int full, const char *fname, if (opt.batch && card_serialno) { - /* We don't yet support unattended key generation. */ + /* We don't yet support unattended key generation with a card + * serial number. */ log_error (_("can't do this in batch mode\n")); + print_further_info ("key generation with card serial number"); return; } ----------------------------------------------------------------------- Summary of changes: g10/keygen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 15:24:26 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 29 Aug 2018 15:24:26 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-18-ga9931b3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via a9931b3c052ee9025705a8ef1f0cdd5f20aeda70 (commit) from 2d700f2c6c1831d8a113b6cf4b8ca81db363b09a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a9931b3c052ee9025705a8ef1f0cdd5f20aeda70 Author: Werner Koch Date: Wed Aug 29 15:14:29 2018 +0200 gpg: Explain error message in key generation with --batch * g10/keygen.c (generate_keypair): Show more info. -- GnuPG-bug-id: 3912 Signed-off-by: Werner Koch (cherry picked from commit 1bfe766bcf3959135333900934f1a15c9b96c3cf) diff --git a/g10/keygen.c b/g10/keygen.c index a4949f4..ed57d5d 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -4135,8 +4135,10 @@ generate_keypair (ctrl_t ctrl, int full, const char *fname, if (opt.batch && card_serialno) { - /* We don't yet support unattended key generation. */ + /* We don't yet support unattended key generation with a card + * serial number. */ log_error (_("can't do this in batch mode\n")); + print_further_info ("key generation with card serial number"); return; } ----------------------------------------------------------------------- Summary of changes: g10/keygen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 17:02:37 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Wed, 29 Aug 2018 17:02:37 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-257-g18ea838 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 18ea83867168e8db0a2f2c8057d087363083486c (commit) via dcedddecb6f8f11682aed3b09b88ee1511010faf (commit) via 6078b5303362b2e5ce56660967fac313ca3d5ae9 (commit) from 1420c3bd681648b032d756536311621a3627bedb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 18ea83867168e8db0a2f2c8057d087363083486c Author: Ben McGinnes Date: Thu Aug 30 00:57:24 2018 +1000 python bindings: core * lang/python/src/core.py: expanded gpgme_error check lists. diff --git a/lang/python/src/core.py b/lang/python/src/core.py index 81131f2..1a0ec98 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -1116,12 +1116,13 @@ class Context(GpgmeWrapper): # | grep -v _op_ | awk "/\(gpgme_ctx/ { printf (\"'%s',\\n\", \$2) } " return ((name.startswith('gpgme_op_') and not name.endswith('_result')) or name in { - 'gpgme_new', 'gpgme_set_ctx_flag', 'gpgme_set_protocol', - 'gpgme_set_sub_protocol', 'gpgme_set_keylist_mode', - 'gpgme_set_pinentry_mode', 'gpgme_set_locale', - 'gpgme_ctx_set_engine_info', 'gpgme_signers_add', - 'gpgme_sig_notation_add', 'gpgme_set_sender', - 'gpgme_cancel', 'gpgme_cancel_async', 'gpgme_get_key' + 'gpgme_new', 'gpgme_set_ctx_flag', 'gpgme_set_protocol', + 'gpgme_set_sub_protocol', 'gpgme_set_keylist_mode', + 'gpgme_set_pinentry_mode', 'gpgme_set_locale', + 'gpgme_ctx_set_engine_info', 'gpgme_signers_add', + 'gpgme_sig_notation_add', 'gpgme_set_sender', + 'gpgme_cancel', 'gpgme_cancel_async', 'gpgme_get_key', + 'gpgme_get_sig_key', }) _boolean_properties = {'armor', 'textmode', 'offline'} commit dcedddecb6f8f11682aed3b09b88ee1511010faf Author: Ben McGinnes Date: Wed Aug 29 22:28:53 2018 +1000 python bindings: core * lang/python/src/core.py: added gpgme_data_set_flag to the errorcheck funtion. diff --git a/lang/python/src/core.py b/lang/python/src/core.py index be3ebd1..81131f2 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -1396,6 +1396,7 @@ class Data(GpgmeWrapper): 'gpgme_data_release_and_get_mem', 'gpgme_data_get_encoding', 'gpgme_data_get_file_name', + 'gpgme_data_set_flag', 'gpgme_data_identify', } commit 6078b5303362b2e5ce56660967fac313ca3d5ae9 Author: Ben McGinnes Date: Wed Aug 29 22:03:06 2018 +1000 python bindings: core * lang/python/src/core.py: added new function new_from_estream to wrap new_from_fd just like new_from_stream does and for the same reason. diff --git a/lang/python/src/core.py b/lang/python/src/core.py index d471131..be3ebd1 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -1560,9 +1560,15 @@ class Data(GpgmeWrapper): self.wrapped = gpgme.gpgme_data_t_p_value(tmp) gpgme.delete_gpgme_data_t_p(tmp) + def new_from_estream(self, file): + """This wrap around gpgme_data_new_from_estream is an alias for + new_from_fd() method since in python there's no difference + between file stream and file descriptor""" + self.new_from_fd(file) + def new_from_stream(self, file): """This wrap around gpgme_data_new_from_stream is an alias for - new_from_fd() method since in python there's not difference + new_from_fd() method since in python there's no difference between file stream and file descriptor""" self.new_from_fd(file) ----------------------------------------------------------------------- Summary of changes: lang/python/src/core.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Aug 29 17:47:38 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Wed, 29 Aug 2018 17:47:38 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-258-g61ac70c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 61ac70cfb5cf58f92cd97abdde7152040c51201c (commit) from 18ea83867168e8db0a2f2c8057d087363083486c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 61ac70cfb5cf58f92cd97abdde7152040c51201c Author: Maximilian Krambach Date: Wed Aug 29 17:45:55 2018 +0200 js: return base64 after encrypt with armor=false -- * src/gpgmejs.js/encrypt: the encrypted data were converted back to a (incorrect) string, whereas they should be data with no encoding specified. Returning base64 data is the expected way. * DemoExtension: caught yet another usage of old syntax. diff --git a/lang/js/DemoExtension/maindemo.js b/lang/js/DemoExtension/maindemo.js index 97a27f6..b472bcc 100644 --- a/lang/js/DemoExtension/maindemo.js +++ b/lang/js/DemoExtension/maindemo.js @@ -29,7 +29,7 @@ document.addEventListener('DOMContentLoaded', function () { function (){ let data = document.getElementById('inputtext').value; let keyId = document.getElementById('pubkey').value; - gpgmejs.encrypt({ data: data, privateKeys: keyId }).then( + gpgmejs.encrypt({ data: data, publicKeys: keyId, armor:false }).then( function (answer){ if (answer.data){ document.getElementById( diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 08f80fc..295cc04 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -154,8 +154,12 @@ export class GpgME { if (msg instanceof Error){ return Promise.reject(msg); } - msg.setParameter('armor', armor); - + if (armor === false){ + msg.setParameter('armor', false); + msg.expected = 'base64'; + } else if (armor === true) { + msg.setParameter('armor', true); + } if (base64 === true) { msg.setParameter('base64', true); } ----------------------------------------------------------------------- Summary of changes: lang/js/DemoExtension/maindemo.js | 2 +- lang/js/src/gpgmejs.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 06:52:11 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 30 Aug 2018 06:52:11 +0200 Subject: [git] GPG-ERROR - branch, gniibe/pkg-config-support, updated. libgpg-error-1.32-13-g78be78b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, gniibe/pkg-config-support has been updated via 78be78bd3d9129919544781e17c8d2fefea6e1de (commit) via 5cbc696fec8ba1e8452e8ad8518636e962caf3bc (commit) via 3f96c9c1d103e3e77be474da3a87c3bf69915726 (commit) via ed6f96f26c2b018b73cc3d440d07d1cc50007e10 (commit) via ffebb25cfe236b95480880c2b468ca0034033a8c (commit) via 37f627eaca57e227dbfd721a94bb9fa6ab143981 (commit) via 6680867dd90c801efdb91b6b150cfd2906bb5d98 (commit) via 55603b7a0d2f6b595823214781f91cb4a2bd502e (commit) from 07fcb271f7610e7a174bd6a6d54aaa84b01ec060 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 78be78bd3d9129919544781e17c8d2fefea6e1de Author: NIIBE Yutaka Date: Thu Aug 30 13:44:23 2018 +0900 Remove dupulicates. diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index d7b9c56..c8ee06f 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -106,14 +106,14 @@ for p in $pkg_list; do done if [ $opt_cflags = yes ]; then - output="$output $cflags" + output="$output $(list_only_once $cflags)" # Backward compatibility to old gpg-error-config if [ $mt = yes ]; then output="$output $mtcflags" fi fi if [ $opt_libs = yes ]; then - output="$output $libs" + output="$output $(list_only_once_for_libs $libs)" # Backward compatibility to old gpg-error-config if [ $mt = yes ]; then output="$output $mtlibs" diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index a51a8c3..04dabc1 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -161,6 +161,45 @@ list_only_once () { echo $result } +list_only_once_for_libs () { + local result="" + loca rev_list="" + local arg + + # Scan the list and eliminate duplicates for non-"-lxxx" + # the resulted list is in reverse order + for arg; do + case "$arg" in + -l*) + # As-is + rev_list="$arg $rev_list" + ;; + *) + if not_listed_yet $arg "$rev_list"; then + rev_list="$arg $rev_list" + fi + ;; + esac + done + + # Scan again + for arg in $rev_list; do + case "$arg" in + -l*) + if not_listed_yet $arg "$result"; then + result="$arg $result" + fi + ;; + *) + # As-is + result="$arg $result" + ;; + esac + done + + echo $result +} + # # Recursively solve package dependencies # commit 5cbc696fec8ba1e8452e8ad8518636e962caf3bc Author: NIIBE Yutaka Date: Thu Aug 30 13:20:42 2018 +0900 Handle module dependency (Requires field). diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index 37eb193..d7b9c56 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -88,21 +88,36 @@ while test $# -gt 0; do shift done -if [ opt_cflags = yes ]; then - output="$output $(get_attr Cflags)" +cflags="$(get_attr Cflags)" +libs="$(get_attr Libs)" + +mtcflags="$(get_var mtcflags)" +mtlibs="$(get_var mtlibs)" + +requires="$(get_attr Requires)" +cleanup_vars_attrs +pkg_list=$(all_required_config_files $requires) + +for p in $pkg_list; do + read_config_file $p $PKG_CONFIG_PATH + cflags="$cflags $(get_attr Cflags)" + libs="$libs $(get_attr Libs)" + cleanup_vars_attrs +done + +if [ $opt_cflags = yes ]; then + output="$output $cflags" # Backward compatibility to old gpg-error-config if [ $mt = yes ]; then - output="$output $(get_var mtcflags)" + output="$output $mtcflags" fi fi -if [ opt_libs = yes ]; then - output="$output $(get_attr Libs)" +if [ $opt_libs = yes ]; then + output="$output $libs" # Backward compatibility to old gpg-error-config if [ $mt = yes ]; then - output="$output $(get_var mtlibs)" + output="$output $mtlibs" fi fi -# cleanup_vars_attrs - echo $output diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index 38dccf0..a51a8c3 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -135,4 +135,57 @@ cleanup_vars_attrs () { eval unset $ATTR_list ATTR_list } +not_listed_yet () { + local m=$1 + shift + + for arg; do + if [ $m = $arg ]; then + return 1 + fi + done + + return 0 +} + +list_only_once () { + local result="" + local arg + + for arg; do + if not_listed_yet $arg "$result"; then + result="$result $arg" + fi + done + + echo $result +} + +# +# Recursively solve package dependencies +# +# XXX: version requirement (version comparison) is not yet supported +# +all_required_config_files () { + local list="$1" + local all_list + local new_list + local p + + all_list="$list" + + while [ -n "$list" ]; do + new_list="" + for p in $list; do + read_config_file $p $PKG_CONFIG_PATH + new_list="$new_list $(get_attr Requires)" + cleanup_vars_attrs + done + all_list="$all_list $new_list" + list="$new_list" + done + + echo $(list_only_once $all_list) +} + #### end of pkgconf-funcs commit 3f96c9c1d103e3e77be474da3a87c3bf69915726 Author: NIIBE Yutaka Date: Thu Aug 30 11:25:10 2018 +0900 PKG_CONFIG_PATH change. diff --git a/src/gpg-error-config-head.in b/src/gpg-error-config-head.in index 1c50fa0..c6219f2 100644 --- a/src/gpg-error-config-head.in +++ b/src/gpg-error-config-head.in @@ -13,5 +13,5 @@ prefix=@prefix@ datarootdir=@datarootdir@ datadir=@datadir@ -PKG_CONFIG_PATH="${datadir}/pkgconfig" +PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}${datadir}/pkgconfig" # commit ed6f96f26c2b018b73cc3d440d07d1cc50007e10 Author: NIIBE Yutaka Date: Thu Aug 30 11:16:41 2018 +0900 New func read_config_from_stdin and cleanup_vars_attrs. diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index 637db7d..37eb193 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -5,13 +5,6 @@ else myname="gpgrt-config" fi -if find_file_in_path ${myname%-config}.pc $PKG_CONFIG_PATH; then - CONFIG_FILE=$RESULT -else - echo "Can't find ${myname%-config}.pc" 1>&2 - exit 1 -fi - usage() { cat <&2 + exit 1 + fi + read_config_from_stdin < $config_file +} + +cleanup_vars_attrs () { + eval unset $VAR_list VAR_list + eval unset $ATTR_list ATTR_list +} + #### end of pkgconf-funcs commit ffebb25cfe236b95480880c2b468ca0034033a8c Author: NIIBE Yutaka Date: Thu Aug 30 10:34:43 2018 +0900 Add note for the compatibility. * src/gpg-error-config-main.sh (--modversion): New. Add comments. -- Not supported by pkg-config: No such options: --prefix --exec-prefix --host Conditional flag which change the output: --mt Different semantics: --version which print the tool version We keep the backward compatibility for older gpg-error-config for --mt and other options for a while. New usage (pkg-config compatible way) is encouraged. diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index e2ff26d..637db7d 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -12,8 +12,6 @@ else exit 1 fi -output="" - usage() { cat < Date: Thu Aug 30 09:50:01 2018 +0900 Fix test condition for pkg-conf-funcs. * src/pkgconf-funcs.sh: Use -r (was: -e). diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index d06b68b..fd144c8 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -108,7 +108,7 @@ find_file_in_path () { local IFS=":" # On Windows it should be ";"??? for d in $p; do - if [ -e $d/$f ]; then + if [ -r $d/$f ]; then RESULT="$d/$f" return 0 fi commit 6680867dd90c801efdb91b6b150cfd2906bb5d98 Author: NIIBE Yutaka Date: Thu Aug 30 09:49:08 2018 +0900 Simplify configure substitution. * configure (GPG_ERROR_CONFIG_INCLUDEDIR): Remove. (GPG_ERROR_CONFIG_LIBDIR): Remove. diff --git a/configure.ac b/configure.ac index 5b460bf..9a2d8ba 100644 --- a/configure.ac +++ b/configure.ac @@ -495,12 +495,12 @@ else fi GPG_ERROR_CONFIG_HOST="$host" case "$includedir" in - '${prefix}/include'|/usr/include|/include) GPG_ERROR_CONFIG_INCLUDEDIR="" ;; - *) GPG_ERROR_CONFIG_INCLUDEDIR="-I$includedir" ;; + '${prefix}/include'|/usr/include|/include) ;; + *) GPG_ERROR_CONFIG_CFLAGS="-I$includedir $GPG_ERROR_CONFIG_CFLAGS" ;; esac case "$libdir" in - '${exec_prefix}/lib'|/usr/lib|/usr/lib64|/lib|/lib64) GPG_ERROR_CONFIG_LIBDIR="" ;; - *) GPG_ERROR_CONFIG_LIBDIR="-L$libdir" ;; + '${exec_prefix}/lib'|/usr/lib|/usr/lib64|/lib|/lib64) ;; + *) GPG_ERROR_CONFIG_LIBS="-L$libdir $GPG_ERROR_CONFIG_LIBS" ;; esac AC_SUBST(GPG_ERROR_CONFIG_LIBS) @@ -508,8 +508,6 @@ AC_SUBST(GPG_ERROR_CONFIG_CFLAGS) AC_SUBST(GPG_ERROR_CONFIG_MT_LIBS) AC_SUBST(GPG_ERROR_CONFIG_MT_CFLAGS) AC_SUBST(GPG_ERROR_CONFIG_HOST) -AC_SUBST(GPG_ERROR_CONFIG_INCLUDEDIR) -AC_SUBST(GPG_ERROR_CONFIG_LIBDIR) # # Special defines for certain platforms diff --git a/src/gpg-error.pc.in b/src/gpg-error.pc.in index 3e8d328..e6ab104 100644 --- a/src/gpg-error.pc.in +++ b/src/gpg-error.pc.in @@ -9,6 +9,6 @@ mtlibs=@GPG_ERROR_CONFIG_MT_LIBS@ Name: gpg-error Description: GPG Runtime Version: @PACKAGE_VERSION@ -Cflags: @GPG_ERROR_CONFIG_INCLUDEDIR@ @GPG_ERROR_CONFIG_CFLAGS@ -Libs: @GPG_ERROR_CONFIG_LIBDIR@ @GPG_ERROR_CONFIG_LIBS@ +Cflags: @GPG_ERROR_CONFIG_CFLAGS@ +Libs: @GPG_ERROR_CONFIG_LIBS@ URL: https://www.gnupg.org/software/libgpg-error/index.html commit 55603b7a0d2f6b595823214781f91cb4a2bd502e Author: NIIBE Yutaka Date: Thu Aug 30 09:27:24 2018 +0900 Fix the previous commit. diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 index ab29273..0564219 100644 --- a/src/gpg-error.m4 +++ b/src/gpg-error.m4 @@ -89,7 +89,9 @@ AC_DEFUN([AM_PATH_GPG_ERROR], GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs` GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --variable=mtcflags 2>/dev/null` + GPG_ERROR_MT_CFLAGS="$GPG_ERROR_CFLAGS${GPG_ERROR_CFLAGS:+ }$GPG_ERROR_MT_CFLAGS" GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --variable=mtlibs 2>/dev/null` + GPG_ERROR_MT_LIBS="$GPG_ERROR_LIBS${GPG_ERROR_LIBS:+ }$GPG_ERROR_MT_LIBS" AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --variable=host 2>/dev/null || echo none` ----------------------------------------------------------------------- Summary of changes: configure.ac | 10 ++-- src/gpg-error-config-head.in | 2 +- src/gpg-error-config-main.sh | 71 +++++++++++++++++--------- src/gpg-error.m4 | 2 + src/gpg-error.pc.in | 4 +- src/pkgconf-funcs.sh | 117 +++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 170 insertions(+), 36 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 07:59:30 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Thu, 30 Aug 2018 07:59:30 +0200 Subject: [git] GPGME - branch, ben/estreams-fix, created. gpgme-1.11.1-259-g1d00fb9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, ben/estreams-fix has been created at 1d00fb987b903e245d484bddfe3c0a0aba670ac1 (commit) - Log ----------------------------------------------------------------- commit 1d00fb987b903e245d484bddfe3c0a0aba670ac1 Author: Ben McGinnes Date: Thu Aug 30 15:41:31 2018 +1000 python bindings: estreams fix * lang/python/src/core.py: Adjusted new_from_estream function to alias new_from_stream instead of fd. * fixed the _gpgme import errors introduced in commit 08cd34afb762975b0273575035dacf69449ef241 by changing the exported functions/types to match the inner module where all the work is done, rather than the outer one(s). Tested-by: Ben McGinnes Signed-off-by: Ben McGinnes diff --git a/lang/python/src/core.py b/lang/python/src/core.py index 1a0ec98..f440d92 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -1562,18 +1562,18 @@ class Data(GpgmeWrapper): self.wrapped = gpgme.gpgme_data_t_p_value(tmp) gpgme.delete_gpgme_data_t_p(tmp) - def new_from_estream(self, file): - """This wrap around gpgme_data_new_from_estream is an alias for - new_from_fd() method since in python there's no difference - between file stream and file descriptor""" - self.new_from_fd(file) - def new_from_stream(self, file): """This wrap around gpgme_data_new_from_stream is an alias for new_from_fd() method since in python there's no difference - between file stream and file descriptor""" + between file stream and file descriptor.""" self.new_from_fd(file) + def new_from_estream(self, file): + """This wrap around gpgme_data_new_from_estream is an alias for + new_from_fd() method since in python there's no difference + between file stream and file descriptor, but using fd broke.""" + self.new_from_stream(file) + def write(self, buffer): """Write buffer given as string or bytes. diff --git a/src/gpgme.def b/src/gpgme.def index c690220..f0f748e 100644 --- a/src/gpgme.def +++ b/src/gpgme.def @@ -272,7 +272,7 @@ EXPORTS gpgme_op_encrypt_sign_ext @202 gpgme_op_encrypt_sign_ext_start @203 - gpgme_data_new_from_estream @204 + _gpgme_data_new_from_estream @204 ; END diff --git a/src/libgpgme.vers b/src/libgpgme.vers index 7531f54..8faed5e 100644 --- a/src/libgpgme.vers +++ b/src/libgpgme.vers @@ -134,7 +134,7 @@ GPGME_1.1 { gpgme_op_decrypt_ext; gpgme_op_decrypt_ext_start; - gpgme_data_new_from_estream; + _gpgme_data_new_from_estream; }; ----------------------------------------------------------------------- hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 08:28:41 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 30 Aug 2018 08:28:41 +0200 Subject: [git] GPG-ERROR - branch, gniibe/pkg-config-support, updated. libgpg-error-1.32-15-g53d2eb3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, gniibe/pkg-config-support has been updated via 53d2eb399601bdea6cdfe3a5e90203585ddf9e4a (commit) via 66ba9c3ad0bf898137e252d9b3d27228656e6ecf (commit) from 78be78bd3d9129919544781e17c8d2fefea6e1de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 53d2eb399601bdea6cdfe3a5e90203585ddf9e4a Author: NIIBE Yutaka Date: Thu Aug 30 15:27:54 2018 +0900 Fixes src/gpg-error-config-main.sh and src/pkgconf-funcs.sh. diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index 0a0dd0f..1ead597 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -37,27 +37,28 @@ output_attr="" opt_cflags=no opt_libs=no output="" +delimiter=" " while test $# -gt 0; do case $1 in --prefix) # In future, use --variable=prefix instead. output_var=prefix - break ;; --exec-prefix) # In future, use --variable=exec_prefix instead. output_var=exec_prefix - break ;; --version) # In future, use --modversion instead. output_attr=Version - break + delimiter=" +" ;; --modversion) output_attr=Version - break + delimiter=" +" ;; --cflags) opt_cflags=yes @@ -67,12 +68,10 @@ while test $# -gt 0; do ;; --variable=*) output_var=${1#*=} - break ;; --host) # In future, use --variable=host instead. output_var=host - break ;; --help) usage 0 @@ -84,22 +83,27 @@ while test $# -gt 0; do shift done -if [ -z "$modules" ]; then - modules=${myname%-config} -fi - -if [ myname = "gpg-error-config" -a -z "$modules" ]; then +if [ $myname = "gpg-error-config" -a -z "$modules" ]; then read_config_file ${myname%-config} $PKG_CONFIG_PATH - cflags="$(get_attr Cflags)" - libs="$(get_attr Libs)" + if [ -n "$output_var" ]; then + output="$output${output:+ }$(get_var $output_var)" + elif [ -n "$output_attr" ]; then + output="$output${output:+ }$(get_attr $output_attr)" + else + cflags="$(get_attr Cflags)" + libs="$(get_attr Libs)" - mtcflags="$(get_var mtcflags)" - mtlibs="$(get_var mtlibs)" + mtcflags="$(get_var mtcflags)" + mtlibs="$(get_var mtlibs)" + fi requires="$(get_attr Requires)" cleanup_vars_attrs pkg_list=$(all_required_config_files $requires) else + if [ -z "$modules" ]; then + modules=${myname%-config} + fi cflags="" libs="" pkg_list=$(all_required_config_files $modules) @@ -107,24 +111,32 @@ fi for p in $pkg_list; do read_config_file $p $PKG_CONFIG_PATH - cflags="$cflags $(get_attr Cflags)" - libs="$libs $(get_attr Libs)" + if [ -n "$output_var" ]; then + output="$output${output:+$delimiter}$(get_var $output_var)" + elif [ -n "$output_attr" ]; then + output="$output${output:+$delimiter}$(get_attr $output_attr)" + else + cflags="$cflags${cflags:+ }$(get_attr Cflags)" + libs="$libs${libs:+ }$(get_attr Libs)" + fi cleanup_vars_attrs done -if [ $opt_cflags = yes ]; then - output="$output $(list_only_once $cflags)" - # Backward compatibility to old gpg-error-config - if [ $mt = yes ]; then - output="$output $mtcflags" +if [ -z "$output_var" -a -z "$output_attr" ]; then + if [ $opt_cflags = yes ]; then + output="$output $(list_only_once $cflags)" + # Backward compatibility to old gpg-error-config + if [ $mt = yes ]; then + output="$output $mtcflags" + fi fi -fi -if [ $opt_libs = yes ]; then - output="$output $(list_only_once_for_libs $libs)" - # Backward compatibility to old gpg-error-config - if [ $mt = yes ]; then - output="$output $mtlibs" + if [ $opt_libs = yes ]; then + output="$output $(list_only_once_for_libs $libs)" + # Backward compatibility to old gpg-error-config + if [ $mt = yes ]; then + output="$output $mtlibs" + fi fi fi -echo $output +echo "$output" diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index 04dabc1..7073f81 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -137,6 +137,7 @@ cleanup_vars_attrs () { not_listed_yet () { local m=$1 + local arg shift for arg; do @@ -153,7 +154,7 @@ list_only_once () { local arg for arg; do - if not_listed_yet $arg "$result"; then + if not_listed_yet $arg $result; then result="$result $arg" fi done @@ -163,7 +164,7 @@ list_only_once () { list_only_once_for_libs () { local result="" - loca rev_list="" + local rev_list="" local arg # Scan the list and eliminate duplicates for non-"-lxxx" @@ -175,7 +176,7 @@ list_only_once_for_libs () { rev_list="$arg $rev_list" ;; *) - if not_listed_yet $arg "$rev_list"; then + if not_listed_yet $arg $rev_list; then rev_list="$arg $rev_list" fi ;; @@ -186,7 +187,7 @@ list_only_once_for_libs () { for arg in $rev_list; do case "$arg" in -l*) - if not_listed_yet $arg "$result"; then + if not_listed_yet $arg $result; then result="$arg $result" fi ;; @@ -206,11 +207,12 @@ list_only_once_for_libs () { # XXX: version requirement (version comparison) is not yet supported # all_required_config_files () { - local list="$1" + local list local all_list local new_list local p + list="$@" all_list="$list" while [ -n "$list" ]; do commit 66ba9c3ad0bf898137e252d9b3d27228656e6ecf Author: NIIBE Yutaka Date: Thu Aug 30 14:36:35 2018 +0900 Support invocation with module names. diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index c8ee06f..0a0dd0f 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -1,8 +1,7 @@ -if echo "$0" | grep gpg-error-config 2>/dev/null >/dev/null; then +myname=${0##*/} +if [ $myname = gpgrt-config ]; then myname="gpg-error-config" -else - myname="gpgrt-config" fi usage() @@ -32,39 +31,33 @@ else shift fi -read_config_file ${myname%-config} $PKG_CONFIG_PATH - +modules="" +output_var="" +output_attr="" opt_cflags=no opt_libs=no output="" while test $# -gt 0; do - case "$1" in - -*=*) - optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` - ;; - *) - optarg= - ;; - esac - case $1 in --prefix) # In future, use --variable=prefix instead. - output="$output $(get_var prefix)" + output_var=prefix + break ;; --exec-prefix) # In future, use --variable=exec_prefix instead. - output="$output $(get_var exec_prefix)" + output_var=exec_prefix + break ;; --version) # In future, use --modversion instead. - echo "$(get_attr Version)" - exit 0 + output_attr=Version + break ;; --modversion) - echo "$(get_attr Version)" - exit 0 + output_attr=Version + break ;; --cflags) opt_cflags=yes @@ -73,30 +66,44 @@ while test $# -gt 0; do opt_libs=yes ;; --variable=*) - echo "$(get_var ${1#*=})" - exit 0 + output_var=${1#*=} + break ;; --host) # In future, use --variable=host instead. - echo "$(get_var host)" - exit 0 + output_var=host + break + ;; + --help) + usage 0 ;; *) - usage 1 1>&2 + modules="$modules $1" ;; esac shift done -cflags="$(get_attr Cflags)" -libs="$(get_attr Libs)" +if [ -z "$modules" ]; then + modules=${myname%-config} +fi + +if [ myname = "gpg-error-config" -a -z "$modules" ]; then + read_config_file ${myname%-config} $PKG_CONFIG_PATH + cflags="$(get_attr Cflags)" + libs="$(get_attr Libs)" -mtcflags="$(get_var mtcflags)" -mtlibs="$(get_var mtlibs)" + mtcflags="$(get_var mtcflags)" + mtlibs="$(get_var mtlibs)" -requires="$(get_attr Requires)" -cleanup_vars_attrs -pkg_list=$(all_required_config_files $requires) + requires="$(get_attr Requires)" + cleanup_vars_attrs + pkg_list=$(all_required_config_files $requires) +else + cflags="" + libs="" + pkg_list=$(all_required_config_files $modules) +fi for p in $pkg_list; do read_config_file $p $PKG_CONFIG_PATH ----------------------------------------------------------------------- Summary of changes: src/gpg-error-config-main.sh | 111 +++++++++++++++++++++++++------------------ src/pkgconf-funcs.sh | 12 +++-- 2 files changed, 72 insertions(+), 51 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 08:36:10 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 30 Aug 2018 08:36:10 +0200 Subject: [git] GPG-ERROR - branch, gniibe/pkg-config-support, updated. libgpg-error-1.32-16-ge0aecec Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, gniibe/pkg-config-support has been updated via e0aecec6d0402bb305aa768656b080c995f781cc (commit) from 53d2eb399601bdea6cdfe3a5e90203585ddf9e4a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e0aecec6d0402bb305aa768656b080c995f781cc Author: NIIBE Yutaka Date: Thu Aug 30 15:35:20 2018 +0900 Remove AC_CONFIG_COMMANDS for gpg-error-config. diff --git a/configure.ac b/configure.ac index 9a2d8ba..58957b7 100644 --- a/configure.ac +++ b/configure.ac @@ -634,13 +634,7 @@ AC_CONFIG_FILES([src/Makefile tests/Makefile]) AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd]) AC_CONFIG_FILES([src/versioninfo.rc src/gpg-error.w32-manifest]) AC_CONFIG_FILES([src/gpg-error.pc]) -AC_CONFIG_FILES([src/gpg-error-config-head]) -AC_CONFIG_COMMANDS([gen-gpg-error-config], [ -cat src/gpg-error-config-head \ - $srcdir/src/pkgconf-funcs.sh \ - $srcdir/src/gpg-error-config-main.sh > src/gpg-error-config -chmod +x src/gpg-error-config -]) +AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 98e3b94..c1efb94 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -96,7 +96,7 @@ EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \ mkerrcodes.awk mkerrcodes1.awk mkerrcodes2.awk mkerrcodes.c \ mkheader.c gpg-error.h.in mkw32errmap.c w32-add.h w32ce-add.h \ err-sources.h err-codes.h \ - gpg-error-config-head.in pkgconf-funcs.sh gpg-error-config-main.sh \ + gpg-error-config.in \ gpg-error.pc.in \ gpg-error.m4 gpgrt.m4 \ gpg-error.vers gpg-error.def.in \ diff --git a/src/gpg-error-config-head.in b/src/gpg-error-config-head.in deleted file mode 100644 index c6219f2..0000000 --- a/src/gpg-error-config-head.in +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This file is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# SPDX-License-Identifier: FSFULLR - -prefix=@prefix@ -datarootdir=@datarootdir@ -datadir=@datadir@ -PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}${datadir}/pkgconfig" -# diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh deleted file mode 100644 index 1ead597..0000000 --- a/src/gpg-error-config-main.sh +++ /dev/null @@ -1,142 +0,0 @@ - -myname=${0##*/} -if [ $myname = gpgrt-config ]; then - myname="gpg-error-config" -fi - -usage() -{ - cat <&2 -fi - -if [ "$1" != "--mt" ]; then - mt=no -else - # In future, use --variable=mtcflags or --variable=mtlibs - mt=yes - shift -fi - -modules="" -output_var="" -output_attr="" -opt_cflags=no -opt_libs=no -output="" -delimiter=" " - -while test $# -gt 0; do - case $1 in - --prefix) - # In future, use --variable=prefix instead. - output_var=prefix - ;; - --exec-prefix) - # In future, use --variable=exec_prefix instead. - output_var=exec_prefix - ;; - --version) - # In future, use --modversion instead. - output_attr=Version - delimiter=" -" - ;; - --modversion) - output_attr=Version - delimiter=" -" - ;; - --cflags) - opt_cflags=yes - ;; - --libs) - opt_libs=yes - ;; - --variable=*) - output_var=${1#*=} - ;; - --host) - # In future, use --variable=host instead. - output_var=host - ;; - --help) - usage 0 - ;; - *) - modules="$modules $1" - ;; - esac - shift -done - -if [ $myname = "gpg-error-config" -a -z "$modules" ]; then - read_config_file ${myname%-config} $PKG_CONFIG_PATH - if [ -n "$output_var" ]; then - output="$output${output:+ }$(get_var $output_var)" - elif [ -n "$output_attr" ]; then - output="$output${output:+ }$(get_attr $output_attr)" - else - cflags="$(get_attr Cflags)" - libs="$(get_attr Libs)" - - mtcflags="$(get_var mtcflags)" - mtlibs="$(get_var mtlibs)" - fi - - requires="$(get_attr Requires)" - cleanup_vars_attrs - pkg_list=$(all_required_config_files $requires) -else - if [ -z "$modules" ]; then - modules=${myname%-config} - fi - cflags="" - libs="" - pkg_list=$(all_required_config_files $modules) -fi - -for p in $pkg_list; do - read_config_file $p $PKG_CONFIG_PATH - if [ -n "$output_var" ]; then - output="$output${output:+$delimiter}$(get_var $output_var)" - elif [ -n "$output_attr" ]; then - output="$output${output:+$delimiter}$(get_attr $output_attr)" - else - cflags="$cflags${cflags:+ }$(get_attr Cflags)" - libs="$libs${libs:+ }$(get_attr Libs)" - fi - cleanup_vars_attrs -done - -if [ -z "$output_var" -a -z "$output_attr" ]; then - if [ $opt_cflags = yes ]; then - output="$output $(list_only_once $cflags)" - # Backward compatibility to old gpg-error-config - if [ $mt = yes ]; then - output="$output $mtcflags" - fi - fi - if [ $opt_libs = yes ]; then - output="$output $(list_only_once_for_libs $libs)" - # Backward compatibility to old gpg-error-config - if [ $mt = yes ]; then - output="$output $mtlibs" - fi - fi -fi - -echo "$output" diff --git a/src/pkgconf-funcs.sh b/src/gpg-error-config.in similarity index 53% rename from src/pkgconf-funcs.sh rename to src/gpg-error-config.in index 7073f81..d5e2f3b 100644 --- a/src/pkgconf-funcs.sh +++ b/src/gpg-error-config.in @@ -1,3 +1,21 @@ +#!/bin/sh +# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# SPDX-License-Identifier: FSFULLR + +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}${datadir}/pkgconfig" +# + #### start of pkgconf-funcs # @@ -230,3 +248,145 @@ all_required_config_files () { } #### end of pkgconf-funcs + +myname=${0##*/} +if [ $myname = gpgrt-config ]; then + myname="gpg-error-config" +fi + +usage() +{ + cat <&2 +fi + +if [ "$1" != "--mt" ]; then + mt=no +else + # In future, use --variable=mtcflags or --variable=mtlibs + mt=yes + shift +fi + +modules="" +output_var="" +output_attr="" +opt_cflags=no +opt_libs=no +output="" +delimiter=" " + +while test $# -gt 0; do + case $1 in + --prefix) + # In future, use --variable=prefix instead. + output_var=prefix + ;; + --exec-prefix) + # In future, use --variable=exec_prefix instead. + output_var=exec_prefix + ;; + --version) + # In future, use --modversion instead. + output_attr=Version + delimiter=" +" + ;; + --modversion) + output_attr=Version + delimiter=" +" + ;; + --cflags) + opt_cflags=yes + ;; + --libs) + opt_libs=yes + ;; + --variable=*) + output_var=${1#*=} + ;; + --host) + # In future, use --variable=host instead. + output_var=host + ;; + --help) + usage 0 + ;; + *) + modules="$modules $1" + ;; + esac + shift +done + +if [ $myname = "gpg-error-config" -a -z "$modules" ]; then + read_config_file ${myname%-config} $PKG_CONFIG_PATH + if [ -n "$output_var" ]; then + output="$output${output:+ }$(get_var $output_var)" + elif [ -n "$output_attr" ]; then + output="$output${output:+ }$(get_attr $output_attr)" + else + cflags="$(get_attr Cflags)" + libs="$(get_attr Libs)" + + mtcflags="$(get_var mtcflags)" + mtlibs="$(get_var mtlibs)" + fi + + requires="$(get_attr Requires)" + cleanup_vars_attrs + pkg_list=$(all_required_config_files $requires) +else + if [ -z "$modules" ]; then + modules=${myname%-config} + fi + cflags="" + libs="" + pkg_list=$(all_required_config_files $modules) +fi + +for p in $pkg_list; do + read_config_file $p $PKG_CONFIG_PATH + if [ -n "$output_var" ]; then + output="$output${output:+$delimiter}$(get_var $output_var)" + elif [ -n "$output_attr" ]; then + output="$output${output:+$delimiter}$(get_attr $output_attr)" + else + cflags="$cflags${cflags:+ }$(get_attr Cflags)" + libs="$libs${libs:+ }$(get_attr Libs)" + fi + cleanup_vars_attrs +done + +if [ -z "$output_var" -a -z "$output_attr" ]; then + if [ $opt_cflags = yes ]; then + output="$output $(list_only_once $cflags)" + # Backward compatibility to old gpg-error-config + if [ $mt = yes ]; then + output="$output $mtcflags" + fi + fi + if [ $opt_libs = yes ]; then + output="$output $(list_only_once_for_libs $libs)" + # Backward compatibility to old gpg-error-config + if [ $mt = yes ]; then + output="$output $mtlibs" + fi + fi +fi + +echo "$output" ----------------------------------------------------------------------- Summary of changes: configure.ac | 8 +- src/Makefile.am | 2 +- src/gpg-error-config-head.in | 17 --- src/gpg-error-config-main.sh | 142 ----------------------- src/{pkgconf-funcs.sh => gpg-error-config.in} | 160 ++++++++++++++++++++++++++ 5 files changed, 162 insertions(+), 167 deletions(-) delete mode 100644 src/gpg-error-config-head.in delete mode 100644 src/gpg-error-config-main.sh rename src/{pkgconf-funcs.sh => gpg-error-config.in} (53%) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 08:37:10 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Thu, 30 Aug 2018 08:37:10 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-259-g1d00fb9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 1d00fb987b903e245d484bddfe3c0a0aba670ac1 (commit) from 61ac70cfb5cf58f92cd97abdde7152040c51201c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: lang/python/src/core.py | 14 +++++++------- src/gpgme.def | 2 +- src/libgpgme.vers | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 09:45:39 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 30 Aug 2018 09:45:39 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-164-g0e05606 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 0e05606f693114b491a74030e7ae54c75738eeae (commit) via 1656e01d2eb19c8349dcab9d9b7e25fb85b9c854 (commit) via 1b4138508044d7f794b23994bec6fb46c0238142 (commit) from 4c573f3c898429628c3344c88379319f271b900a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0e05606f693114b491a74030e7ae54c75738eeae Author: Andre Heinecke Date: Thu Aug 30 09:44:43 2018 +0200 Also check for pgp/inline in IPM.Note.SMIME * src/mapihelp.cpp (mapi_change_message_class): Also check for inline in IPM.Note.SMIME GnuPG-Bug-Id: T4115 diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index b01711a..f99a729 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -1506,6 +1506,29 @@ mapi_change_message_class (LPMESSAGE message, int sync_override, newvalue = change_message_class_ipm_note_smime_multipartsigned (message); } + else if (!opt.enable_smime && !strcmp (s, "IPM.Note.SMIME")) + { + /* This is enterprise level gateway encryption stuff. + + E.g. we can have awesome other tools that send pgp + inline and a gateway that signs everything with S/MIME. + + So let's look at the body to figure out if we are + PGP. + + This won't work usually as the body is not yet accessible. + Still it does not hurt to try as the experience is that + the message class in outlook is not used consistently. + */ + newvalue = get_msgcls_from_pgp_lines (message); + + if (newvalue) + { + log_debug ("%s:%s: PGP Inline detected in S/MIME message. " + "Type is now '%s'", + SRCNAME, __func__, newvalue); + } + } else if (sync_override && have_override && !strncmp (s, "IPM.Note.GpgOL", 14) && (!s[14]||s[14] =='.')) { commit 1656e01d2eb19c8349dcab9d9b7e25fb85b9c854 Author: Andre Heinecke Date: Thu Aug 30 09:39:45 2018 +0200 Check for PGP/Inline inside of S/MIME mails * src/mapihelp.cpp (change_message_class_ipm_note_smime_multipartsigned): Check for PGP/Inline if S/MIME is disabled. -- This is a hack to handle the case where some crypto gateway might wrap a PGP Inline message inside an S/MIME message. GnuPG-Bug-Id: T4115 diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index ecd45f8..b01711a 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -1243,6 +1243,24 @@ change_message_class_ipm_note_smime_multipartsigned (LPMESSAGE message) xfree (attach_mime); } } + else + { + /* This is enterprise level gateway encryption stuff. + + E.g. we can have awesome other tools that send pgp + inline and a gateway that signs everything with S/MIME. + + So let's look at the body to figure out if we are + PGP. */ + newvalue = get_msgcls_from_pgp_lines (message); + + if (newvalue) + { + log_debug ("%s:%s: PGP Inline detected in S/MIME message. " + "Type is now '%s'", + SRCNAME, __func__, newvalue); + } + } xfree (proto); xfree (ct); } commit 1b4138508044d7f794b23994bec6fb46c0238142 Author: Andre Heinecke Date: Thu Aug 30 08:27:21 2018 +0200 Fix minor german l10n error -- diff --git a/po/de.po b/po/de.po index c392396..347e49e 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgstr "" "Project-Id-Version: GpgOL 1.0.0\n" "Report-Msgid-Bugs-To: bug-gpgol at g10code.com\n" "POT-Creation-Date: 2018-07-24 08:32+0200\n" -"PO-Revision-Date: 2018-07-24 09:32+0100\n" +"PO-Revision-Date: 2018-08-30 08:27+0100\n" "Last-Translator: aheinecke \n" "Language-Team: English \n" "Language: en_US\n" @@ -243,7 +243,7 @@ msgid "" "Note: The attachments may be encrypted or signed on a file level but the " "GpgOL status does not apply to them." msgstr "" -"Note: Die Anh?nge k?nnten auf Dateiebene verschl?sselt oder signiert sein, " +"Hinweis: Die Anh?nge k?nnten auf Dateiebene verschl?sselt oder signiert sein, " "aber GpgOL kann deren Kryptostatus nicht anzeigen." #: src/mail.cpp:417 ----------------------------------------------------------------------- Summary of changes: po/de.po | 4 ++-- src/mapihelp.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 09:46:58 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 30 Aug 2018 09:46:58 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-165-g223014d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 223014d35805145d262aa153f2be2a882eaf1207 (commit) from 0e05606f693114b491a74030e7ae54c75738eeae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 223014d35805145d262aa153f2be2a882eaf1207 Author: Andre Heinecke Date: Thu Aug 30 09:45:59 2018 +0200 Add a debug statement when marking MOSS attachs * src/mapihelp.cpp (mapi_mark_moss_attach, mapi_body_to_attachment): Add debug. diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index f99a729..d9e276d 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -2639,6 +2639,9 @@ mapi_mark_moss_attach (LPMESSAGE message, mapi_attach_item_t *item) if (!item || item->end_of_table || item->mapipos == -1) return -1; + log_debug ("%s:%s: Marking %i as MOSS attachment", + SRCNAME, __func__, item->mapipos); + hr = message->OpenAttach (item->mapipos, NULL, MAPI_BEST_ACCESS, &att); memdbg_addRef (att); if (FAILED (hr)) @@ -3280,6 +3283,9 @@ mapi_body_to_attachment (LPMESSAGE message) if (!instream) return -1; + log_debug ("%s:%s: Creating MOSS body attachment", + SRCNAME, __func__); + hr = message->CreateAttach (NULL, 0, &newpos, &newatt); if (hr) { ----------------------------------------------------------------------- Summary of changes: src/mapihelp.cpp | 6 ++++++ 1 file changed, 6 insertions(+) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 09:53:53 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 30 Aug 2018 09:53:53 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-19-g39c34a4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 39c34a4a850f51f6892d08d07b3edd268ca42999 (commit) from a9931b3c052ee9025705a8ef1f0cdd5f20aeda70 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 39c34a4a850f51f6892d08d07b3edd268ca42999 Author: Werner Koch Date: Thu Aug 30 09:44:49 2018 +0200 po: Update German translation -- diff --git a/po/de.po b/po/de.po index 4f9002c..7cb1f1e 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-2.1.0\n" "Report-Msgid-Bugs-To: translations at gnupg.org\n" -"PO-Revision-Date: 2018-07-12 14:48+0200\n" +"PO-Revision-Date: 2018-08-30 09:44+0200\n" "Last-Translator: Werner Koch \n" "Language-Team: German \n" "Language: de\n" @@ -851,19 +851,21 @@ msgstr "WARNUNG: \"%s%s\" ist eine veraltete Option - sie hat keine Wirkung.\n" msgid "unknown debug flag '%s' ignored\n" msgstr "Unbekanntes Debug Flag '%s' wird ignoriert\n" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "Kein aktiver gpg-agent - `%s' wird gestartet\n" - -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" +#, fuzzy, c-format +#| msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "Warte bis der gpg-agent bereit ist ... (%ds)\n" -#, c-format -msgid "connection to agent established\n" +#, fuzzy, c-format +#| msgid "connection to agent established\n" +msgid "connection to %s established\n" msgstr "Verbindung zum gpg-agent aufgebaut\n" #, c-format +msgid "no running gpg-agent - starting '%s'\n" +msgstr "Kein aktiver gpg-agent - `%s' wird gestartet\n" + +#, c-format msgid "connection to agent is in restricted mode\n" msgstr "Verbindung zum gpg-agent ist im eingeschr?nkten Modus.\n" @@ -871,14 +873,6 @@ msgstr "Verbindung zum gpg-agent ist im eingeschr?nkten Modus.\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "Kein aktiver Dirmngr - `%s' wird gestartet\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "Warte bis der Dirmngr bereit ist ... (%ds)\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "Verbindung zum Dirmngr aufgebaut\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1830,23 +1824,6 @@ msgid "[User ID not found]" msgstr "[User-ID nicht gefunden]" #, c-format -msgid "(check argument of option '%s')\n" -msgstr "(Pr?fe das Argument der Option '%s')\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" -"WARNUNG: '%s' sollte eine lange Schl?ssel-ID oder ein Fingerabdruck sein\n" - -#, c-format -msgid "error looking up: %s\n" -msgstr "Fehler beim Nachschlagen von: %s\n" - -#, c-format -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "WARNUNG: %s ist %d mal im Schl?sselbund vorhanden\n" - -#, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "`%s' automatisch via %s geholt\n" @@ -1858,10 +1835,18 @@ msgid "No fingerprint" msgstr "Kein Fingerabdruck vorhanden" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "Pr?fe auf eine aktuellere Kopie eines abgelaufenen Schl?ssels ?ber %s\n" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "Geheimer Schl?ssel \"%s\" nicht gefunden: %s\n" #, c-format +msgid "(check argument of option '%s')\n" +msgstr "(Pr?fe das Argument der Option '%s')\n" + +#, c-format msgid "Warning: not using '%s' as default key: %s\n" msgstr "" "WARNUNG: \"%s\" wird nicht als voreingestellter geheimer Schl?ssel benutzt: " @@ -4831,6 +4816,11 @@ msgstr "" "WARNUNG: M?glicherweise unsicherer symmetrisch verschl?sselter " "Sitzungsschl?ssel\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Entscheidender Beglaubigungs-\"Notation\": " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "Im Unterpaket des Typs %d ist das \"critical bit\" gesetzt\n" @@ -5831,19 +5821,17 @@ msgstr "Statistik f?r Schl?ssel mit der Email-Adresse \"%s\":\n" msgid "this key" msgstr "dieser Schl?ssel" -#, fuzzy, c-format -#| msgid "Verified %ld messages signed by \"%s\"." +#, c-format msgid "Verified %d message." msgid_plural "Verified %d messages." -msgstr[0] "%ld ?berpr?fte Nachrichten von \"%s\"." -msgstr[1] "%ld ?berpr?fte Nachrichten von \"%s\"." +msgstr[0] "%d ?berpr?fte Nachricht." +msgstr[1] "%d ?berpr?fte Nachrichten." -#, fuzzy, c-format -#| msgid "encrypted with %lu passphrases\n" +#, c-format msgid "Encrypted %d message." msgid_plural "Encrypted %d messages." -msgstr[0] "Verschl?sselt mit %lu Passphrases\n" -msgstr[1] "Verschl?sselt mit %lu Passphrases\n" +msgstr[0] "%d Nachricht wurde verschl?sselt." +msgstr[1] "%d Nachrichten wurden verschl?sselt." #, fuzzy, c-format #| msgid "%ld message signed in the future." @@ -9104,6 +9092,22 @@ msgstr "" "Syntax: gpg-check-pattern [optionen] Musterdatei\n" "Die von stdin gelesene Passphrase gegen die Musterdatei pr?fen\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "Warte bis der Dirmngr bereit ist ... (%ds)\n" + +#~ msgid "connection to the dirmngr established\n" +#~ msgstr "Verbindung zum Dirmngr aufgebaut\n" + +#~ msgid "Warning: '%s' should be a long key ID or a fingerprint\n" +#~ msgstr "" +#~ "WARNUNG: '%s' sollte eine lange Schl?ssel-ID oder ein Fingerabdruck sein\n" + +#~ msgid "error looking up: %s\n" +#~ msgstr "Fehler beim Nachschlagen von: %s\n" + +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "WARNUNG: %s ist %d mal im Schl?sselbund vorhanden\n" + #~ msgid "using \"http\" instead of \"https\"\n" #~ msgstr "Es wird \"HTTP\" anstatt \"HTTPS\" verwendet\n" ----------------------------------------------------------------------- Summary of changes: po/de.po | 88 +++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 46 insertions(+), 42 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 10:42:30 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 30 Aug 2018 10:42:30 +0200 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-202-g23738c9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 23738c9530518c5e35da6ac22f695b7ee16ac32d (commit) from 1bfe766bcf3959135333900934f1a15c9b96c3cf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 23738c9530518c5e35da6ac22f695b7ee16ac32d Author: Werner Koch Date: Thu Aug 30 10:33:28 2018 +0200 artwork: State license of the logo -- diff --git a/artwork/README b/artwork/README index 13b8653..068bdea 100644 --- a/artwork/README +++ b/artwork/README @@ -14,3 +14,11 @@ gnupg-logo-new.ai gnupg-favicon-1.ico Icons for the website (rectangular) gnupg-favicon-2.ico (round) + +The above GnuPG logos are Copyright (c) 2006 g10 Code GmbH, and are +released under the terms of the GNU General Public License, version 3 +or any later version, or, at your option, of the Creative Commons +Attribution-ShareAlike 4.0 International License. + +We would appreciate that you make a logo image a link to +https://gnupg.org/ if you use it on a web page. ----------------------------------------------------------------------- Summary of changes: artwork/README | 8 ++++++++ 1 file changed, 8 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 10:50:18 2018 From: cvs at cvs.gnupg.org (by Ineiev) Date: Thu, 30 Aug 2018 10:50:18 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-20-g2f5ba3a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 2f5ba3a6c19b7a514488be01b7683287d74545d3 (commit) from 39c34a4a850f51f6892d08d07b3edd268ca42999 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2f5ba3a6c19b7a514488be01b7683287d74545d3 Author: Ineiev Date: Wed Aug 29 16:17:53 2018 +0000 po: Update Russian translation. diff --git a/po/ru.po b/po/ru.po index 8a8c3eb..a44b1ac 100644 --- a/po/ru.po +++ b/po/ru.po @@ -830,16 +830,16 @@ msgid "unknown debug flag '%s' ignored\n" msgstr "??????????? ?????????? ???? '%s' ????????????\n" #, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "????? gpg ?? ???????? - ????????? '%s'\n" +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "?????? ??????????? %s ... (%i?)\n" #, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "?????? ??????????? ?????? ... (%i?)\n" +msgid "connection to %s established\n" +msgstr "?????????? ? %s ???????????\n" #, c-format -msgid "connection to agent established\n" -msgstr "?????????? ? ??????? ???????????\n" +msgid "no running gpg-agent - starting '%s'\n" +msgstr "????? gpg ?? ???????? - ????????? '%s'\n" #, c-format msgid "connection to agent is in restricted mode\n" @@ -849,14 +849,6 @@ msgstr "?????????? ? ??????? ? ???????????? ?? msgid "no running Dirmngr - starting '%s'\n" msgstr "Dirmngr ?? ??????????? - ?????? '%s'\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "?????? ??????????? dirmngr ... (%i?)\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "?????????? ? dirmngr ???????????\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1790,23 +1782,6 @@ msgid "[User ID not found]" msgstr "[????????????? ???????????? ?? ??????]" #, c-format -msgid "(check argument of option '%s')\n" -msgstr "(????????? ???????? ????????? '%s')\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" -"????????: '%s' ?????? ???? ??????? ??????????????? ??? ?????????? ?????\n" - -#, c-format -msgid "error looking up: %s\n" -msgstr "?????? ??????: %s\n" - -#, c-format -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "????????: %s ???????? ? ??????? ?????? %d ???\n" - -#, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "????????????? ???????? '%s' ????? %s\n" @@ -1818,10 +1793,18 @@ msgid "No fingerprint" msgstr "??? ?????????" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "????? ??????????? ????? ????????????? ????? ?? %s\n" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "????????? ???? \"%s\" ?? ??????: %s\n" #, c-format +msgid "(check argument of option '%s')\n" +msgstr "(????????? ???????? ????????? '%s')\n" + +#, c-format msgid "Warning: not using '%s' as default key: %s\n" msgstr "????????: '%s' ?? ???????????? ? ???????? ????????? ?????: %s\n" @@ -4776,6 +4759,10 @@ msgstr "" " ????????????? ???????????? ??????\n" #, c-format +msgid "Unknown critical signature notation: " +msgstr "??????????? ??????????? ????????? ? ???????: " + +#, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "? ????????? ???? %d ?????????? ??????????? ???\n" ----------------------------------------------------------------------- Summary of changes: po/ru.po | 49 ++++++++++++++++++------------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 12:07:10 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 30 Aug 2018 12:07:10 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-260-ga986371 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via a9863717b1b82b3077edd0db85454ba801eac9bd (commit) from 1d00fb987b903e245d484bddfe3c0a0aba670ac1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a9863717b1b82b3077edd0db85454ba801eac9bd Author: Maximilian Krambach Date: Thu Aug 30 12:04:50 2018 +0200 js: separate gpgme answer by type of data -- * src/Connection.js; src/permittedOperations.js: To avoid further encoding problems, data sent by gpgme is now sorted as either 'payload' or 'info'. Payload data may come in any encoding, and here the 'expected' and 'format' options are used, 'info' data may contain text created by gnupg which may need re-encoding, but this should not be affected by 'expected' and 'format' diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index c4921d5..a421985 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -243,7 +243,7 @@ class Answer{ for (let i= 0; i < messageKeys.length; i++){ let key = messageKeys[i]; switch (key) { - case 'type': + case 'type': { if (_decodedResponse.type === 'error'){ return (gpgme_error('GNUPG_ERROR', decode(_decodedResponse.msg))); @@ -251,39 +251,60 @@ class Answer{ return gpgme_error('CONN_UNEXPECTED_ANSWER'); } break; - case 'base64': + } + case 'base64': { break; - case 'msg': + } + case 'msg': { if (_decodedResponse.type === 'error'){ return (gpgme_error('GNUPG_ERROR', _decodedResponse.msg)); } break; - default: - if (!poa.data.hasOwnProperty(key)){ - return gpgme_error('CONN_UNEXPECTED_ANSWER'); + } + default: { + let answerType = null; + if (poa.payload && poa.payload.hasOwnProperty(key)){ + answerType = 'p'; + } else if (poa.info && poa.info.hasOwnProperty(key)){ + answerType = 'i'; } - if ( typeof (_decodedResponse[key]) !== poa.data[key] ){ + if (answerType !== 'p' && answerType !== 'i'){ return gpgme_error('CONN_UNEXPECTED_ANSWER'); } - if (_decodedResponse.base64 === true - && poa.data[key] === 'string' - ) { - if (this.expected === 'uint8'){ - _response[key] = atobArray(_decodedResponse[key]); - _response.format = 'uint8'; - } else if (this.expected === 'base64'){ + + if (answerType === 'i') { + if ( typeof (_decodedResponse[key]) !== poa.info[key] ){ + return gpgme_error('CONN_UNEXPECTED_ANSWER'); + } + _response[key] = decode(_decodedResponse[key]); + + } else if (answerType === 'p') { + if (_decodedResponse.base64 === true + && poa.payload[key] === 'string' + ) { + if (this.expected === 'uint8'){ + _response[key] = atobArray(_decodedResponse[key]); + _response.format = 'uint8'; + + } else if (this.expected === 'base64'){ + _response[key] = _decodedResponse[key]; + _response.format = 'base64'; + + } else { // no 'expected' + _response[key] = Utf8ArrayToStr( + atobArray(_decodedResponse[key])); + _response.format = 'string'; + } + } else if (poa.payload[key] === 'string') { _response[key] = _decodedResponse[key]; - _response.format = 'base64'; } else { - _response[key] = Utf8ArrayToStr( - atobArray(_decodedResponse[key])); - _response.format = 'string'; + // fallthrough, should not be reached + // (payload is always string) + return gpgme_error('CONN_UNEXPECTED_ANSWER'); } - } else { - _response[key] = decode(_decodedResponse[key]); } break; - } + } } } return _response; } diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js index efb34f9..c3c72ca 100644 --- a/lang/js/src/permittedOperations.js +++ b/lang/js/src/permittedOperations.js @@ -42,8 +42,12 @@ * @property {Object} answer The definition on what to expect as answer, if the * answer is not an error * @property {Array} answer.type the type(s) as reported by gpgme-json. - * @property {Object} answer.data key-value combinations of expected properties - * of an answer and their type ('boolean', 'string', object) + * @property {Object} answer.payload key-value combinations of expected + * properties of an answer and their type ('boolean', 'string', object), which + * may need further decoding from base64 + * @property {Object} answer.info key-value combinations of expected + * properties of an answer and their type ('boolean', 'string', object), which + * are meant to be data directly sent by gpgme (i.e. user ids) @const */ export const permittedOperations = { @@ -104,8 +108,10 @@ export const permittedOperations = { }, answer: { type: ['ciphertext'], - data: { - 'data': 'string', + payload: { + 'data': 'string' + }, + info: { 'base64':'boolean' } } @@ -129,8 +135,10 @@ export const permittedOperations = { }, answer: { type: ['plaintext'], - data: { + payload: { 'data': 'string', + }, + info: { 'base64': 'boolean', 'mime': 'boolean', 'info': 'object', @@ -171,11 +179,12 @@ export const permittedOperations = { }, answer: { type: ['signature', 'ciphertext'], - data: { + payload: { 'data': 'string', + }, + info: { 'base64':'boolean' } - } }, @@ -223,9 +232,9 @@ export const permittedOperations = { }, answer: { type: ['keys'], - data: { + info: { + 'keys': 'object', 'base64': 'boolean', - 'keys': 'object' } } }, @@ -263,8 +272,10 @@ export const permittedOperations = { }, answer: { type: ['keys'], - data: { + payload: { 'data': 'string', + }, + info: { 'base64': 'boolean', 'sec-fprs': 'object' } @@ -288,7 +299,7 @@ export const permittedOperations = { }, answer: { type: [], - data: { + info: { 'result': 'object' } } @@ -308,7 +319,7 @@ export const permittedOperations = { }, }, answer: { - data: { + info: { 'success': 'boolean' } } @@ -319,7 +330,7 @@ export const permittedOperations = { optional: {}, answer: { type: [''], - data: { + info: { 'gpgme': 'string', 'info': 'object' } @@ -346,7 +357,7 @@ export const permittedOperations = { }, answer: { type: [''], - data: { 'fingerprint': 'string' } + info: { 'fingerprint': 'string' } } }, @@ -370,10 +381,12 @@ export const permittedOperations = { }, answer: { type: ['plaintext'], - data:{ - data: 'string', - base64:'boolean', - info: 'object' + payload:{ + 'data': 'string' + }, + info: { + 'base64':'boolean', + 'info': 'object' // info.file_name: Optional string of the plaintext file name. // info.is_mime: Boolean if the messages claims it is MIME. // info.signatures: Array of signatures @@ -395,15 +408,9 @@ export const permittedOperations = { optional: {}, answer: { type: [], - data: { - option: 'object' + info: { + 'option': 'object' } } } - - /** - * TBD handling of secrets - * TBD key modification? - */ - }; ----------------------------------------------------------------------- Summary of changes: lang/js/src/Connection.js | 63 +++++++++++++++++++++++++------------- lang/js/src/permittedOperations.js | 59 +++++++++++++++++++---------------- 2 files changed, 75 insertions(+), 47 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 14:41:26 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 30 Aug 2018 14:41:26 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-167-g173a8a5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 173a8a5f416ce85ae8de0334cc48a61bb4df7840 (commit) via d063cd7c55c7a07a6c9fc4ae5029bce4421fe0eb (commit) from 223014d35805145d262aa153f2be2a882eaf1207 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 173a8a5f416ce85ae8de0334cc48a61bb4df7840 Author: Andre Heinecke Date: Thu Aug 30 14:41:16 2018 +0200 Revert "Check for PGP/Inline inside of S/MIME mails" This reverts commit 1656e01d2eb19c8349dcab9d9b7e25fb85b9c854. diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index da7675e..562a903 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -1243,24 +1243,6 @@ change_message_class_ipm_note_smime_multipartsigned (LPMESSAGE message) xfree (attach_mime); } } - else - { - /* This is enterprise level gateway encryption stuff. - - E.g. we can have awesome other tools that send pgp - inline and a gateway that signs everything with S/MIME. - - So let's look at the body to figure out if we are - PGP. */ - newvalue = get_msgcls_from_pgp_lines (message); - - if (newvalue) - { - log_debug ("%s:%s: PGP Inline detected in S/MIME message. " - "Type is now '%s'", - SRCNAME, __func__, newvalue); - } - } xfree (proto); xfree (ct); } commit d063cd7c55c7a07a6c9fc4ae5029bce4421fe0eb Author: Andre Heinecke Date: Thu Aug 30 14:41:08 2018 +0200 Revert "Also check for pgp/inline in IPM.Note.SMIME" This reverts commit 0e05606f693114b491a74030e7ae54c75738eeae. diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index d9e276d..da7675e 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -1506,29 +1506,6 @@ mapi_change_message_class (LPMESSAGE message, int sync_override, newvalue = change_message_class_ipm_note_smime_multipartsigned (message); } - else if (!opt.enable_smime && !strcmp (s, "IPM.Note.SMIME")) - { - /* This is enterprise level gateway encryption stuff. - - E.g. we can have awesome other tools that send pgp - inline and a gateway that signs everything with S/MIME. - - So let's look at the body to figure out if we are - PGP. - - This won't work usually as the body is not yet accessible. - Still it does not hurt to try as the experience is that - the message class in outlook is not used consistently. - */ - newvalue = get_msgcls_from_pgp_lines (message); - - if (newvalue) - { - log_debug ("%s:%s: PGP Inline detected in S/MIME message. " - "Type is now '%s'", - SRCNAME, __func__, newvalue); - } - } else if (sync_override && have_override && !strncmp (s, "IPM.Note.GpgOL", 14) && (!s[14]||s[14] =='.')) { ----------------------------------------------------------------------- Summary of changes: src/mapihelp.cpp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 15:02:21 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 30 Aug 2018 15:02:21 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-262-g3201ded Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 3201ded91f91fcdf501ad966380b6ff29d798b09 (commit) via 44691995b72c483ee8a91f11767b2bd317072d5a (commit) from a9863717b1b82b3077edd0db85454ba801eac9bd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3201ded91f91fcdf501ad966380b6ff29d798b09 Author: Maximilian Krambach Date: Thu Aug 30 15:00:19 2018 +0200 js: add tests -- * BrowserTestExtension/tests: - decryptTest.js: Check Decryption and return values of binary data - encryptTest.js: Return data type of armored/non-armored encryption - added a small encoded input png for testing * DemoExtension/maindemo.js: Fixed unexpected usage of the Demo encrypt (non-armored) diff --git a/lang/js/BrowserTestExtension/tests/decryptTest.js b/lang/js/BrowserTestExtension/tests/decryptTest.js index 8852cb6..606d96e 100644 --- a/lang/js/BrowserTestExtension/tests/decryptTest.js +++ b/lang/js/BrowserTestExtension/tests/decryptTest.js @@ -22,7 +22,7 @@ */ /* global describe, it, before, expect, Gpgmejs */ -/* global bigString, inputvalues, sabotageMsg*/ +/* global bigString, inputvalues, sabotageMsg, binaryData */ describe('Decryption', function () { let context = null; @@ -76,4 +76,26 @@ describe('Decryption', function () { done(); }); }); + + it('decrypt of a png, result as base64', function (done){ + const data = binaryData.encryptedArmored; + context.decrypt({ data: data, expect: 'base64' }) + .then(function (result){ + expect(result.data).to.be.a('String'); + expect(result.data).to.equal(binaryData.base64); + expect(result.format).to.equal('base64'); + done(); + }); + }); + + it('decrypt of a png, result as Uint8Array', function (done){ + const data = binaryData.encryptedArmored; + context.decrypt({ data: data, expect: 'uint8' }) + .then(function (result){ + expect(result.data).to.be.an('Uint8Array'); + expect(result.format).to.equal('uint8'); + done(); + }); + }); + }); \ No newline at end of file diff --git a/lang/js/BrowserTestExtension/tests/encryptTest.js b/lang/js/BrowserTestExtension/tests/encryptTest.js index ccdb499..d97b458 100644 --- a/lang/js/BrowserTestExtension/tests/encryptTest.js +++ b/lang/js/BrowserTestExtension/tests/encryptTest.js @@ -22,7 +22,7 @@ */ /* global describe, it, expect, before, Gpgmejs */ -/* global inputvalues, fixedLengthString */ +/* global inputvalues, fixedLengthString, bigString */ describe('Encryption', function () { let context = null; @@ -47,6 +47,47 @@ describe('Encryption', function () { }); }); + + it( 'encrypt with \'armor\': true should returned an armored block', + function (done){ + const data = bigString(1000); + context.encrypt({ data: data, publicKeys: good_fpr, armor: true }) + .then(function (answer){ + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.data).to.include('BEGIN PGP MESSAGE'); + expect(answer.data).to.include('END PGP MESSAGE'); + expect(answer.format).to.equal('ascii'); + done(); + }); + }); + + it( 'encrypt with \'armor\': false and \'expected\': \'uint8\' returns ' + + 'an Uint8Array', function (done) { + const data = bigString(1000); + context.encrypt({ + data: data, publicKeys: good_fpr, armor: false, expect: 'uint8' + }).then(function (answer){ + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('Uint8Array'); + expect(answer.format).to.equal('uint8'); + done(); + }); + }); + + it( 'encrypt with \'armor\': false and \'expected\': \'base64\' returns ' + + 'a base64 string', function (done) { + const data = bigString(1000); + context.encrypt({ + data: data, publicKeys: good_fpr, armor: false, expect: 'base64' + }).then(function (answer){ + expect(answer).to.not.be.empty; + expect(answer.data).to.be.a('string'); + expect(answer.format).to.equal('base64'); + done(); + }); + }); + const sizes = [5,20,50]; for (let i=0; i < sizes.length; i++) { it('Successful encrypt a ' + sizes[i] + 'MB message', function (done) { @@ -114,5 +155,5 @@ describe('Encryption', function () { }); }).timeout(8000); - // TODO check different valid parameter + }); diff --git a/lang/js/BrowserTestExtension/tests/inputvalues.js b/lang/js/BrowserTestExtension/tests/inputvalues.js index 5c2abf3..6b66621 100644 --- a/lang/js/BrowserTestExtension/tests/inputvalues.js +++ b/lang/js/BrowserTestExtension/tests/inputvalues.js @@ -336,3 +336,73 @@ function sabotageMsg (msg, rate = 0.01, p= [35,35]){ } return msg; } + +// a simple png +// eslint-disable-next-line no-unused-vars +const binaryData = { + base64: + 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAAEwElEQVQ4y62R228b1xn' + + 'E51z27I271K64okTqRkuOLRuNHcNBCqTwS//qvvYCtAmQNrETO7akyJJsipRIUeSSez' + + 'vnfH1IkBboW5F5mpf5ATPDiAi/hTh+I8n/I/NrCcbY/4DI/GKY+E/CGLIWROCccQ7Or' + + 'bVVXWmttTHKUY6UjuP8jJMggilhVjAluILwIUMwRlpTUVBVQWsoxT1PS3E7v7u6Ho0m' + + '48boOIz63V6WdsIgZIxJmBXyMyx/QjWEbCPYReuQRNsWhbm5tqMRFQVPU6x3JlZ/e/r' + + 'm76+/OR6elbrKovT5/ae/f/L5YGcQeL5EOcHsa8z/hOY1eIbVF6b5o/YeNrnWFxf2+5' + + 'fs5kY9PDKHdlgu/vrPv/357F95UxLo7G44nk+EEO2orbKuRHOL1feo/wJ8hFEmn5dNv' + + 'JB8MRP1xYV79j68HrEss1ub15Ph8dXpoil+3lqTPZ+PXp7+8On9x51kXcLUsAtgARBR' + + 'ZfRpnn93voouxsJM5ptJsp1lfn+HwtDOpAX77/sM2bvVfFUW2hgJJ4bTQ9UH5YA1psz' + + 'zyYery69ezaihzx883BgM2GDgxFGqq92N3YvltDA1CGDwJU8j3/UYZ1rCTRE+QfMBpQ' + + 'BdgRzwAFwyKSAV1jvU38HGptvy+4J/8ej5sih+uHq31HUg+ePexvNHg27mcGch4aZY+' + + '4wsB23Z4j1XCNeOtr0dG6Eyst3tFV47ZwpQcZQcDR6YUnfD9UWxSBL/06Peo0+67WRC' + + 'cinBBKmMnE8s98gcQjlh1Nn2sqArxiusyP1Yu8WdyUzVYhVpkiQ2/PX7W4PdQXdvP1x' + + 'Lx0x9Z8BkXVVU1rQgGjZ2VPNOy9nrxPGmjdRkUs8XuqhEAcOIrCzG1zdv3/x4fn7+2b' + + 'OngTMIPZfL0mJIsHJyfc3LUlyN5Jt37MfX4uixs96TmcO5MpxqggWKhlaNiUBE1pC2M' + + 'BaWOOPM40gY7hEq+fLVKx/olOVa07hEgjEwzhnzlYg9GXs2r21L8dgXLddGaWtwtBv1' + + '/LgbWE9rzn2khK7FWPT7/Xy5bIVBO03U5qbc2+fdDZkkJBUDlGCh4h2fd0LpKlOw6VQ' + + 'MF+FQxwvlyziMAyXBJxbH8vjkhKw92N8peplyOcWRE7mMk6t4J1KRJ1arQsIwW1qqKs' + + 'ymwekV+wcTTKLeNt0OdRwowJEvXrxoJ+1wM8kTNncWQpVtIVLWapEbKIebmvQyv72pl' + + '3da2VJMSzOu1RWAnG7KpjC1VOhK/lR++YcvucPIa6biw6V+zSy7J5/6uh3IlrEMpilm' + + 'N9fvXs0uT4KtnuoHvfBBg4Y46ztHbRvLleSrFpQrDw4OGqpv9Xi0qqf1R1hs6oPaVNp' + + 'oznlT1+VycXd5cvv2a6JnycaTA/93mRqAsYytp0UoRzO7mLPQlVEUNaY2dZ3RVoVnAN' + + 'ZExhpRmrJmDYyRXtDePgDQ3r63nuwEaUaKM8CtyZlN6fhEv33DuxtScAHmhIh62I+cx' + + 'BjDaye/XU3zO85E6HvK9bODo7X+nhdGYdrx/VgoF9ZCL20zqW9v6f17ayEBCCYDGTpc' + + 'Rc5aXdez5d3Hy/PT41MAh4eH+7s7ydY2Z8xRSjiOVC5jDLDkuBRFYm8fAEvSfwPxgHl' + + 'kzr8e4QAAAABJRU5ErkJggg==', + encryptedArmored: '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'hQEMA6B8jfIUScGEAQgA3m9gtJswzXITlX3yJslszQSBBtHb3jTquF6ZoB5NPxMC\n' + + '5sX1WkjemyjYOy/pscLb8JRedj+owfaHYAGed1h+SM8iVHrHSVImbq+okzKbkYTB\n' + + 'lYoBK63y2WHjMdMEjHHWl5CPfyzmAutwix0sWGcDLwNdO31eUdKHtjPi69k+IEw2\n' + + 'hJ0+hdulttJk5jvNtW0mmuWjzKPgekZX7AFZnO+cJEgdDXEZ9oOD3/HxM8Rw/Kba\n' + + 't7LWW/h3WxTzUKWrCO7SvcX27MGt94I1ff/2IAPb3/ZiskGrEwN6TYv8x0OaC6Xy\n' + + 'TFxVCSGbXo+dSBFUfMMnPCiY6W8DOrchwDK2sBoGO9LqAUkpzm0tYSYt5v8/vXvO\n' + + 'uXG+u8lG9I/TqnVDdZXXedBdDVFxv03K35FQU48K+AuBJLakdMfCfK3AvYRBgffu\n' + + 'NbdnQUTs8AUM3qNgN95JRM/edhir0Tfz981R8dTYbxRwuosR//yNxCXA1UUg0UeD\n' + + 'feC+AB6lRNt/P2qpt4pio4fflcnTqL5lFpAcktdvX6scKxe/GFR+ylafZMykm2A/\n' + + '+UMfTTjZKm6MqsTnk2fOaHM4AIZBebx7j4cYqV+vyaxla4drZ+7w4P4XveCIS8eD\n' + + 'VkIGRhJuRtXMFTWrV4z8BIDhUw68/h0rClC5mucdEJMUPaEK65mECxMTEggomz5/\n' + + 'BaSVDmNUoLHwqPV1fCUG+FtDhNHtqLDszlhEGNDa2NU4paGRaxJzS3IZExlhbxFX\n' + + 'pNOWS1W/gEblkzslWbOq3Gg95/MjJL8tEhlAuGnlFQqa2ZZ9/QgAujSaSnY5bQFe\n' + + '+riqxkex8YA+2v5yfhwVBF1W4TxvkP/9tL4xw/tepibwZrAEJLih+Cus6X+OC/Qw\n' + + 'qUe2ROmHwoM83iJdsrnoGaenVCBWBzSsTjVauRWD7lPT1Hgwavgz9J35mKjfyayx\n' + + 'XJxbFnHgvsRPOE5usYEsWQYrPQoDin9lpaXq5d+D3QFi/weQSVvKcC6a7jjNxeYS\n' + + 'KCc9lac+qBCLXg8F9Ff2Szkr7XuamMvHbd2FAQFiTQ5zFcrvOL8V8VuhyUERFhJE\n' + + '4xCFq/vwhC3v7+aRWhpBfRvb5IE45fHTCZsvXt8U4YdzaL/OiDzv+/S0xHda6cJx\n' + + '3ZWn7A5KQBUDvbqd1FNtjMj7yf6SIcM0OMLRulJ1Qkd7OH+9JluTu0FLw0P7AupF\n' + + 'BW2O4UUZY4K56W/wK/Je29RSd4/EmnFRBBYj6VvqY2izxCWEiwvKz0BA/+zabUol\n' + + 'eBnHXP3ATKFthBRGoN9kkCkSpoz4t+QTlUazGqJrTX57vjA+Gxdjc9Vhn4Q/Ra2f\n' + + 'c4a01h8fRP+IDVLFzh+AfcQ0Q6Fr/3+D9KUj/poS2O3G4ACfIRm8L2zaVGnfEmiT\n' + + '7T/8ZJBQrHkncXHCbbocB1g0PSFoDrXLafNKaCS2EItk+FBUF3EQKfc/FxUwFXG6\n' + + 'WhPptorUXx+TCcVuoR0ifKEnLEBnhhlwFM09gHRLxPDenSj0WIv/Nm+HP1Nd2410\n' + + 'KvcEVLo/HyJDg7GEIi6Q+EZPasCvI7vxKLBBavrvBAZwRjA2tYVYYadUnlpuMdB3\n' + + '97iY+tPZ31OjBLl7Ho3BlA7W3yd8ptuqAcvhgBpBGBDc4rW02Ohb9DcTpzZioQIl\n' + + 'Ih6p2vgIOZKz2cnJ+0sXf8xiRyPfkJE71eRkpQC9bdnddENEROXzAx80wP7kkajE\n' + + 'W8CD9LLMZC65+X4sg+0g+RDnCqgYk2XoKnBaJC1qdaMQ3OrdGoPQsjk1Bq+qyk9Q\n' + + '7CqjzK897IdV5g+OBRbHi78gvF04Ruqgnq9lPz0OfjAxlDBoGYfAUsbRJKIXbGPq\n' + + 'e57SbUkrsQXYLlbsj0vFb5z/MTveFAarbJ1/TPUYuvf9Z9w7S3qz/H8fc72fDuYM\n' + + 'oI36H4NIou/7Jh+92CA27i+eamIZ8p5Ql28rEHpNB1qfIFoO0x1u7/1P2Mq7CbfF\n' + + 'H0bg2KrSb5VkDnfHAnAF/hkt4K1yD0RcSD1abkC07cEzRmIQ95mtuX08sia3Yn0C\n' + + 'dwc4gOeR+oiHxAsyV3wvrm8/w4AAqSbBqtxafAJ44dXJsyoRSRt1vkPta1IUUFZ6\n' + + 'I+jv5nMv16jaJq6IpsI5ujxl/tKbniWC0Jjw5LqoT3beWaZ91iU=\n' + + '=AkaP\n' + + '-----END PGP MESSAGE-----\n' +}; \ No newline at end of file diff --git a/lang/js/DemoExtension/maindemo.js b/lang/js/DemoExtension/maindemo.js index b472bcc..c992e7e 100644 --- a/lang/js/DemoExtension/maindemo.js +++ b/lang/js/DemoExtension/maindemo.js @@ -29,8 +29,8 @@ document.addEventListener('DOMContentLoaded', function () { function (){ let data = document.getElementById('inputtext').value; let keyId = document.getElementById('pubkey').value; - gpgmejs.encrypt({ data: data, publicKeys: keyId, armor:false }).then( - function (answer){ + gpgmejs.encrypt({ data: data, publicKeys: keyId, armor: true }) + .then(function (answer){ if (answer.data){ document.getElementById( 'answer').value = answer.data; commit 44691995b72c483ee8a91f11767b2bd317072d5a Author: Maximilian Krambach Date: Thu Aug 30 14:46:54 2018 +0200 js: add encoding parameter for encrypt return -- * src/gpgme.js: In case the encryption was done unarmored, the result is binary data. Added an option to either return the binary data as base64-encoded string or as Uint8Array, similar to return values of decrypt diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js index 295cc04..7b835ac 100644 --- a/lang/js/src/gpgmejs.js +++ b/lang/js/src/gpgmejs.js @@ -136,6 +136,8 @@ export class GpgME { * @param {Boolean} always_trust (optional, default true) This assumes that * used keys are fully trusted. If set to false, encryption to a key not * fully trusted in gnupg will fail + * @param {String} expect in case of armored:false, request how to return + * the binary result. Accepts 'base64' or 'uint8', defaults to 'base64'. * @param {Object} additional use additional valid gpg options as * defined in {@link permittedOperations} * @returns {Promise} Object containing the encrypted @@ -143,7 +145,8 @@ export class GpgME { * @async */ encrypt ({ data, publicKeys, secretKeys, base64 = false, armor = true, - wildcard, always_trust = true, additional = {} } = {}){ + wildcard, always_trust = true, expect = 'base64', + additional = {} } = {}){ if (typeof arguments[0] !== 'object') { return Promise.reject(gpgme_error('PARAM_WRONG')); } @@ -156,7 +159,11 @@ export class GpgME { } if (armor === false){ msg.setParameter('armor', false); - msg.expected = 'base64'; + if (expect === 'uint8' || expect === 'base64') { + msg.expected = expect; + } else { + return Promise.reject(gpgme_error('PARAM_WRONG')); + } } else if (armor === true) { msg.setParameter('armor', true); } ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/tests/decryptTest.js | 24 +++++++- lang/js/BrowserTestExtension/tests/encryptTest.js | 45 ++++++++++++++- lang/js/BrowserTestExtension/tests/inputvalues.js | 70 +++++++++++++++++++++++ lang/js/DemoExtension/maindemo.js | 4 +- lang/js/src/gpgmejs.js | 11 +++- 5 files changed, 147 insertions(+), 7 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 15:38:52 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 30 Aug 2018 15:38:52 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-263-g5d6039f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 5d6039f6bf9bbbfec572055dcf5ca660041461af (commit) from 3201ded91f91fcdf501ad966380b6ff29d798b09 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5d6039f6bf9bbbfec572055dcf5ca660041461af Author: Maximilian Krambach Date: Thu Aug 30 15:37:37 2018 +0200 js: decoding of information -- * src/Helpers.js: This additional escape should 'repair' special characters like spaces in filenames. In the strange world of encoding there is little hope that this captures all cases, or that it will never fail to return some value, let alone meaningful. In my test cases it worked. diff --git a/lang/js/src/Helpers.js b/lang/js/src/Helpers.js index aa267f6..952c09f 100644 --- a/lang/js/src/Helpers.js +++ b/lang/js/src/Helpers.js @@ -116,7 +116,7 @@ export function isLongId (value){ export function decode (property){ if (typeof property === 'string'){ try { - return decodeURIComponent(escape(property)); + return decodeURIComponent(escape(unescape(property))); } catch (error){ if (error instanceof URIError) { ----------------------------------------------------------------------- Summary of changes: lang/js/src/Helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 15:43:46 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 30 Aug 2018 15:43:46 +0200 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.9-22-g4b5cdde Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 4b5cddeb58915b634c041e3a7f0e3d0c807cf1bd (commit) via 24697074f44c18eeeedbc1e09d35f56504c57a1f (commit) from 2f5ba3a6c19b7a514488be01b7683287d74545d3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4b5cddeb58915b634c041e3a7f0e3d0c807cf1bd Author: Werner Koch Date: Thu Aug 30 15:34:38 2018 +0200 Post release updates. -- diff --git a/NEWS b/NEWS index f446e43..baace07 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Noteworthy changes in version 2.2.11 (unreleased) +------------------------------------------------- + + Noteworthy changes in version 2.2.10 (2018-08-30) ------------------------------------------------- diff --git a/configure.ac b/configure.ac index 8c80377..5106bd9 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ min_automake_version="1.14" m4_define([mym4_package],[gnupg]) m4_define([mym4_major], [2]) m4_define([mym4_minor], [2]) -m4_define([mym4_micro], [10]) +m4_define([mym4_micro], [11]) # To start a new development series, i.e a new major or minor number # you need to mark an arbitrary commit before the first beta release diff --git a/po/ca.po b/po/ca.po index 882781c..e97c9f3 100644 --- a/po/ca.po +++ b/po/ca.po @@ -883,16 +883,18 @@ msgstr "AV?S: %s ?s una opci? desaconsellada.\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "ha fallat l'actualitzaci?: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +# Dest?s? ivb +# Desat?s, s?. jm +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "no es pot fet aix? en mode desat?s\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" # Dest?s? ivb @@ -905,14 +907,6 @@ msgstr "no es pot fet aix? en mode desat?s\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1974,23 +1968,6 @@ msgid "[User ID not found]" msgstr "[No s'ha trobat l'id d'usuari]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "opcions d'importaci? no v?lides\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "error en la lectura de ?%s?: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "error en crear l'anell ?%s?: %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "error en crear ?%s?: %s\n" @@ -2002,11 +1979,19 @@ msgstr "error en crear ?%s?: %s\n" msgid "No fingerprint" msgstr "Empremta digital:" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "no s'ha trobat la clau secreta ?%s?: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "opcions d'importaci? no v?lides\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NOM|usa NOM com a clau secreta predeterminada" @@ -5161,6 +5146,11 @@ msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "" "AV?S: la clau de sessi? pot estar xifrada sim?tricament de forma insegura\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Notaci? de signatura cr?tica: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "el subpaquet de tipus %d t? el bit cr?tic activat\n" @@ -9403,6 +9393,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "error en la lectura de ?%s?: %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "error en crear l'anell ?%s?: %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "error en la lectura de ?%s?: %s\n" diff --git a/po/cs.po b/po/cs.po index a3a9dc1..8155691 100644 --- a/po/cs.po +++ b/po/cs.po @@ -852,19 +852,21 @@ msgstr "VAROV?N?: ?%s%s? je zastaral? parametr?? ne??inkuje\n" msgid "unknown debug flag '%s' ignored\n" msgstr "nezn?m? ladic? p??znak ?%s? se ignoruje\n" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "gpg-agent neb????? spou?t? se ?%s?\n" - -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" +#, fuzzy, c-format +#| msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "?ek? se na agenta? (%d?s)\n" -#, c-format -msgid "connection to agent established\n" +#, fuzzy, c-format +#| msgid "connection to agent established\n" +msgid "connection to %s established\n" msgstr "spojen? na agenta ustanoveno\n" #, c-format +msgid "no running gpg-agent - starting '%s'\n" +msgstr "gpg-agent neb????? spou?t? se ?%s?\n" + +#, c-format msgid "connection to agent is in restricted mode\n" msgstr "spojen? na agenta je v?omezen?m re?imu\n" @@ -872,14 +874,6 @@ msgstr "spojen? na agenta je v?omezen?m re?imu\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "??dn? dirmngr neb????? spou?t? se ?%s?\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "?ek? se na dirmngr? (%d?s)\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "spojen? na?dirmngr ustanoveno\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1834,22 +1828,6 @@ msgid "[User ID not found]" msgstr "[ID u?ivatele nenalezeno]" #, c-format -msgid "(check argument of option '%s')\n" -msgstr "(zkontrolujte argument volby ?%s?)\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "Pozor: ?%s? by m?l b?t dlouh? identifik?tor kl??e nebo jeho otisk\n" - -#, c-format -msgid "error looking up: %s\n" -msgstr "chyba p?i vyhled?v?n?: %s\n" - -#, c-format -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "Pozor: %s se nach?z? v?souboru kl??? (keyring) %dkr?t\n" - -#, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "?%s? automaticky z?sk?no p?es %s\n" @@ -1861,10 +1839,18 @@ msgid "No fingerprint" msgstr "Chyb? otisk" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "tajn? kl?? ?%s? nenalezen: %s\n" #, c-format +msgid "(check argument of option '%s')\n" +msgstr "(zkontrolujte argument volby ?%s?)\n" + +#, c-format msgid "Warning: not using '%s' as default key: %s\n" msgstr "Pozor: jako v?choz? kl?? se nepou?ije ?%s?: %s\n" @@ -4802,6 +4788,11 @@ msgstr "nemohu pracovat s algoritmem ve?ejn?ho kl??e %d\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "VAROV?N?: potencion?ln? nebezpe?n? symetricky za?ifrov?n kl?? sezen?\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kritick? podepisovac? notace: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "podpacket typu %d m? nastaven? kritick? bit\n" @@ -8933,6 +8924,21 @@ msgstr "" "Syntaxe: gpg-check-pattern [volby] soubor_se_vzorem\n" "Prov??? heslo zadan? na vstupu proti souboru se vzory\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "?ek? se na dirmngr? (%d?s)\n" + +#~ msgid "connection to the dirmngr established\n" +#~ msgstr "spojen? na?dirmngr ustanoveno\n" + +#~ msgid "Warning: '%s' should be a long key ID or a fingerprint\n" +#~ msgstr "Pozor: ?%s? by m?l b?t dlouh? identifik?tor kl??e nebo jeho otisk\n" + +#~ msgid "error looking up: %s\n" +#~ msgstr "chyba p?i vyhled?v?n?: %s\n" + +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "Pozor: %s se nach?z? v?souboru kl??? (keyring) %dkr?t\n" + #~ msgid "using \"http\" instead of \"https\"\n" #~ msgstr "nam?sto ?https? se pou?ije ?http?\n" diff --git a/po/da.po b/po/da.po index 06a0e00..0128441 100644 --- a/po/da.po +++ b/po/da.po @@ -922,18 +922,19 @@ msgid "unknown debug flag '%s' ignored\n" msgstr "" #, fuzzy, c-format -#| msgid "no running gpg-agent - starting one\n" -msgid "no running gpg-agent - starting '%s'\n" -msgstr "ingen k?rende gpg-agent - starter en\n" - -#, fuzzy, c-format #| msgid "waiting %d seconds for the agent to come up\n" -msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "venter %d sekunder p? at agenten kommer frem\n" -#, c-format -msgid "connection to agent established\n" -msgstr "" +#, fuzzy, c-format +#| msgid "can't connect to the dirmngr - trying fall back\n" +msgid "connection to %s established\n" +msgstr "kan ikke forbinde til dirmngr - fors?ger reserve\n" + +#, fuzzy, c-format +#| msgid "no running gpg-agent - starting one\n" +msgid "no running gpg-agent - starting '%s'\n" +msgstr "ingen k?rende gpg-agent - starter en\n" #, fuzzy, c-format #| msgid "can't connect to the dirmngr - trying fall back\n" @@ -945,16 +946,6 @@ msgstr "kan ikke forbinde til dirmngr - fors?ger reserve\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "ingen k?rende dirmngr - starter ?%s?\n" -#, fuzzy, c-format -#| msgid "waiting %d seconds for the agent to come up\n" -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "venter %d sekunder p? at agenten kommer frem\n" - -#, fuzzy, c-format -#| msgid "can't connect to the dirmngr - trying fall back\n" -msgid "connection to the dirmngr established\n" -msgstr "kan ikke forbinde til dirmngr - fors?ger reserve\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1953,25 +1944,6 @@ msgid "[User ID not found]" msgstr "[Bruger-id blev ikke fundet]" #, fuzzy, c-format -#| msgid "missing argument for option \"%.50s\"\n" -msgid "(check argument of option '%s')\n" -msgstr "manglende parameter for indstilling ?%.50s?\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -#| msgid "error closing %s: %s\n" -msgid "error looking up: %s\n" -msgstr "fejl ved lukning af %s: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "fejl ved oprettelse af n?glering ?%s?: %s\n" - -#, fuzzy, c-format #| msgid "automatically retrieved `%s' via %s\n" msgid "automatically retrieved '%s' via %s\n" msgstr "hentede automatisk ?%s? via %s\n" @@ -1985,10 +1957,19 @@ msgid "No fingerprint" msgstr "Ingen fingeraftryk" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "hemmelig n?gle ?%s? blev ikke fundet: %s\n" #, fuzzy, c-format +#| msgid "missing argument for option \"%.50s\"\n" +msgid "(check argument of option '%s')\n" +msgstr "manglende parameter for indstilling ?%.50s?\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NAME|brug NAVN som hemmelig standardn?gle" @@ -5094,6 +5075,11 @@ msgstr "kan ikke h?ndtere offentlig n?glealgoritme %d\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "ADVARSEL: potentiel usikker symmetrisk krypteret sessionsn?gle\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kritisk underskriftnotation: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "underpakke af typen %d har kritiske bits?t\n" @@ -9533,6 +9519,21 @@ msgstr "" "Kontroller en adgangsfrase angivet p? stdin mod m?nsterfilen\n" #, fuzzy +#~| msgid "waiting %d seconds for the agent to come up\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "venter %d sekunder p? at agenten kommer frem\n" + +#, fuzzy +#~| msgid "error closing %s: %s\n" +#~ msgid "error looking up: %s\n" +#~ msgstr "fejl ved lukning af %s: %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "fejl ved oprettelse af n?glering ?%s?: %s\n" + +#, fuzzy #~| msgid "error running `%s': exit status %d\n" #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "fejl ved k?rsel af ?%s?: afslutningsstatus %d\n" diff --git a/po/de.po b/po/de.po index 7cb1f1e..2e73b83 100644 --- a/po/de.po +++ b/po/de.po @@ -1836,7 +1836,8 @@ msgstr "Kein Fingerabdruck vorhanden" #, c-format msgid "checking for a fresh copy of an expired key via %s\n" -msgstr "Pr?fe auf eine aktuellere Kopie eines abgelaufenen Schl?ssels ?ber %s\n" +msgstr "" +"Pr?fe auf eine aktuellere Kopie eines abgelaufenen Schl?ssels ?ber %s\n" #, c-format msgid "secret key \"%s\" not found: %s\n" diff --git a/po/el.po b/po/el.po index f80dfe5..a6a324c 100644 --- a/po/el.po +++ b/po/el.po @@ -849,16 +849,16 @@ msgstr "?????????????: \"%s\" ????? ??? ?? ??????? msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "? ????????? ???????: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "??? ?????? ?? ????? ???? ?? ????????? ?????? (batchmode)\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -869,14 +869,6 @@ msgstr "??? ?????? ?? ????? ???? ?? ????????? ? msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1907,23 +1899,6 @@ msgid "[User ID not found]" msgstr "[User id ??? ???????]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "?? ??????? ???????? ?????????\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "?????? ???? ??? ???????? ??? `%s': %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "???????? ??????????? ??? ??????????? `%s': %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "?????? ???? ?? ?????????? ??? `%s': %s\n" @@ -1935,11 +1910,19 @@ msgstr "?????? ???? ?? ?????????? ??? `%s': %s\n" msgid "No fingerprint" msgstr "?????????? ??? fingerprint" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "?? ??????? ?????? `%s' ?? ???????: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "?? ??????? ???????? ?????????\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|?????|????? ???????? ??? ?????????????? ??????? ??????" @@ -5052,6 +5035,11 @@ msgstr "???????? ????????? ??? ?????????? ???? msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "?????????????: ??????? ?? ??????? ??????????????? ?????????? ??????\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "???????? ???????? ?????????: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "????????? ????? %d ???? ???????? ?? ??????? bit\n" @@ -9238,6 +9226,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "?????? ???? ??? ???????? ??? `%s': %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "???????? ??????????? ??? ??????????? `%s': %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "?????? ???? ??? ???????? ??? `%s': %s\n" diff --git a/po/eo.po b/po/eo.po index 2bb2db6..bf430e4 100644 --- a/po/eo.po +++ b/po/eo.po @@ -849,16 +849,16 @@ msgstr "AVERTO: '%s' estas malplena dosiero\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "aktualigo malsukcesis: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "ne povas fari tion en neinteraga re?imo\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -869,14 +869,6 @@ msgstr "ne povas fari tion en neinteraga re?imo\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1889,23 +1881,6 @@ msgid "[User ID not found]" msgstr "[Uzantidentigilo ne trovita]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "nevalida kiraso" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "eraro dum legado de '%s': %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "eraro dum kreado de ?losilaro '%s': %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "eraro dum kreado de '%s': %s\n" @@ -1917,11 +1892,19 @@ msgstr "eraro dum kreado de '%s': %s\n" msgid "No fingerprint" msgstr "Fingrospuro:" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "?losilo '%s' ne trovita: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "nevalida kiraso" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NOMO|uzi NOMOn kiel la implicitan sekretan ?losilon" @@ -5007,6 +4990,10 @@ msgstr "ne povas trakti publik?losilan metodon %d\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "" +#, fuzzy, c-format +msgid "Unknown critical signature notation: " +msgstr "Subskribo-notacio: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "subpaketo de speco %d havas ?altitan \"critical bit\"\n" @@ -9155,6 +9142,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "eraro dum legado de '%s': %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "eraro dum kreado de ?losilaro '%s': %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "eraro dum legado de '%s': %s\n" diff --git a/po/es.po b/po/es.po index f2678af..9e62659 100644 --- a/po/es.po +++ b/po/es.po @@ -853,19 +853,21 @@ msgstr "ATENCI?N: \"%s%s\" es una opci?n obsoleta - no tiene efecto\n" msgid "unknown debug flag '%s' ignored\n" msgstr "etiqueta de debug '%s' ignorada\n" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "no hay gpg-agent en ejecuci?n - iniciando '%s'\n" - -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" +#, fuzzy, c-format +#| msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "esperando que el agente arranque... ( %ds)\n" -#, c-format -msgid "connection to agent established\n" +#, fuzzy, c-format +#| msgid "connection to agent established\n" +msgid "connection to %s established\n" msgstr "conexi?n establecida al agente\n" #, c-format +msgid "no running gpg-agent - starting '%s'\n" +msgstr "no hay gpg-agent en ejecuci?n - iniciando '%s'\n" + +#, c-format msgid "connection to agent is in restricted mode\n" msgstr "la conexi?n al agente est? en modo restringido\n" @@ -873,14 +875,6 @@ msgstr "la conexi?n al agente est? en modo restringido\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "no hay dirmngr en ejecuci?n - iniciando '%s'\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "esperando que el dirmngr arranque... ( %ds)\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "conexi?n establecida al dirmngr\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1820,26 +1814,6 @@ msgid "[User ID not found]" msgstr "[ID de usuario no encontrado]" #, c-format -msgid "(check argument of option '%s')\n" -msgstr "(revisar el par?metro de la opci?n '%s')\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" -"Atenci?n: '%s' deber?a ser un identificador largo de usuario o una huella " -"digital\n" - -#, c-format -msgid "error looking up: %s\n" -msgstr "error al buscar: %s\n" - -#, c-format -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "" -"Advertencia: %s aparece %d veces en el anillo de claves\n" -"\n" - -#, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "'%s' recuperado autom?ticamente v?a %s\n" @@ -1851,10 +1825,18 @@ msgid "No fingerprint" msgstr "No hay huella digital" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "clave secreta \"%s\" no encontrada: %s\n" #, c-format +msgid "(check argument of option '%s')\n" +msgstr "(revisar el par?metro de la opci?n '%s')\n" + +#, c-format msgid "Warning: not using '%s' as default key: %s\n" msgstr "Advertencia: no estamos usando '%s' como clave predeterminada: %s\n" @@ -4771,6 +4753,11 @@ msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "" "AVISO: clave de sesi?n cifrada sim?tricamente potencialmente insegura\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Notaci?n de firmas cr?ticas: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "el subpaquete de tipo %d tiene el bit cr?tico activado\n" @@ -8914,6 +8901,25 @@ msgstr "" "Compara frase contrase?a dada en entrada est?ndar con un fichero de " "patrones\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "esperando que el dirmngr arranque... ( %ds)\n" + +#~ msgid "connection to the dirmngr established\n" +#~ msgstr "conexi?n establecida al dirmngr\n" + +#~ msgid "Warning: '%s' should be a long key ID or a fingerprint\n" +#~ msgstr "" +#~ "Atenci?n: '%s' deber?a ser un identificador largo de usuario o una huella " +#~ "digital\n" + +#~ msgid "error looking up: %s\n" +#~ msgstr "error al buscar: %s\n" + +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "" +#~ "Advertencia: %s aparece %d veces en el anillo de claves\n" +#~ "\n" + #~ msgid "What keysize do you want for the Signature key? (%u) " #~ msgstr "?De qu? tama?o quiere la clave de Firmado? (%u) " diff --git a/po/et.po b/po/et.po index 0db43e6..4a64887 100644 --- a/po/et.po +++ b/po/et.po @@ -846,16 +846,16 @@ msgstr "HOIATUS: v?tit \"%s\" ei soovitata kasutada.\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "uuendamine eba?nnestus: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "seda ei saa teha pakettmoodis\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -866,14 +866,6 @@ msgstr "seda ei saa teha pakettmoodis\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1898,23 +1890,6 @@ msgid "[User ID not found]" msgstr "[Kasutaja id puudub]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "vigased impordi v?tmed\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "viga `%s' lugemisel: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "viga v?tmehoidla `%s' loomisel: %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "viga `%s' loomisel: %s\n" @@ -1926,11 +1901,19 @@ msgstr "viga `%s' loomisel: %s\n" msgid "No fingerprint" msgstr "n?ita s?rmej?lge" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "salajast v?tit `%s' ei leitud: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "vigased impordi v?tmed\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NIMI|kasuta NIME vaikimisi salajase v?tmena" @@ -4999,6 +4982,11 @@ msgstr "" "HOIATUS: t?en?oliselt ebaturvaline s?mmeetriliselt kr?pteeritud sessiooni " "v?ti\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kriitiline allkirja noteerimine: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "alampaketil t??biga %d on kriitiline bitt seatud\n" @@ -9154,6 +9142,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "viga `%s' lugemisel: %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "viga v?tmehoidla `%s' loomisel: %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "viga `%s' lugemisel: %s\n" diff --git a/po/fi.po b/po/fi.po index 302c3c0..5fb814d 100644 --- a/po/fi.po +++ b/po/fi.po @@ -863,16 +863,16 @@ msgstr "VAROITUS: \"%s\" on paheksuttu valitsin\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "p?ivitys ep?onnistui: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "t?t? ei voi tehd? er?ajossa\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -883,14 +883,6 @@ msgstr "t?t? ei voi tehd? er?ajossa\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1913,23 +1905,6 @@ msgid "[User ID not found]" msgstr "[K?ytt?j?tunnusta ei l?ytynyt]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "virheelliset tuontivalitsimet\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "virhe luettaessa tiedostoa \"%s\": %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "virhe luotaessa avainrengasta \"%s\": %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "virhe luotaessa \"%s\": %s\n" @@ -1941,11 +1916,19 @@ msgstr "virhe luotaessa \"%s\": %s\n" msgid "No fingerprint" msgstr "n?yt? sormenj?lki" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "salaista avainta \"%s\" ei l?ydy: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "virheelliset tuontivalitsimet\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NIMI|k?yt? oletusarvoisesti salaista avainta NIMI" @@ -5036,6 +5019,11 @@ msgstr "julkisen avaimen algorimin %d k?sittely ei onnistu\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "VAROITUS: mahdollisesti turvaton symmetrisesti salattu istuntoavain\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kriittinen allekirjoitusnotaatio: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "tyypin %d alipaketilla on kriittinen bitti asetettuna\n" @@ -9216,6 +9204,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "virhe luettaessa tiedostoa \"%s\": %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "virhe luotaessa avainrengasta \"%s\": %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "virhe luettaessa tiedostoa \"%s\": %s\n" diff --git a/po/fr.po b/po/fr.po index fbd70af..c2a3d10 100644 --- a/po/fr.po +++ b/po/fr.po @@ -866,19 +866,21 @@ msgstr "Attention?: ??%s%s?? est une option obsol?te ??non prise en com msgid "unknown debug flag '%s' ignored\n" msgstr "" +#, fuzzy, c-format +#| msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "attente pour permettre ? l'agent d'arriver? (%d?s)\n" + +#, fuzzy, c-format +#| msgid "connection to agent established\n" +msgid "connection to %s established\n" +msgstr "connexion ? l'agent ?tablie\n" + #, c-format msgid "no running gpg-agent - starting '%s'\n" msgstr "" "pas d'instance de gpg-agent en cours d'ex?cution ??d?marrage de ??%s??\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "attente pour permettre ? l'agent d'arriver? (%d?s)\n" - -#, c-format -msgid "connection to agent established\n" -msgstr "connexion ? l'agent ?tablie\n" - #, fuzzy, c-format #| msgid "connection to agent established\n" msgid "connection to agent is in restricted mode\n" @@ -888,14 +890,6 @@ msgstr "connexion ? l'agent ?tablie\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "pas d'instance de Dirmngr en cours d'ex?cution ??d?marrage de ??%s??\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "attente pour permettre au dirmngr d'arriver? (%d?s)\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "connexion au dirmngr ?tablie\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1875,25 +1869,6 @@ msgstr "erreur de cr?ation de ??%s???: %s\n" msgid "[User ID not found]" msgstr "[identit? introuvable]" -#, fuzzy, c-format -#| msgid "missing argument for option \"%.50s\"\n" -msgid "(check argument of option '%s')\n" -msgstr "argument manquant pour l'option ??%.50s??\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -#| msgid "error closing %s: %s\n" -msgid "error looking up: %s\n" -msgstr "erreur de fermeture de %s?: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring '%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "erreur de cr?ation du porte-clefs ??%s???: %s\n" - #, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "??%s?? automatiquement r?cup?r? par %s\n" @@ -1906,10 +1881,19 @@ msgid "No fingerprint" msgstr "Aucune empreinte" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "clef secr?te ??%s?? introuvable?: %s\n" #, fuzzy, c-format +#| msgid "missing argument for option \"%.50s\"\n" +msgid "(check argument of option '%s')\n" +msgstr "argument manquant pour l'option ??%.50s??\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NOM|utiliser le NOM comme clef secr?te par d?faut" @@ -4973,6 +4957,11 @@ msgstr "" "Attention?: la clef de session chiffr?e de mani?re sym?trique risque\n" " de ne pas ?tre s?curis?e\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Notation de signature critique?: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "un sous-paquet de type %d poss?de un bit critique\n" @@ -9290,6 +9279,22 @@ msgstr "" "V?rifier une phrase secr?te donn?e sur l'entr?e standard par rapport ? " "ficmotif\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "attente pour permettre au dirmngr d'arriver? (%d?s)\n" + +#~ msgid "connection to the dirmngr established\n" +#~ msgstr "connexion au dirmngr ?tablie\n" + +#, fuzzy +#~| msgid "error closing %s: %s\n" +#~ msgid "error looking up: %s\n" +#~ msgstr "erreur de fermeture de %s?: %s\n" + +#, fuzzy +#~| msgid "error creating keyring '%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "erreur de cr?ation du porte-clefs ??%s???: %s\n" + #~ msgid "using \"http\" instead of \"https\"\n" #~ msgstr "utilisation d'??http?? au lieu d'??https??\n" diff --git a/po/gl.po b/po/gl.po index 7610c99..a8ac8ab 100644 --- a/po/gl.po +++ b/po/gl.po @@ -850,16 +850,16 @@ msgstr "AVISO: \"%s\" ? unha opci?n a extinguir\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "a actualizaci?n fallou: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "non se pode facer iso no modo por lotes\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -870,14 +870,6 @@ msgstr "non se pode facer iso no modo por lotes\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1907,23 +1899,6 @@ msgid "[User ID not found]" msgstr "[Non se atopou o id de usuario]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "opci?ns de importaci?n non v?lidas\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "erro lendo `%s': %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "erro ao crea-lo chaveiro `%s': %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "erro ao crear `%s': %s\n" @@ -1935,11 +1910,19 @@ msgstr "erro ao crear `%s': %s\n" msgid "No fingerprint" msgstr "Pegada dactilar:" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "non se atopou a chave secreta `%s': %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "opci?ns de importaci?n non v?lidas\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NOME|empregar NOME coma chave secreta por defecto" @@ -5046,6 +5029,11 @@ msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "" "AVISO: chave de sesi?n cifrada simetricamente potencialmente insegura\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Notaci?n de sinaturas cr?ticas: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "un subpaquete de tipo %d ten o bit cr?tico posto\n" @@ -9236,6 +9224,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "erro lendo `%s': %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "erro ao crea-lo chaveiro `%s': %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "erro lendo `%s': %s\n" diff --git a/po/hu.po b/po/hu.po index ba6bfa2..c594a62 100644 --- a/po/hu.po +++ b/po/hu.po @@ -846,16 +846,16 @@ msgstr "FIGYELEM: \"%s\" elavult opci?!\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "Friss?t?s sikertelen: %s.\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "Nem tudom ezt megcsin?lni k?tegelt m?dban!\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -866,14 +866,6 @@ msgstr "Nem tudom ezt megcsin?lni k?tegelt m?dban!\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1895,23 +1887,6 @@ msgid "[User ID not found]" msgstr "[ismeretlen kulcs]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "?rv?nytelen import opci?k!\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "Hiba \"%s\" olvas?sakor: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "Hiba a(z) \"%s\" kulcskarika l?trehoz?sakor: %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "Hiba \"%s\" l?trehoz?sakor: %s\n" @@ -1923,11 +1898,19 @@ msgstr "Hiba \"%s\" l?trehoz?sakor: %s\n" msgid "No fingerprint" msgstr "megmutatja az ujjlenyomatot" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "\"%s\" titkos kulcs nem tal?lhat?: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "?rv?nytelen import opci?k!\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|N?V|N?V haszn?lata alap?rtelmezett titkos kulcsk?nt" @@ -5015,6 +4998,11 @@ msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "" "FIGYELEM: A rejtjelezett munkafolyamat-kulcs lehet, hogy nem biztons?gos!\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kritikus al??r?s-jel?l?s: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "A %d t?pus? alcsomag kritikus bitje be?ll?tott.\n" @@ -9184,6 +9172,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "Hiba \"%s\" olvas?sakor: %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "Hiba a(z) \"%s\" kulcskarika l?trehoz?sakor: %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "Hiba \"%s\" olvas?sakor: %s\n" diff --git a/po/id.po b/po/id.po index a5f291a..c0d8069 100644 --- a/po/id.po +++ b/po/id.po @@ -851,16 +851,16 @@ msgstr "WARNING: \"%s\" adalah opsi terdepresiasi\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "gagal memperbarui: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "tidak dapat melakukan hal itu dalam mode batch\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -871,14 +871,6 @@ msgstr "tidak dapat melakukan hal itu dalam mode batch\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1900,23 +1892,6 @@ msgid "[User ID not found]" msgstr "[User id tidak ditemukan]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "opsi impor tidak valid\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "kesalahan membaca `%s': %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "kesalahan menulis keyring `%s': %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "kesalahan penciptaan : `%s': %s\n" @@ -1928,11 +1903,19 @@ msgstr "kesalahan penciptaan : `%s': %s\n" msgid "No fingerprint" msgstr "tampilkan fingerprint" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "kunci rahasia `%s' tidak ditemukan: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "opsi impor tidak valid\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NAMA|gunakan NAMA sebagai kunci rahasia baku" @@ -5011,6 +4994,11 @@ msgstr "tidak dapat menangani algoritma kunci publik %d\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "PERINGATAN: kunci sesi mungkin dienkripsi simetris secara tidak aman\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Notasi signature kritis: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "subpaket tipe %d memiliki bit kritis terset\n" @@ -9177,6 +9165,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "kesalahan membaca `%s': %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "kesalahan menulis keyring `%s': %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "kesalahan membaca `%s': %s\n" diff --git a/po/it.po b/po/it.po index 3ca0d40..49a5784 100644 --- a/po/it.po +++ b/po/it.po @@ -846,16 +846,16 @@ msgstr "ATTENZIONE: \"%s\" ? una opzione deprecata\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "aggiornamento fallito: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "impossibile fare questo in modo batch\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -866,14 +866,6 @@ msgstr "impossibile fare questo in modo batch\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1906,23 +1898,6 @@ msgid "[User ID not found]" msgstr "[User ID non trovato]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "opzioni di importazione non valide\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "errore leggendo `%s': %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "errore creando il portachiavi `%s': %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "errore creando `%s': %s\n" @@ -1934,11 +1909,19 @@ msgstr "errore creando `%s': %s\n" msgid "No fingerprint" msgstr "mostra le impronte digitali" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "chiave segreta `%s' non trovata: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "opzioni di importazione non valide\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NOME|usa NOME come chiave segreta predefinita" @@ -5031,6 +5014,11 @@ msgstr "" "ATTENZIONE: la chiave di sessione cifrata simmetricamente ? potenzialmente\n" "non sicura\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Annotazione critica della firma: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "il sottopacchetto di tipo %d ha un bit critico impostato\n" @@ -9218,6 +9206,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "errore leggendo `%s': %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "errore creando il portachiavi `%s': %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "errore leggendo `%s': %s\n" diff --git a/po/ja.po b/po/ja.po index 045c46c..881aff6 100644 --- a/po/ja.po +++ b/po/ja.po @@ -821,19 +821,21 @@ msgstr "" msgid "unknown debug flag '%s' ignored\n" msgstr "???debug???'%s'????????\n" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "gpg-agent?????????? - '%s'??????\n" - -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" +#, fuzzy, c-format +#| msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "agent???????%d?????\n" -#, c-format -msgid "connection to agent established\n" +#, fuzzy, c-format +#| msgid "connection to agent established\n" +msgid "connection to %s established\n" msgstr "??????????????????\n" #, c-format +msgid "no running gpg-agent - starting '%s'\n" +msgstr "gpg-agent?????????? - '%s'??????\n" + +#, c-format msgid "connection to agent is in restricted mode\n" msgstr "???????????????????\n" @@ -841,14 +843,6 @@ msgstr "???????????????????\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "dirmngr???????? - ?????'%s'\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "dirmngr???????%d?????\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "dirmngr???????????\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1776,22 +1770,6 @@ msgid "[User ID not found]" msgstr "[???ID????????]" #, c-format -msgid "(check argument of option '%s')\n" -msgstr "(?????'%s'??????????)\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "??: '%s'????ID??????????????????\n" - -#, c-format -msgid "error looking up: %s\n" -msgstr "??????: %s\n" - -#, c-format -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "??: %s??????%d??????\n" - -#, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "'%s'? %s ??????\n" @@ -1803,10 +1781,18 @@ msgid "No fingerprint" msgstr "???????????????" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "???\"%s\"????????: %s\n" #, c-format +msgid "(check argument of option '%s')\n" +msgstr "(?????'%s'??????????)\n" + +#, c-format msgid "Warning: not using '%s' as default key: %s\n" msgstr "??: ???????????? '%s' ??????: %s\n" @@ -4672,6 +4658,11 @@ msgstr "??????????%d?????????\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "*??*: ?????????????????????????\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "???????????: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "?%d?????????????????????\n" @@ -8673,6 +8664,21 @@ msgstr "" "??: gpg-check-pattern [?????] ????????\n" "????????????????????????????\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "dirmngr???????%d?????\n" + +#~ msgid "connection to the dirmngr established\n" +#~ msgstr "dirmngr???????????\n" + +#~ msgid "Warning: '%s' should be a long key ID or a fingerprint\n" +#~ msgstr "??: '%s'????ID??????????????????\n" + +#~ msgid "error looking up: %s\n" +#~ msgstr "??????: %s\n" + +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "??: %s??????%d??????\n" + #~ msgid "using \"http\" instead of \"https\"\n" #~ msgstr "\"http\" ? \"https\" ?????????\n" diff --git a/po/nb.po b/po/nb.po index af0e809..b6a9698 100644 --- a/po/nb.po +++ b/po/nb.po @@ -825,19 +825,21 @@ msgstr "ADVARSEL: valget ?%s%s? er utg?tt, og har ingen effekt\n" msgid "unknown debug flag '%s' ignored\n" msgstr "unknown debug flag '%s' ignored\n" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "ingen kj?rende gpg-agent. Starter ?%s?\n" - -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" +#, fuzzy, c-format +#| msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "venter p? at agent skal dukke opp ? (%ds)\n" -#, c-format -msgid "connection to agent established\n" +#, fuzzy, c-format +#| msgid "connection to agent established\n" +msgid "connection to %s established\n" msgstr "koblet til agent\n" #, c-format +msgid "no running gpg-agent - starting '%s'\n" +msgstr "ingen kj?rende gpg-agent. Starter ?%s?\n" + +#, c-format msgid "connection to agent is in restricted mode\n" msgstr "kobler til agent i begrenset modus\n" @@ -845,14 +847,6 @@ msgstr "kobler til agent i begrenset modus\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "ingen kj?rende Dirmngr. Starter ?%s?\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "venter p? at dirmngr skal dukke opp ? (%ds)\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "koblet til dirmngr\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1799,22 +1793,6 @@ msgid "[User ID not found]" msgstr "[Fant ikke bruker-ID]" #, c-format -msgid "(check argument of option '%s')\n" -msgstr "(kontroller argument for valget ?%s?)\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "Advarsel: ?%s? m? v?re en lang n?kkel-ID eller et fingeravtrykk\n" - -#, c-format -msgid "error looking up: %s\n" -msgstr "feil under oppslag av %s\n" - -#, c-format -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "Advarsel: %s st?r oppf?rt p? n?kkelknippet %d ganger\n" - -#, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "hentet ?%s? via %s automatisk\n" @@ -1826,10 +1804,18 @@ msgid "No fingerprint" msgstr "Ingen fingeravtrykk" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "fant ikke hemmelig n?kkel ?%s?: %s\n" #, c-format +msgid "(check argument of option '%s')\n" +msgstr "(kontroller argument for valget ?%s?)\n" + +#, c-format msgid "Warning: not using '%s' as default key: %s\n" msgstr "Advarsel: bruker ikke ?%s? som forvalgt n?kkel: %s\n" @@ -4743,6 +4729,11 @@ msgstr "klarte ikke ? h?ndtere offentlig n?kkelalgoritme %d\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "ADVARSEL: det er usikkert ? kryptere ?ktn?kkel symmetrisk\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kritisk signaturnotat: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "underpakke %d er merket som kritisk\n" @@ -8810,6 +8801,21 @@ msgstr "" "Syntaks: gpg-check-pattern [valg] m?nsterfil\n" "Kontroller passordfrase oppgitt p? standard innkanal mot valgt m?nsterfil\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "venter p? at dirmngr skal dukke opp ? (%ds)\n" + +#~ msgid "connection to the dirmngr established\n" +#~ msgstr "koblet til dirmngr\n" + +#~ msgid "Warning: '%s' should be a long key ID or a fingerprint\n" +#~ msgstr "Advarsel: ?%s? m? v?re en lang n?kkel-ID eller et fingeravtrykk\n" + +#~ msgid "error looking up: %s\n" +#~ msgstr "feil under oppslag av %s\n" + +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "Advarsel: %s st?r oppf?rt p? n?kkelknippet %d ganger\n" + #~ msgid "using \"http\" instead of \"https\"\n" #~ msgstr "bruker ?http? i stedet for ?https?\n" diff --git a/po/pl.po b/po/pl.po index ad35f93..52861fc 100644 --- a/po/pl.po +++ b/po/pl.po @@ -908,18 +908,19 @@ msgid "unknown debug flag '%s' ignored\n" msgstr "" #, fuzzy, c-format -#| msgid "no running gpg-agent - starting one\n" -msgid "no running gpg-agent - starting '%s'\n" -msgstr "gpg-agent nie dzia?a - uruchamianie\n" - -#, fuzzy, c-format #| msgid "waiting %d seconds for the agent to come up\n" -msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "oczekiwanie (%d s) na uruchomienie agenta\n" -#, c-format -msgid "connection to agent established\n" -msgstr "" +#, fuzzy, c-format +#| msgid "can't connect to the dirmngr - trying fall back\n" +msgid "connection to %s established\n" +msgstr "nie mo?na po??czy? si? z dirmngr - pr?ba fallbacku\n" + +#, fuzzy, c-format +#| msgid "no running gpg-agent - starting one\n" +msgid "no running gpg-agent - starting '%s'\n" +msgstr "gpg-agent nie dzia?a - uruchamianie\n" #, fuzzy, c-format #| msgid "can't connect to the dirmngr - trying fall back\n" @@ -931,16 +932,6 @@ msgstr "nie mo?na po??czy? si? z dirmngr - pr?ba fallbacku\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "dirmngr nie dzia?a - uruchamianie ,,%s''\n" -#, fuzzy, c-format -#| msgid "waiting %d seconds for the agent to come up\n" -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "oczekiwanie (%d s) na uruchomienie agenta\n" - -#, fuzzy, c-format -#| msgid "can't connect to the dirmngr - trying fall back\n" -msgid "connection to the dirmngr established\n" -msgstr "nie mo?na po??czy? si? z dirmngr - pr?ba fallbacku\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1937,25 +1928,6 @@ msgid "[User ID not found]" msgstr "[brak identyfikatora u?ytkownika]" #, fuzzy, c-format -#| msgid "missing argument for option \"%.50s\"\n" -msgid "(check argument of option '%s')\n" -msgstr "brak argumentu dla opcji ,,%.50s''\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -#| msgid "error closing %s: %s\n" -msgid "error looking up: %s\n" -msgstr "b??d zamykania %s: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "b??d tworzenia zbioru kluczy `%s': %s\n" - -#, fuzzy, c-format #| msgid "automatically retrieved `%s' via %s\n" msgid "automatically retrieved '%s' via %s\n" msgstr "automatycznie pobrano `%s' poprzez %s\n" @@ -1969,10 +1941,19 @@ msgid "No fingerprint" msgstr "Brak odcisku" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "klucz prywatny ,,%s'' nie zosta? odnaleziony: %s\n" #, fuzzy, c-format +#| msgid "missing argument for option \"%.50s\"\n" +msgid "(check argument of option '%s')\n" +msgstr "brak argumentu dla opcji ,,%.50s''\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NAZWA|u?ycie NAZWY jako domy?lnego klucza tajnego" @@ -5120,6 +5101,11 @@ msgstr "" "OSTRZE?ENIE: symetrycznie zaszyfrowany klucz sesyjny mo?e nie by? " "bezpieczny\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Krytyczne adnotacje podpisu: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "podpakiet typu %d ma ustawiony krytyczny bit\n" @@ -9601,6 +9587,21 @@ msgstr "" "Sprawdzanie has?a ze standardowego wej?cia wzgl?dem pliku wzorc?w\n" #, fuzzy +#~| msgid "waiting %d seconds for the agent to come up\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "oczekiwanie (%d s) na uruchomienie agenta\n" + +#, fuzzy +#~| msgid "error closing %s: %s\n" +#~ msgid "error looking up: %s\n" +#~ msgstr "b??d zamykania %s: %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "b??d tworzenia zbioru kluczy `%s': %s\n" + +#, fuzzy #~| msgid "error running `%s': exit status %d\n" #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "b??d uruchamiania ,,%s'': kod wyj?cia %d\n" diff --git a/po/pt.po b/po/pt.po index 3a8d2c7..2e2e035 100644 --- a/po/pt.po +++ b/po/pt.po @@ -851,16 +851,16 @@ msgstr "AVISO: \"%s\" ? uma op??o depreciada\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "actualiza??o falhou: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "imposs?vel fazer isso em modo n?o-interativo\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -871,14 +871,6 @@ msgstr "imposs?vel fazer isso em modo n?o-interativo\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1896,23 +1888,6 @@ msgid "[User ID not found]" msgstr "[Utilizador n?o encontrado]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "op??es de importa??o inv?lidas\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "erro na leitura de `%s': %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "erro ao criar porta-chaves `%s': %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "erro ao criar `%s': %s\n" @@ -1924,11 +1899,19 @@ msgstr "erro ao criar `%s': %s\n" msgid "No fingerprint" msgstr "mostra impress?o digital" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "chave `%s' n?o encontrada: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "op??es de importa??o inv?lidas\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NOME|usar NOME como chave secreta por omiss?o" @@ -5018,6 +5001,11 @@ msgstr "imposs?vel manipular algoritmo de chave p?blica %d\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Nota??o de assinatura cr?tica: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "subpacote do tipo %d tem bit cr?tico ligado\n" @@ -9179,6 +9167,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "erro na leitura de `%s': %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "erro ao criar porta-chaves `%s': %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "erro na leitura de `%s': %s\n" diff --git a/po/ro.po b/po/ro.po index 45c6c6b..f9510ba 100644 --- a/po/ro.po +++ b/po/ro.po @@ -867,16 +867,17 @@ msgstr "AVERTISMENT: \"%s\" este o op?iune ?nvechit?\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "actualizarea a e?uat: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +#| msgid "can't do this in batch mode\n" +msgid "connection to %s established\n" +msgstr "nu pot face acest lucru ?n modul batch\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -888,14 +889,6 @@ msgstr "nu pot face acest lucru ?n modul batch\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1913,23 +1906,6 @@ msgid "[User ID not found]" msgstr "[ID utilizator nu a fost g?sit]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "op?iuni enumerare invalide\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "eroare ?n `%s': %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "eroare la crearea inelului de chei `%s': %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "eroare la creearea `%s': %s\n" @@ -1942,10 +1918,18 @@ msgid "No fingerprint" msgstr "Amprenta CA: " #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "cheia secret? \"%s\" nu a fost g?sit?: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "op?iuni enumerare invalide\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NUME|folose?te NUME ca cheie secret? implicit?" @@ -5059,6 +5043,11 @@ msgstr "" "AVERTISMENT: cheie de sesiune cifrat? simetric poten?ial nesigur? " "(insecure)\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Notare semn?tur? critic?: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "subpachetul de tip %d are bitul critic setat\n" @@ -9294,6 +9283,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "eroare ?n `%s': %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "eroare la crearea inelului de chei `%s': %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "eroare la citire `%s': %s\n" diff --git a/po/sk.po b/po/sk.po index 8a1149b..36c4e67 100644 --- a/po/sk.po +++ b/po/sk.po @@ -851,16 +851,16 @@ msgstr "VAROV?N?: pou?itie parametra \"%s\" sa neodpor??a\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "aktualiz?cia zlyhala: %s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +msgid "connection to %s established\n" +msgstr "nemo?no previes? v d?vkovom m?de\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -871,14 +871,6 @@ msgstr "nemo?no previes? v d?vkovom m?de\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1902,23 +1894,6 @@ msgid "[User ID not found]" msgstr "[User id not found]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "neplatn? parameter pre import\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "chyba pri ??tan? `%s': %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "chyba pri vytv?ran? s?boru k???ov (keyring)`%s': %s\n" - -#, fuzzy, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "chyba pri vytv?ran? `%s': %s\n" @@ -1930,11 +1905,19 @@ msgstr "chyba pri vytv?ran? `%s': %s\n" msgid "No fingerprint" msgstr "vyp?sa? fingerprint" +#, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + #, fuzzy, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "tajn? k??? `%s' nebol n?jden?: %s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "neplatn? parameter pre import\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|MENO|pou?i MENO ako implicitn? tajn? k???" @@ -5031,6 +5014,11 @@ msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "" "VAROVANIE: pravdepodobne nebezpe?n? symetricky ?ifrovan? k??? sedenia\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kritick? podpisov? not?cia: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "podpaket typu %d m? nastaven? kritick? bit\n" @@ -9208,6 +9196,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "chyba pri ??tan? `%s': %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "chyba pri vytv?ran? s?boru k???ov (keyring)`%s': %s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "chyba pri ??tan? `%s': %s\n" diff --git a/po/sv.po b/po/sv.po index a84bcea..5091570 100644 --- a/po/sv.po +++ b/po/sv.po @@ -943,18 +943,19 @@ msgid "unknown debug flag '%s' ignored\n" msgstr "" #, fuzzy, c-format -#| msgid "no running gpg-agent - starting one\n" -msgid "no running gpg-agent - starting '%s'\n" -msgstr "ingen k?rande gpg-agent - startar en\n" - -#, fuzzy, c-format #| msgid "waiting %d seconds for the agent to come up\n" -msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "v?ntar %d sekunder f?r att agenten ska komma ig?ng\n" -#, c-format -msgid "connection to agent established\n" -msgstr "" +#, fuzzy, c-format +#| msgid "can't connect to the dirmngr - trying fall back\n" +msgid "connection to %s established\n" +msgstr "kan inte ansluta till dirmngr - f?rs?ker falla tillbaka\n" + +#, fuzzy, c-format +#| msgid "no running gpg-agent - starting one\n" +msgid "no running gpg-agent - starting '%s'\n" +msgstr "ingen k?rande gpg-agent - startar en\n" #, fuzzy, c-format #| msgid "can't connect to the dirmngr - trying fall back\n" @@ -966,16 +967,6 @@ msgstr "kan inte ansluta till dirmngr - f?rs?ker falla tillbaka\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "ingen k?rande dirmngr - startar \"%s\"\n" -#, fuzzy, c-format -#| msgid "waiting %d seconds for the agent to come up\n" -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "v?ntar %d sekunder f?r att agenten ska komma ig?ng\n" - -#, fuzzy, c-format -#| msgid "can't connect to the dirmngr - trying fall back\n" -msgid "connection to the dirmngr established\n" -msgstr "kan inte ansluta till dirmngr - f?rs?ker falla tillbaka\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1991,25 +1982,6 @@ msgid "[User ID not found]" msgstr "[Anv?ndaridentiteten hittades inte]" #, fuzzy, c-format -#| msgid "missing argument for option \"%.50s\"\n" -msgid "(check argument of option '%s')\n" -msgstr "argument f?r flaggan \"%.50s\" saknas\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -#| msgid "error closing %s: %s\n" -msgid "error looking up: %s\n" -msgstr "fel vid st?ngning av %s: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "fel n?r nyckelringen \"%s\" skapades: %s\n" - -#, fuzzy, c-format #| msgid "automatically retrieved `%s' via %s\n" msgid "automatically retrieved '%s' via %s\n" msgstr "h?mtade \"%s\" automatiskt via %s\n" @@ -2023,10 +1995,19 @@ msgid "No fingerprint" msgstr "Inget fingeravtryck" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "hemliga nyckeln \"%s\" hittades inte: %s\n" #, fuzzy, c-format +#| msgid "missing argument for option \"%.50s\"\n" +msgid "(check argument of option '%s')\n" +msgstr "argument f?r flaggan \"%.50s\" saknas\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|NAMN|anv?nd NAMN som f?rvald hemlig nyckel" @@ -5182,6 +5163,11 @@ msgstr "kan inte hantera algoritmen %d f?r publika nycklar\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "VARNING: potentiellt os?ker symmetriskt krypterad sessionsnyckel\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kritisk signaturnotation: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "underpaket av typen %d har den bit satt som markerar den som kritisk\n" @@ -9678,6 +9664,21 @@ msgstr "" "Kontrollera en l?senfras angiven p? standard in mot m?nsterfilen\n" #, fuzzy +#~| msgid "waiting %d seconds for the agent to come up\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "v?ntar %d sekunder f?r att agenten ska komma ig?ng\n" + +#, fuzzy +#~| msgid "error closing %s: %s\n" +#~ msgid "error looking up: %s\n" +#~ msgstr "fel vid st?ngning av %s: %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "fel n?r nyckelringen \"%s\" skapades: %s\n" + +#, fuzzy #~| msgid "error running `%s': exit status %d\n" #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "fel vid k?rning av \"%s\": avslutsstatus %d\n" diff --git a/po/tr.po b/po/tr.po index 7484c24..6451e4e 100644 --- a/po/tr.po +++ b/po/tr.po @@ -907,18 +907,20 @@ msgid "unknown debug flag '%s' ignored\n" msgstr "" #, fuzzy, c-format +#| msgid "waiting for process %d to terminate failed: %s\n" +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "s?re? %d sonlanacak diye beklerken ba?ar?s?zl?k: %s\n" + +#, fuzzy, c-format +#| msgid "can't connect to the dirmngr - trying fall back\n" +msgid "connection to %s established\n" +msgstr "dirmngr'a ba?lan?lam?yor - son ?areye ba?vuruluyor\n" + +#, fuzzy, c-format #| msgid "no running gpg-agent - starting one\n" msgid "no running gpg-agent - starting '%s'\n" msgstr "?al??an gpg-agent yok - bir tane ba?lat?l?yor\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to agent established\n" -msgstr "" - #, fuzzy, c-format #| msgid "can't connect to the dirmngr - trying fall back\n" msgid "connection to agent is in restricted mode\n" @@ -929,15 +931,6 @@ msgstr "dirmngr'a ba?lan?lam?yor - son ?areye ba?vuruluyor\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "?al??an dirmngr yok - `%s' ba?lat?l?yor\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, fuzzy, c-format -#| msgid "can't connect to the dirmngr - trying fall back\n" -msgid "connection to the dirmngr established\n" -msgstr "dirmngr'a ba?lan?lam?yor - son ?areye ba?vuruluyor\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1933,25 +1926,6 @@ msgid "[User ID not found]" msgstr "[Kullan?c? kimli?i yok]" #, fuzzy, c-format -#| msgid "missing argument for option \"%.50s\"\n" -msgid "(check argument of option '%s')\n" -msgstr "\"%.50s\" se?ene?i i?in de?i?tirge eksik\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -#| msgid "error closing %s: %s\n" -msgid "error looking up: %s\n" -msgstr "%s kapan?rken hata: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "`%s' anahtarl??? olu?turulurken hata: %s\n" - -#, fuzzy, c-format #| msgid "automatically retrieved `%s' via %s\n" msgid "automatically retrieved '%s' via %s\n" msgstr "`%s' %s ?zerinden ?zdevinimli olarak al?nd?\n" @@ -1965,10 +1939,19 @@ msgid "No fingerprint" msgstr "Parmak izi yok" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "gizli anahtar \"%s\" yok: %s\n" #, fuzzy, c-format +#| msgid "missing argument for option \"%.50s\"\n" +msgid "(check argument of option '%s')\n" +msgstr "\"%.50s\" se?ene?i i?in de?i?tirge eksik\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|?S?M|?ntan?ml? gizli anahtar olarak ?S?M kullan?l?r" @@ -5119,6 +5102,11 @@ msgstr "%d genel anahtar algoritmas? kullan?lamad?\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "UYARI: simetrik ?ifreli oturum anahtar? potansiyel olarak g?vensiz\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "Kritik imza simgelemi: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "%d tipi alt paket kritik bit k?mesine sahip\n" @@ -9577,6 +9565,16 @@ msgstr "" "kar??la?t?r?r\n" #, fuzzy +#~| msgid "error closing %s: %s\n" +#~ msgid "error looking up: %s\n" +#~ msgstr "%s kapan?rken hata: %s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "`%s' anahtarl??? olu?turulurken hata: %s\n" + +#, fuzzy #~| msgid "error running `%s': exit status %d\n" #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "`%s' ?al???rken hata: ??k?? durumu: %d\n" diff --git a/po/uk.po b/po/uk.po index bb1301c..fae0cd8 100644 --- a/po/uk.po +++ b/po/uk.po @@ -834,19 +834,21 @@ msgstr "?????: ?%s%s? ? ?????????? ?????????? ? ? msgid "unknown debug flag '%s' ignored\n" msgstr "????????? ????????? ??????????? ?%s? ?????????????\n" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "?? ???????? gpg-agent ? ?????????? ?%s?\n" - -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" +#, fuzzy, c-format +#| msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "?????????? ?? ?????????????? ??????? (%d ?)\n" -#, c-format -msgid "connection to agent established\n" +#, fuzzy, c-format +#| msgid "connection to agent established\n" +msgid "connection to %s established\n" msgstr "??????????? ????????? ? ???????\n" #, c-format +msgid "no running gpg-agent - starting '%s'\n" +msgstr "?? ???????? gpg-agent ? ?????????? ?%s?\n" + +#, c-format msgid "connection to agent is in restricted mode\n" msgstr "????????? ? ??????? ???????????? ? ?????????? ??????\n" @@ -854,14 +856,6 @@ msgstr "????????? ? ??????? ???????????? ? ??? msgid "no running Dirmngr - starting '%s'\n" msgstr "Dirmngr ?? ???????? ? ?????????? ?%s?\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "?????????? ?? ?????????????? dirmngr? (%d ?)\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "??????????? ????????? ? dirmngr\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1824,23 +1818,6 @@ msgid "[User ID not found]" msgstr "[????????????? ?? ????????]" #, c-format -msgid "(check argument of option '%s')\n" -msgstr "(????????? ???????? ????????? ?%s?)\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" -"????????????: ?%s? ??? ???? ?????? ??????????????? ????? ??? ?????????\n" - -#, c-format -msgid "error looking up: %s\n" -msgstr "??????? ??? ??? ??????: %s\n" - -#, c-format -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "????????????: ????? %s ??????? ? ??????? %d ?????\n" - -#, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "??????????? ???????? ?%s? ?? ????????? %s\n" @@ -1852,10 +1829,18 @@ msgid "No fingerprint" msgstr "??? ????????" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "???????? ???? ?%s? ?? ????????: %s\n" #, c-format +msgid "(check argument of option '%s')\n" +msgstr "(????????? ???????? ????????? ?%s?)\n" + +#, c-format msgid "Warning: not using '%s' as default key: %s\n" msgstr "????????????: ?%s? ?? ???????????????? ?? ??????? ????: %s\n" @@ -4863,6 +4848,11 @@ msgstr "" "?????: ?????????? ??????????? ???????????? ??????????? ?????????? ???? " "??????\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "???????? ???????? ???????: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "???????? ???? %d ??????? ????????? ????? ?????\n" @@ -9058,6 +9048,22 @@ msgstr "" "?????????: gpg-check-pattern [?????????] ????_????????\n" "?????????? ??????, ???????? ? stdin, ?? ????????? ?????_????????\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "?????????? ?? ?????????????? dirmngr? (%d ?)\n" + +#~ msgid "connection to the dirmngr established\n" +#~ msgstr "??????????? ????????? ? dirmngr\n" + +#~ msgid "Warning: '%s' should be a long key ID or a fingerprint\n" +#~ msgstr "" +#~ "????????????: ?%s? ??? ???? ?????? ??????????????? ????? ??? ?????????\n" + +#~ msgid "error looking up: %s\n" +#~ msgstr "??????? ??? ??? ??????: %s\n" + +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "????????????: ????? %s ??????? ? ??????? %d ?????\n" + #~ msgid "using \"http\" instead of \"https\"\n" #~ msgstr "?????????????? ?http? ??????? ?https?\n" diff --git a/po/zh_CN.po b/po/zh_CN.po index 1c35509..9ee42bb 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -862,16 +862,17 @@ msgstr "????%s?????????\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "" +#, fuzzy, c-format +msgid "waiting for the %s to come up ... (%ds)\n" +msgstr "?????%s\n" -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" -msgstr "" +#, fuzzy, c-format +#| msgid "can't do this in batch mode\n" +msgid "connection to %s established\n" +msgstr "??????????????\n" #, c-format -msgid "connection to agent established\n" +msgid "no running gpg-agent - starting '%s'\n" msgstr "" #, fuzzy, c-format @@ -883,14 +884,6 @@ msgstr "??????????????\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1882,23 +1875,6 @@ msgid "[User ID not found]" msgstr "[???????]" #, fuzzy, c-format -msgid "(check argument of option '%s')\n" -msgstr "???????\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -msgid "error looking up: %s\n" -msgstr "?%s?????%s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring `%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "??????%s???????%s\n" - -#, fuzzy, c-format #| msgid "automatically retrieved `%s' via %s\n" msgid "automatically retrieved '%s' via %s\n" msgstr "?????%s???? %s\n" @@ -1912,10 +1888,18 @@ msgid "No fingerprint" msgstr "CA ???" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "??????%s??%s\n" #, fuzzy, c-format +msgid "(check argument of option '%s')\n" +msgstr "???????\n" + +#, fuzzy, c-format #| msgid "unusable secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "??????" @@ -4949,6 +4933,11 @@ msgstr "???????? %d\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "?????????????????\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "???????" + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "%d ???????????\n" @@ -9119,6 +9108,15 @@ msgid "" msgstr "" #, fuzzy +#~ msgid "error looking up: %s\n" +#~ msgstr "?%s?????%s\n" + +#, fuzzy +#~| msgid "error creating keyring `%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "??????%s???????%s\n" + +#, fuzzy #~ msgid "error retrieving '%s': http status %u\n" #~ msgstr "???%s?????%s\n" diff --git a/po/zh_TW.po b/po/zh_TW.po index b1cfa59..908aa6e 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -828,18 +828,20 @@ msgstr "??: \"%s%s\" ??????? - ????\n" msgid "unknown debug flag '%s' ignored\n" msgstr "" -#, c-format -msgid "no running gpg-agent - starting '%s'\n" -msgstr "?????? gpg-agent - ???? '%s'\n" - -#, c-format -msgid "waiting for the agent to come up ... (%ds)\n" +#, fuzzy, c-format +#| msgid "waiting for the agent to come up ... (%ds)\n" +msgid "waiting for the %s to come up ... (%ds)\n" msgstr "?????????? ... (%d ?)\n" -#, c-format -msgid "connection to agent established\n" +#, fuzzy, c-format +#| msgid "connection to agent established\n" +msgid "connection to %s established\n" msgstr "???????????\n" +#, c-format +msgid "no running gpg-agent - starting '%s'\n" +msgstr "?????? gpg-agent - ???? '%s'\n" + #, fuzzy, c-format #| msgid "connection to agent established\n" msgid "connection to agent is in restricted mode\n" @@ -849,14 +851,6 @@ msgstr "???????????\n" msgid "no running Dirmngr - starting '%s'\n" msgstr "?????? Dirmngr - ???? '%s'\n" -#, c-format -msgid "waiting for the dirmngr to come up ... (%ds)\n" -msgstr "???? dirmngr ?? ... (%d ?)\n" - -#, c-format -msgid "connection to the dirmngr established\n" -msgstr "??? dirmngr ???\n" - #. TRANSLATORS: Copy the prefix between the vertical bars #. verbatim. It will not be printed. msgid "|audit-log-result|Good" @@ -1805,25 +1799,6 @@ msgstr "?? '%s' ???: %s\n" msgid "[User ID not found]" msgstr "[?????? ID]" -#, fuzzy, c-format -#| msgid "missing argument for option \"%.50s\"\n" -msgid "(check argument of option '%s')\n" -msgstr "\"%.50s\" ???????\n" - -#, c-format -msgid "Warning: '%s' should be a long key ID or a fingerprint\n" -msgstr "" - -#, fuzzy, c-format -#| msgid "error closing %s: %s\n" -msgid "error looking up: %s\n" -msgstr "?? %s ???: %s\n" - -#, fuzzy, c-format -#| msgid "error creating keyring '%s': %s\n" -msgid "Warning: %s appears in the keyring %d times\n" -msgstr "????? '%s' ???: %s\n" - #, c-format msgid "automatically retrieved '%s' via %s\n" msgstr "????? '%s' (?? %s )\n" @@ -1836,10 +1811,19 @@ msgid "No fingerprint" msgstr "????" #, c-format +msgid "checking for a fresh copy of an expired key via %s\n" +msgstr "" + +#, c-format msgid "secret key \"%s\" not found: %s\n" msgstr "????? \"%s\": %s\n" #, fuzzy, c-format +#| msgid "missing argument for option \"%.50s\"\n" +msgid "(check argument of option '%s')\n" +msgstr "\"%.50s\" ???????\n" + +#, fuzzy, c-format #| msgid "|NAME|use NAME as default secret key" msgid "Warning: not using '%s' as default key: %s\n" msgstr "|??|????????????" @@ -4773,6 +4757,11 @@ msgstr "???? %d ???????\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "??: ????????????????\n" +#, fuzzy, c-format +#| msgid "Critical signature notation: " +msgid "Unknown critical signature notation: " +msgstr "??????: " + #, c-format msgid "subpacket of type %d has critical bit set\n" msgstr "%d ?????????????\n" @@ -8832,6 +8821,22 @@ msgstr "" "??: gpg-check-pattern [??] ????\n" "??????????????????\n" +#~ msgid "waiting for the dirmngr to come up ... (%ds)\n" +#~ msgstr "???? dirmngr ?? ... (%d ?)\n" + +#~ msgid "connection to the dirmngr established\n" +#~ msgstr "??? dirmngr ???\n" + +#, fuzzy +#~| msgid "error closing %s: %s\n" +#~ msgid "error looking up: %s\n" +#~ msgstr "?? %s ???: %s\n" + +#, fuzzy +#~| msgid "error creating keyring '%s': %s\n" +#~ msgid "Warning: %s appears in the keyring %d times\n" +#~ msgstr "????? '%s' ???: %s\n" + #~ msgid "using \"http\" instead of \"https\"\n" #~ msgstr "??? \"http\" ?? \"https\"\n" commit 24697074f44c18eeeedbc1e09d35f56504c57a1f Author: Werner Koch Date: Thu Aug 30 14:25:14 2018 +0200 Release 2.2.10 diff --git a/NEWS b/NEWS index c49e00b..f446e43 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,21 @@ -Noteworthy changes in version 2.2.10 (unreleased) +Noteworthy changes in version 2.2.10 (2018-08-30) ------------------------------------------------- + gpg: Refresh expired keys originating from the WKD. [#2917] + + gpg: Use a 256 KiB limit for a WKD imported key. + + gpg: New option --known-notation. [#4060] + + scd: Add support for the Trustica Cryptoucan reader. + + agent: Speed up starting during on-demand launching. [#3490] + + dirmngr: Validate SRV records in WKD queries. + + Release-info: https://dev.gnupg.org/T4112 + See-also: gnupg-announce/2018q3/000428.html + Noteworthy changes in version 2.2.9 (2018-07-12) ------------------------------------------------ @@ -41,7 +56,6 @@ Noteworthy changes in version 2.2.9 (2018-07-12) * gpg: New "usage" property for the drop-subkey filters. [#4019] Release-info: https://dev.gnupg.org/T4036 - See-also: gnupg-announce/2018q3/000427.html ----------------------------------------------------------------------- Summary of changes: NEWS | 22 +++++++++++++++-- configure.ac | 2 +- po/ca.po | 63 ++++++++++++++++++++++++------------------------ po/cs.po | 70 ++++++++++++++++++++++++++++------------------------- po/da.po | 77 ++++++++++++++++++++++++++++++----------------------------- po/de.po | 3 ++- po/el.po | 61 ++++++++++++++++++++++------------------------- po/eo.po | 60 ++++++++++++++++++++++------------------------ po/es.po | 78 ++++++++++++++++++++++++++++++++---------------------------- po/et.po | 61 ++++++++++++++++++++++------------------------- po/fi.po | 61 ++++++++++++++++++++++------------------------- po/fr.po | 75 ++++++++++++++++++++++++++++++--------------------------- po/gl.po | 61 ++++++++++++++++++++++------------------------- po/hu.po | 61 ++++++++++++++++++++++------------------------- po/id.po | 61 ++++++++++++++++++++++------------------------- po/it.po | 61 ++++++++++++++++++++++------------------------- po/ja.po | 70 ++++++++++++++++++++++++++++------------------------- po/nb.po | 70 ++++++++++++++++++++++++++++------------------------- po/pl.po | 77 ++++++++++++++++++++++++++++++----------------------------- po/pt.po | 61 ++++++++++++++++++++++------------------------- po/ro.po | 62 +++++++++++++++++++++++------------------------ po/sk.po | 61 ++++++++++++++++++++++------------------------- po/sv.po | 77 ++++++++++++++++++++++++++++++----------------------------- po/tr.po | 70 ++++++++++++++++++++++++++--------------------------- po/uk.po | 72 ++++++++++++++++++++++++++++++------------------------- po/zh_CN.po | 62 +++++++++++++++++++++++------------------------ po/zh_TW.po | 75 ++++++++++++++++++++++++++++++--------------------------- 27 files changed, 829 insertions(+), 805 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 15:49:19 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 30 Aug 2018 15:49:19 +0200 Subject: [git] gnupg-doc - branch, master, updated. bcbb2828021607437e551b285ac3598cb72d8dc1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via bcbb2828021607437e551b285ac3598cb72d8dc1 (commit) from 69cdc11cda9b788c112a72269ceee5aa3d5149ae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bcbb2828021607437e551b285ac3598cb72d8dc1 Author: Werner Koch Date: Thu Aug 30 15:40:20 2018 +0200 swdb: gnupg-2.2.10 diff --git a/web/swdb.mac b/web/swdb.mac index a6d755c..4ce1f99 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -10,17 +10,17 @@ # # GnuPG-2.2 # -#+macro: gnupg22_ver 2.2.9 -#+macro: gnupg22_date 2018-07-12 +#+macro: gnupg22_ver 2.2.10 +#+macro: gnupg22_date 2018-08-30 #+macro: gnupg22_size 6503k -#+macro: gnupg22_sha1 e6ef18c2e06175bbe563959c9acc682c02bcd572 -#+macro: gnupg22_sha2 6278eaabffa1ebc9fa2ceb3dc53eea9a1505ab02a668a86dd6fec06951af2164 +#+macro: gnupg22_sha1 3e87504e2ca317718aa9b6299947ebf7e906b54e +#+macro: gnupg22_sha2 799dd37a86a1448732e339bd20440f4f5ee6e69755f6fd7a73ee8af30840c915 #+macro: gnupg22_branch STABLE-BRANCH-2-2 -#+macro: gnupg22_w32_ver 2.2.9_20180712 -#+macro: gnupg22_w32_date 2018-07-12 -#+macro: gnupg22_w32_size 3922k -#+macro: gnupg22_w32_sha1 a0c234781d85d5ef530636622f3d6d80a8d46b5e -#+macro: gnupg22_w32_sha2 1b8b9fad41c1beb92549ff8ee33530ae589514b1f0addbbdba95554fe6d5ccb3 +#+macro: gnupg22_w32_ver 2.2.10_20180830 +#+macro: gnupg22_w32_date 2018-08-30 +#+macro: gnupg22_w32_size 3919k +#+macro: gnupg22_w32_sha1 682002bce9e45309179a09348df3b92a82bdc501 +#+macro: gnupg22_w32_sha2 e84bad2436e3a0309d59e0ed313b346a1fc4ac556b5fd68bcea2d0e58d0516a2 # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Thu Aug 30 16:18:14 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Thu, 30 Aug 2018 16:18:14 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-264-g87bbe72 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 87bbe728fa68b0c1a62ead3e48650f8f33883b3f (commit) from 5d6039f6bf9bbbfec572055dcf5ca660041461af (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 87bbe728fa68b0c1a62ead3e48650f8f33883b3f Author: Maximilian Krambach Date: Thu Aug 30 16:16:13 2018 +0200 js: tests for file name encoding -- * BrowsertestExtension/tests/decryptTest.js: There were cases in which file names returned in a wrong encoding from decryption. The test cases here are a 'Hello World' in a text file with different names, then being encrypted with cli gnupg. diff --git a/lang/js/BrowserTestExtension/tests/decryptTest.js b/lang/js/BrowserTestExtension/tests/decryptTest.js index 606d96e..61a3fab 100644 --- a/lang/js/BrowserTestExtension/tests/decryptTest.js +++ b/lang/js/BrowserTestExtension/tests/decryptTest.js @@ -22,7 +22,7 @@ */ /* global describe, it, before, expect, Gpgmejs */ -/* global bigString, inputvalues, sabotageMsg, binaryData */ +/* global bigString, inputvalues, sabotageMsg, binaryData, filename_files */ describe('Decryption', function () { let context = null; @@ -98,4 +98,17 @@ describe('Decryption', function () { }); }); + for (let i=0; i < filename_files.length; i++) { + it ( + 'decrypted file_names keep correct encoding (' + i + ')', + function (done){ + context.decrypt({ data:filename_files[i].data }) + .then(function (answer){ + expect(answer.file_name).to.equal( + filename_files[i].name); + done(); + }); + }); + } + }); \ No newline at end of file diff --git a/lang/js/BrowserTestExtension/tests/inputvalues.js b/lang/js/BrowserTestExtension/tests/inputvalues.js index 6b66621..730e48a 100644 --- a/lang/js/BrowserTestExtension/tests/inputvalues.js +++ b/lang/js/BrowserTestExtension/tests/inputvalues.js @@ -405,4 +405,49 @@ const binaryData = { 'I+jv5nMv16jaJq6IpsI5ujxl/tKbniWC0Jjw5LqoT3beWaZ91iU=\n' + '=AkaP\n' + '-----END PGP MESSAGE-----\n' -}; \ No newline at end of file +}; + +// eslint-disable-next-line no-unused-vars +const filename_files = [{ + name: 'Example-1234.txt', + data: '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'hQEMA6B8jfIUScGEAQf/Ylt9GDcv/PGjX8v8CBWIeetzD7DpB8c5dZu57rPOhF7a\n' + + 'gZ5wUCNwuZ5jSnPh/MAH1amr9AEHhW28JlHq+Lpoohl50iNFQy01M+Kxh1LmSKup\n' + + 'hFQl3Lu+NewdShq/RwNc9+qdTAnCdwjGJ+SxODfo73cflLl9SSPJ7k29bdUUL1mp\n' + + 'aGlYdecTB6lcz4pCNOyyGryDBJQcS5ObulpN4zvhSfFzT27GQFmQPElm7CTdGOf0\n' + + '5VUxFe0TqRmdJ9LzVuOVZB7x8E0BpuQYpPd88emS+KOozx4KWu0IakdQ4QBY0av5\n' + + 'ZID2rgM640Z4T8kXgGZq2qFN1Ap5X3iwfjkEHaJIP9JXAb86F8IP7nLrxzN2V0eM\n' + + '3v0+1o0HJd/E4LPeXHXCaNDaJOr8rviOCLwoFvCJ9E10ZASLyqOXzhlW9Tkvxrjl\n' + + 'ldeXQI8Fp6oWPfvW8qGQ917mzxuoQYGn\n' + + '=993W\n' + + '-----END PGP MESSAGE-----\n' +}, { + name: 'Example-@??2???.txt', + data: '-----BEGIN PGP MESSAGE-----\n'+ + '\n'+ + 'hQEMA6B8jfIUScGEAQgAiX5vBNJGPYvljleo/7nkee4mGsFL1ROXLOs7sUlBImFm\n'+ + 'axQ0PAtVsX9NvDY70Tj5EIaGmgQWr/WAnH5fuV+ctsZtPm/UsL2BhYgKz3cDcS2P\n'+ + '1tni3WhHXVr8ldC3PePuEn0Wfy/wOS+y2FbkJOD9EqXeui06phB8ScGdF6se3AcA\n'+ + 'lNo6bFeURgK6NhIYgibKbybAr1+D/zUvksn5xnLztBarVeJFOwAj8I+lthLpoyj2\n'+ + 'vUFu2qOlSOW/98Z0ZYDvRqnB5Mqmqsgf0cWl4Lwt0+GrdfzuB+479+ouIJCFUaIA\n'+ + 'JDoU8Ct0UwgAoYZmDkxBtjZALmf3dGqH1gjSe0UbDdJhAZ9h5rlC525JNOse0v21\n'+ + 'LdrDtwtiETFZ9ras8RelYeyYyE7PfhBxtmP5EBZUk7Be6JbD2vn5s2pgsbmBTzGJ\n'+ + 'AcxxSN6MbTvInIvC3GhSTs0mLiC4sToVoPp/F8tfQIGZWg==\n'+ + '=V6wP\n'+ + '-----END PGP MESSAGE-----\n' +}, { + name: 'Example- ????.txt', + data: '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'hQEMA6B8jfIUScGEAQf9H7CbkI952WbUqkuYIlgKri+Tr+G+9m1GN/mKh82GnwfZ\n' + + '8JekOOzdZ6BdCfyJohOSan959r1pOHJzj2sh+LitBbD02MDPg8BL14lUXfbUju7s\n' + + 'eT5HuVDfnFWV2ThfEyVUNmAEaE57FwTzdO7vN1VYkkBNFC8pjCONQ6/iRWnDgUyB\n' + + 'fJJSLkdFMDBgHSrEeSCyDP4P5rJyd/1JhqXXECLIMzIKWCUbvWNvKLfA71fhPbi3\n' + + 'XzXLWhNKQWoMZsl2oEHJuPY7ez/KePJ07Km0gxcbBJhUGTRRNrHSjOxiaV7/TLp2\n' + + 'O3U/GuPQ/eY4Xl3rE/cDaCjy2sdR4VyuxlbLeUVIvtJbAUzNkaibs9ydZshBj9UD\n' + + 'x2JWCwkBa7Q1Mah9nciT8S2Co71dsVMdIc3VtsXUtlhomL1bHd8ipRhFSiqiyZM3\n' + + 'Pih6tFUOcXuSaf0lv6FENXP+IThHiaujtjAbkA==\n' + + '=UxvV\n' + + '-----END PGP MESSAGE-----\n' +}]; ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/tests/decryptTest.js | 15 +++++++- lang/js/BrowserTestExtension/tests/inputvalues.js | 47 ++++++++++++++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 09:08:45 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 31 Aug 2018 09:08:45 +0200 Subject: [git] GPG-ERROR - branch, gniibe/pkg-config-support, updated. libgpg-error-1.32-17-gfb1d0cd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, gniibe/pkg-config-support has been updated via fb1d0cd7105e0603482257e05c559c035b210c9c (commit) from e0aecec6d0402bb305aa768656b080c995f781cc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fb1d0cd7105e0603482257e05c559c035b210c9c Author: NIIBE Yutaka Date: Fri Aug 31 16:07:12 2018 +0900 Support module dependency. diff --git a/src/gpg-error-config.in b/src/gpg-error-config.in index d5e2f3b..49451e7 100644 --- a/src/gpg-error-config.in +++ b/src/gpg-error-config.in @@ -92,30 +92,48 @@ substitute_vars () { # For KEY: VALUE, value is stored in the shell variable ATTR_*. # read_config_from_stdin () { + local filename=$1 local line local varname local value local key + local reading_attrs while read line; do - case "$line" in - *=*) - varname="${line%%=*}" - value="${line#*=}" - VAR_list="$VAR_list VAR_$varname" - read VAR_$varname <&2 + exit 1 + ;; + esac + fi done } @@ -145,7 +163,7 @@ read_config_file () { echo "Can't find $1.pc" 1>&2 exit 1 fi - read_config_from_stdin < $config_file + read_config_from_stdin $config_file < $config_file } cleanup_vars_attrs () { @@ -219,32 +237,161 @@ list_only_once_for_libs () { echo $result } +arg1_is_same () { + [ "$1" = "=" -o "$1" = ">=" -o "$1" = "<=" ] +} + +arg1_is_less () { + [ "$1" = "!=" -o "$1" = "<" -o "$1" = "<=" ] +} + +arg1_is_great () { + [ "$1" = "!=" -o "$1" = ">" -o "$1" = ">=" ] +} + +# +# Evaluate comparison between versions in RPM way +# +eval_compare_version () { + local str1="$1" + local cmp="$2" + local str2="$3" + local char1 char2 + local chunk1 chunk2 + + while [ -n "$str1" -a -n "$str2" ]; do + # Trim anything that's not alnum or tilde from the front + str1="$(expr "$str1" : '[^0-9A-Za-z~]*\(.*\)')" + str2="$(expr "$str2" : '[^0-9A-Za-z~]*\(.*\)')" + + # Get the first character + char1=${str1%${str1#?}} + char2=${str2%${str2#?}} + + if [ "$char1" = ~ -o "$char2" = ~ ]; then + if [ "$char1" != ~ ]; then + arg1_is_great $cmp + return + fi + if [ "$char2" != ~ ]; then + arg1_is_less $cmp + return + fi + str1=${str1#~} + str2=${str2#~} + continue + fi + + if [ -z "$char1" -o -z "$char2" ]; then + break + fi + + case "$char1$char2" in + [0-9][A-Za-z]) + arg1_is_great $cmp + return + ;; + [A-Za-z][0-9]) + arg1_is_less $cmp + return + ;; + [0-9][0-9]) + chunk1="$(expr "$str1" : '\([0-9]*\)')" + chunk2="$(expr "$str2" : '\([0-9]*\)')" + ;; + [A-Za-z][A-Za-z]) + chunk1="$(expr "$str1" : '\([A-Za-z]*\)')" + chunk2="$(expr "$str2" : '\([A-Za-z]*\)')" + ;; + esac + + # Compare chunks numerically if digits, or lexicographically + if expr "$chunk1" "!=" "$chunk2" >/dev/null; then + if expr "$chunk1" ">" "$chunk2" >/dev/null; then + arg1_is_great $cmp + return + else + arg1_is_less $cmp + return + fi + fi + + # Remove the chunk + str1="${str1#$chunk1}" + str2="${str2#$chunk2}" + done + + # Either STR1, STR2 or both is empty here + if [ -n "$str1" ]; then + case "$str1" in + ~*) arg1_is_less $cmp ;; + *) arg1_is_great $cmp ;; + esac + elif [ -n "$str2" ]; then + case "$str2" in + ~*) arg1_is_great $cmp ;; + *) arg1_is_less $cmp ;; + esac + else + arg1_is_same $cmp + fi +} + # # Recursively solve package dependencies # -# XXX: version requirement (version comparison) is not yet supported +# Result is in the pkg_list variable # all_required_config_files () { local list local all_list local new_list - local p - - list="$@" - all_list="$list" + local p pkg cmp ver + list=$* while [ -n "$list" ]; do - new_list="" for p in $list; do - read_config_file $p $PKG_CONFIG_PATH + if [ -z "$pkg" ]; then + pkg=$p + elif [ -z "$cmp" ]; then + case "$p" in + "="|"!="|"<"|">"|"<="|">=") cmp=$p ;; + *) + read_config_file $pkg $PKG_CONFIG_PATH + all_list="$all_list $pkg" + new_list="$new_list $(get_attr Requires)" + cleanup_vars_attrs + pkg=$p + ;; + esac + else + read_config_file $pkg $PKG_CONFIG_PATH + if ! eval_compare_version "$(get_attr Version)" $cmp $p; then + echo "Version mismatch for $pkg $cmp $p: $(get_attr Version)" 1>&2 + exit 1 + fi + all_list="$all_list $pkg" + new_list="$new_list $(get_attr Requires)" + cleanup_vars_attrs + pkg= + cmp= + fi + done + if [ -n "$cmp" ]; then + echo "No version after comparison operator ($cmp): $pkg" 1>&2 + exit 1 + elif [ -n "$pkg" ]; then + read_config_file $pkg $PKG_CONFIG_PATH + all_list="$all_list $pkg" new_list="$new_list $(get_attr Requires)" cleanup_vars_attrs - done - all_list="$all_list $new_list" + fi + list="$new_list" + new_list="" done - echo $(list_only_once $all_list) + pkg_list=$(list_only_once $all_list) } #### end of pkgconf-funcs @@ -349,14 +496,14 @@ if [ $myname = "gpg-error-config" -a -z "$modules" ]; then requires="$(get_attr Requires)" cleanup_vars_attrs - pkg_list=$(all_required_config_files $requires) + all_required_config_files $requires else if [ -z "$modules" ]; then modules=${myname%-config} fi cflags="" libs="" - pkg_list=$(all_required_config_files $modules) + all_required_config_files $modules fi for p in $pkg_list; do @@ -374,14 +521,14 @@ done if [ -z "$output_var" -a -z "$output_attr" ]; then if [ $opt_cflags = yes ]; then - output="$output $(list_only_once $cflags)" + output="$output${output:+ }$(list_only_once $cflags)" # Backward compatibility to old gpg-error-config if [ $mt = yes ]; then output="$output $mtcflags" fi fi if [ $opt_libs = yes ]; then - output="$output $(list_only_once_for_libs $libs)" + output="$output${output:+ }$(list_only_once_for_libs $libs)" # Backward compatibility to old gpg-error-config if [ $mt = yes ]; then output="$output $mtlibs" ----------------------------------------------------------------------- Summary of changes: src/gpg-error-config.in | 205 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 176 insertions(+), 29 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 09:37:54 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Fri, 31 Aug 2018 09:37:54 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-265-g55991aa Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 55991aa91667b9184cc9fc86a3ac21b9640511ef (commit) from 87bbe728fa68b0c1a62ead3e48650f8f33883b3f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 55991aa91667b9184cc9fc86a3ac21b9640511ef Author: Ben McGinnes Date: Fri Aug 31 17:36:45 2018 +1000 docs: python bindings * minor typographic update. Signed-off-by: Ben McGinnes diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org index 4dd3098..38d332f 100644 --- a/lang/python/docs/GPGMEpythonHOWTOen.org +++ b/lang/python/docs/GPGMEpythonHOWTOen.org @@ -207,7 +207,7 @@ include a package in PyPI which actually built correctly would require either statically built libraries for every architecture bundled with it or a full implementation of C for each architecture. -See the additional notes regarding CFFI and SWIG at the end of this +See the additional notes regarding [[#snafu-cffi][CFFI and SWIG]] at the end of this section for further details. @@ -398,7 +398,7 @@ ongoing. *** I don't like SWIG, Use CFFI instead :PROPERTIES: - :CUSTOM_ID: snafu-foad + :CUSTOM_ID: snafu-cffi :END: There are many reasons for favouring [[https://cffi.readthedocs.io/en/latest/overview.html][CFFI]] and proponents of it are ----------------------------------------------------------------------- Summary of changes: lang/python/docs/GPGMEpythonHOWTOen.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 10:34:43 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 31 Aug 2018 10:34:43 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-266-g346dfac Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 346dfac0de41326553a079af7521a010cc258d6c (commit) from 55991aa91667b9184cc9fc86a3ac21b9640511ef (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 346dfac0de41326553a079af7521a010cc258d6c Author: Maximilian Krambach Date: Fri Aug 31 10:35:35 2018 +0200 js: cleanup after key import test -- * one of the public Keys imported was not removed afterwards. diff --git a/lang/js/BrowserTestExtension/tests/KeyInfos.js b/lang/js/BrowserTestExtension/tests/KeyInfos.js index 430c83a..70f0705 100644 --- a/lang/js/BrowserTestExtension/tests/KeyInfos.js +++ b/lang/js/BrowserTestExtension/tests/KeyInfos.js @@ -51,7 +51,9 @@ describe('Key information', function () { const user = result.Keys[0].key.get('userids')[0]; expect(user.get('name')).to.equal( inputvalues.publicKeyNonAscii.userid); - done(); + result.Keys[0].delete().then(function (){ + done(); + }); }); }); }); \ No newline at end of file ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/tests/KeyInfos.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 13:24:16 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 31 Aug 2018 13:24:16 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.2.0-170-ga28610c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via a28610cb5f5b8d748a679d909f50ca66e72223e4 (commit) from 9544b76997276580c7ccbf3a002d446682161bfa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a28610cb5f5b8d748a679d909f50ca66e72223e4 Author: Andre Heinecke Date: Fri Aug 31 13:19:48 2018 +0200 Update NEWS for todays release -- diff --git a/NEWS b/NEWS index 847889b..bd0bc41 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -Noteworthy changes for version 2.3.0 (unreleased) +Noteworthy changes for version 2.3.0 (2018-08-31) ================================================= * Massive stability and performance improvements. ----------------------------------------------------------------------- Summary of changes: NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 13:24:52 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 31 Aug 2018 13:24:52 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.0-1-gad81087 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via ad81087b2f4c38aa353fce58bf4b2f5b967a381c (commit) from a28610cb5f5b8d748a679d909f50ca66e72223e4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ad81087b2f4c38aa353fce58bf4b2f5b967a381c Author: Andre Heinecke Date: Fri Aug 31 13:24:41 2018 +0200 Post release version bump -- diff --git a/NEWS b/NEWS index bd0bc41..f5f6bf2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Noteworthy changes for version 2.3.1 (unreleased) +================================================= + + Noteworthy changes for version 2.3.0 (2018-08-31) ================================================= diff --git a/configure.ac b/configure.ac index 05de361..4ddb931 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ min_automake_version="1.14" # (git tag -s gpgol-k.n.m) and run "./autogen.sh --force". Please # bump the version number immediately *after* the release and do # another commit and push so that the git magic is able to work. -m4_define([mym4_version], [2.3.0]) +m4_define([mym4_version], [2.3.1]) # Below is m4 magic to extract and compute the git revision number, # the decimalized short revision number, a beta version string and a ----------------------------------------------------------------------- Summary of changes: NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 13:26:34 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 31 Aug 2018 13:26:34 +0200 Subject: [git] gnupg-doc - branch, master, updated. ad4843900d221105e4c196de17f3eb5dcae7d143 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via ad4843900d221105e4c196de17f3eb5dcae7d143 (commit) from bcbb2828021607437e551b285ac3598cb72d8dc1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ad4843900d221105e4c196de17f3eb5dcae7d143 Author: Andre Heinecke Date: Fri Aug 31 13:26:07 2018 +0200 swdb: GpgOL 2.3.0 released -- diff --git a/web/swdb.mac b/web/swdb.mac index 4ce1f99..04191ac 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -181,11 +181,11 @@ # # GpgOL # -#+macro: gpgol_ver 2.2.0 -#+macro: gpgol_date 2018-06-17 -#+macro: gpgol_size 720k -#+macro: gpgol_sha1 0f79bb3a6ba6f34ecf85c3bac7a102fbd8abb739 -#+macro: gpgol_sha2 0e5ac1a4e270cb3afc2ecf0de801f208a10bb851f64ee46447f125186c70a2f4 +#+macro: gpgol_ver 2.3.0 +#+macro: gpgol_date 2018-08-31 +#+macro: gpgol_size 735k +#+macro: gpgol_sha1 8c1c8fc098b23c690b2f4ea2c82bffa38071c70d +#+macro: gpgol_sha2 8faa3bcec013b6e769a01aecb7845e94618f83aa876fdbe84fe44af89142f86b # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 14:24:05 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 31 Aug 2018 14:24:05 +0200 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.0-2-g7b5d671 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 7b5d671c020b32f3d147bcac3585448ea2e65bb0 (commit) from ad81087b2f4c38aa353fce58bf4b2f5b967a381c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7b5d671c020b32f3d147bcac3585448ea2e65bb0 Author: Andre Heinecke Date: Fri Aug 31 14:23:36 2018 +0200 Fix missing space in german translation of version * po/de.po: Add ending space. diff --git a/po/de.po b/po/de.po index 7b5d990..c7bbdde 100644 --- a/po/de.po +++ b/po/de.po @@ -58,7 +58,7 @@ msgstr "Debug..." #: src/addin-options.cpp:49 msgid "Version " -msgstr "Version" +msgstr "Version " #: src/addin-options.cpp:50 msgid "&Resolve recipient keys automatically" ----------------------------------------------------------------------- Summary of changes: po/de.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 14:26:41 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 31 Aug 2018 14:26:41 +0200 Subject: [git] gnupg-doc - branch, master, updated. a2594ca184de0a5eebf40b700b30bdc6b45bb135 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via a2594ca184de0a5eebf40b700b30bdc6b45bb135 (commit) from ad4843900d221105e4c196de17f3eb5dcae7d143 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a2594ca184de0a5eebf40b700b30bdc6b45bb135 Author: Andre Heinecke Date: Fri Aug 31 14:26:29 2018 +0200 swdb: Gpg4win-3.1.3 -- diff --git a/web/swdb.mac b/web/swdb.mac index 04191ac..2b7cb63 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -51,17 +51,17 @@ # # Gpg4win # -#+macro: gpg4win_ver 3.1.2 -#+macro: gpg4win_date 2018-06-17 -#+macro: gpg4win_src_size 5302k -#+macro: gpg4win_src_sha1 e875d1ab4d8c3c960fdbdb00236d8da0a14ed07e -#+macro: gpg4win_src_sha2 bb82b45fb33e399da9ae0c0883c8933c8fb3a1f952c16766b35a13d65e4ad839 -#+macro: gpg4win_exe_size 27558k -#+macro: gpg4win_exe_sha1 01597cb2a0ff4a914717d603547906e3862b6382 -#+macro: gpg4win_exe_sha2 6c7bbb36c89c83b2432edc9a7fe64c73b26711ca0d3d6a0d55c71aef66ec70f1 -#+macro: gpg4win_isrc_size 222822k -#+macro: gpg4win_isrc_sha1 0445037c401357ca463da39771c3bda7a79782d6 -#+macro: gpg4win_isrc_sha2 c8c80554149c6dad410461cc17447aa8115525ee003aafe6ace034da5a40970c +#+macro: gpg4win_ver 3.1.3 +#+macro: gpg4win_date 2018-08-31 +#+macro: gpg4win_src_size 5303k +#+macro: gpg4win_src_sha1 cf92c699d2e7fd8417f8a80f0c55849b8404b720 +#+macro: gpg4win_src_sha2 e543369e4ccec0153c2a2008ed571b3a2c1625470ed2b7927e64ff37bce814ab +#+macro: gpg4win_exe_size 27690k +#+macro: gpg4win_exe_sha1 a135547bafc3e445b284d90cfb7c736120789a48 +#+macro: gpg4win_exe_sha2 c3c18150a48ab1e42d41301d66f936682d6b26d55bc04a5ebaafdbb0dfb72034 +#+macro: gpg4win_isrc_size 223028k +#+macro: gpg4win_isrc_sha1 7104c13936605c5ac91cc5d600d0a1512d503109 +#+macro: gpg4win_isrc_sha2 55ffbac982eb5dfef1a2af5ead343adc903d53ee56c4e219a11433b63fd1f686 # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Fri Aug 31 15:23:15 2018 From: cvs at cvs.gnupg.org (by Maximilian Krambach) Date: Fri, 31 Aug 2018 15:23:15 +0200 Subject: [git] GPGME - branch, master, updated. gpgme-1.11.1-267-gdacb119 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via dacb1197155cb953953b75677c1783df2cba0ed6 (commit) from 346dfac0de41326553a079af7521a010cc258d6c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dacb1197155cb953953b75677c1783df2cba0ed6 Author: Maximilian Krambach Date: Fri Aug 31 15:24:38 2018 +0200 js: key deletion after test -- * Yet again some wrong syntax in Browsertests diff --git a/lang/js/BrowserTestExtension/tests/KeyInfos.js b/lang/js/BrowserTestExtension/tests/KeyInfos.js index 70f0705..553aedb 100644 --- a/lang/js/BrowserTestExtension/tests/KeyInfos.js +++ b/lang/js/BrowserTestExtension/tests/KeyInfos.js @@ -51,9 +51,9 @@ describe('Key information', function () { const user = result.Keys[0].key.get('userids')[0]; expect(user.get('name')).to.equal( inputvalues.publicKeyNonAscii.userid); - result.Keys[0].delete().then(function (){ + result.Keys[0].key.delete().then(function (){ done(); }); }); }); -}); \ No newline at end of file +}); ----------------------------------------------------------------------- Summary of changes: lang/js/BrowserTestExtension/tests/KeyInfos.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org