* Added some material on using the new-ish hkp4py module with GPGME.
* Example code will be added later once a couple of little issues are
addressed.
Signed-off-by: Ben McGinnes <ben@adversary.org>
* src/gpgme-json.c (op_createkey): Remove subkey-algo param.
(GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER): Fix typo.
* lang/js/src/Keyring.js: Remove subkey-algo support.
* lang/js/src/permittedOperations.js: Ditto.
--
We do not want to expose details of the protocol's key generation and
thus the subkey-algo does not make sense. Right now we support only
the default and future-default algorithms. A user can configure them
anyway using new-default-key-algo in gpg.conf. Eventually we may
officially support a more flexible way of creating special structured
OpenPGP keys but right now that is not part of the API.
Signed-off-by: Werner Koch <wk@gnupg.org>
--
* src/index.js: Added an optional configuration object for the startup.
* configuration: timeout - the initial check for a connection ran into
timeouts on slower testing machines. 500ms for initial startup is
not sufficient everywhere. The default timeout was raised to 1000ms,
and as an option this timeout can be increased even further.
* BrowsertestExtension: Set the initial connection timeouts to 2
seconds, to be able to test on slower machines.
* Sanitized the shell command examples of extraneous whitespace.
* Removed keycount.c as sanitising it is pointless and it will be
generated by Cython when the example is followed.
* Regenerated the .texi version.
* Added new advanced section with an example of using the Python
bindings with CPython code compiled back to C code using Cython.
* Though it may seem a bit counter-intuitive to use the bindings just
to go back to C via a different route, this is not actually stupid.
* Added examples/howto/advanced/cython/ directory.
* Added keycount.pyx, setup.py and the keycount.c file which the first
two generated with Cython. Not including the .so and .o files from
the build.
* Exported the .texi version of the howto for the main docs.
* lang/python/docs/gpgme-python-howto.org: more tweaks and edits,
along with another build of output formats.
* doc/gpgme-python-howto.texi: updated texinfo version for parent docs.
* lang/python/docs/gpgme-python-howto.org: Identified and fixed the
headings which kept generating lines with trailing whitespace when
exporting to Texinfo format and adjusted them to prevent that.
* lang/python/docs/gpgme-python-howto.org: Renamed file to better fit
the rest of the project's docs.
* Added a section on the very unofficial drafts I periodically post
links to since they're often the easiest way to get a web version in
front of someone in a hurry.
* lang/python/docs/GPGMEpythonHOWTOen.org: Added corresponding GPGME
version number to table at the start and cut the shortcut from the
groups.py example.
* doc/gpgme-python-howto.texi: New export of Texinfo file for docs
build.
* lang/python/docs/GPGMEpythonHOWTOen.org: Fixed a few errors in the
newer sections.
* Updated code in the examples using secret key exporting and group
lines to reflect the Python 2.7 compatibility fixes added.
* lang/python/examples/howto/export-secret-keys.py and groups.py:
Updated the backwards compatibility adjustments to account for
unicode differences between python 2 and 3.
* lang/python/examples/howto/groups.py: subprocess update
* lang/python/examples/howto/export-secret-keys.py: subprocess update
Both of these try the nice and easy method of getting the subprocess
output available in Python 3, but will fall back to the older Popen
method if it doesn't work. Essentially this is to be a little nicer
to Python 2.7.15 (even though the examples are filled with warnings
that py2 support is not guaranteed with the examples).
--
* src/Helpers.js: GPGME_Keys were not parsed as valid, as their
fingerprint getter is not a fingerprint 'property'.
* BrowserTestExtension: fixed a dsplay typo in counting of tests.
--
* 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.
--
* 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.
--
* 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)
--
* 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
--
* 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'
* 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
08cd34afb7 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 <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
--
* 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.
* 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.
--
* 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.
--
* 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
--
* 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.
--
* reflecting the new optional strings accepted by the backend.
'file_name' and 'sender' can be used via the 'additional'
parameter in encrypt operations
--
* 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)
--
* 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.
--
* 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.
--
* 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.
--
* 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