Commit Graph

876 Commits

Author SHA1 Message Date
Ben McGinnes
962dfca9b8 dpcs: python howto
* More updates to the docs themselves and the versions to be available
  with the next release.
* .texi and .rst copies of the HOWTO and the short history of (this
  part) of the project.
2018-10-04 07:09:40 +10:00
Ben McGinnes
2151b9828a docs: python
* More restructuring.  Also the painstaking task of deciphering some
  of the more eclectic aspects of Texinfo and make.
2018-10-04 07:06:57 +10:00
Ben McGinnes
a982f91315 docs: python bindings
* Restructured the docs directory to account for the GNU preferred
  source doc format (.texi) and the Python preferred source doc
  format (.rst) and the real source doc format (.org).
* Both the perceived source formats will need to be generated from the
  .org files and included at this stage.  Unfortunately there is not
  yet a native org-to-rst transformation method in the org-mode
  software in Emacs nor is there a a direct means of going from reST
  to Org-mode from Docutils.  There's only third party packages like
  Pandoc and, while very good, there is no guarantee of consistency;
  so we can't entirely automate this bit (yet).
2018-10-04 06:57:51 +10:00
Ben McGinnes
b280205319 docs: pre-python preparation
* doc/Makefile.am: removed the python howto from this file, restoring
  it to just the main project and the newer .js files.
* deleted: doc/gpgme-python-howto.texi
* renamed the Short_History.org file to short-history.org to keep the
  naming conventions similar.
* All the Python files can (and should) live together.
2018-10-04 01:42:12 +10:00
Ben McGinnes
23894ac9a9 python bindings: CPython order
* Changed the order of python versions the configure/make process
  checks for, placing Python 3.7 ahead of 3.6.
* Updated the HOWTO documentation to reflect this change.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-03 06:58:51 +10:00
Ben McGinnes
76bdfabb05 docs: python bindings
* Tightened up the docs a little bit, updated the "what's new"
  section, dropped the "-draft" version in preparation for GPGME
  1.12.0's release.
* Exported another .texi version (and updated the draft copies to this
  commit (which ought to be 1.11.1-beta313).

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-01 02:10:03 +10:00
Ben McGinnes
837a476053 python bindings: fixing decrypt-verify
* lang/python/src/core.py: First restoring the exception to the being
  just that.
* The means to manipulate the error output is temporarily in commented
  out code, but ought to be added to a proper test later.
* In the mean time the original test, with a very slight change, works
  again.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-30 19:32:45 +10:00
Ben McGinnes
11403a4635 python bindings: ctx.decrypt
* lang/python/src/core.py: Fixed methods of detecting whether verify
  is a boolean variable or a list.
* Added methods of catching the missing keys exceptions.
* Still retained PEP8 compliance (which might have been where one or
  two problems crept in).
* Though this is essentially the correct behaviour, it still does not
  quite fit the otiginal test; so that will also require some adjustment.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-30 16:28:54 +10:00
Ben McGinnes
ce045a1ef9 example: local signatures
* lang/python/examples/howto/local-sign-group.py: added the bit where
  specifying the signing key is actually used for signing rather than
  just pruning the list of keys to certify.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-27 23:23:37 +10:00
Ben McGinnes
a047e0f68e example: python bindings
* lang/python/examples/howto/local-sign-group.py: locally sign every
  key in a group line except one's own keys.  Intended to address the
  sort of thing one might see on lists like PGPNET or other closed
  groups amongst activists, journalists, etc. where everyone encrypts
  to all recipients, but may not sign everyone's keys publicly..

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-27 22:45:37 +10:00
Ben McGinnes
1d40d360bc docs: python bindings installation
* lang/python/docs/gpgme-python-howto.org: added a section on
  installing the bindings to a python virtualenv.
2018-09-27 14:06:48 +10:00
Ben McGinnes
b9aea3b9c2 tests: python bindings
* Fixed the final assertion to look for what will actually be reported
  in that case instead of something else (i.e. it looks for an
  IMPORT_ERROR status code).
2018-09-27 10:07:08 +10:00
Ben McGinnes
7c9f49a499 examples: python bindings
* Fixed homedir specifying logic in several cases.
2018-09-27 09:57:50 +10:00
Ben McGinnes
b625258d54 docs: a typographical two-step
* Sometimes you really do need or want punctuation in a heading, but
  ideally without something else generating whitespace and other
  annoyances to go with it.
* Trying a real decimal point instead.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-25 10:17:39 +10:00
Ben McGinnes
62e4e2cb5e docs and examples: python bindings
* Woumd up the "what's new" section.
* Added an example for sending a key to the keyservers via hkp4py.
* Updated the export key code to use a more complete check for the
  $GNUPGHOME location.
* Expanded on the installation and reinstallation troubleshooting
  section.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-25 09:59:31 +10:00
Ben McGinnes
e9da4d9710 docs: python bindings howto
* Added a What's New section to summarise changes since the last
  release.  There have been quite a few and some attention does need
  to be drawn to some of them.
* Confirming certain issues with some platform builds, especially
  BSD/OSX vs. Linux issues which will need to update the installation
  troubleshooting guides.
2018-09-25 04:32:13 +10:00
Ben McGinnes
b12b2cc996 docs and examples: python bindings howto
* Added more comprehensive examples using hkp4py and added a couple
  more example scripts for protonmail.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 19:36:54 +10:00
Ben McGinnes
ced4bdbbb2 examples: python bindings and hkp4py updates
* Mostly tightening up the details on the hkp4py example script.
* Also fixed a typo in the LGPL boiler plate text included in all the
  other example scripts for the HOWTO.
2018-09-23 11:43:34 +10:00
Ben McGinnes
6ed9a77c92 python bindings: importing from keyservers with hkp4py
* added a new example script to search the keyservers and import the
  results, this time using Marcel Fest's hkp4py module.
* Updated the key importing section to match this addition.
* Tested with the current version of hkp4py from github.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 08:18:44 +10:00
Ben McGinnes
3622576105 docs: python bindings howto
* Confirmed that updates to the tests have significant'y improved that
  output.
* Updated some of the additional notes for the section on hkp4py.
** This is in anticipation adding at least import examples using that
   module as well.  It may also include adding examples of exporting a
   key and uploading it to the keyservers.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 05:37:40 +10:00
Werner Koch
6878126b6f
python: Fix a couple of syntax errors.
* lang/python/tests/t-keylist-from-data.py: Add missing line
continuation.
* lang/python/tests/t-keylist.py: Ditto.
* lang/python/tests/t-quick-key-creation.py: Ditto.
* lang/python/tests/t-quick-subkey-creation.py: Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 17:45:07 +02:00
Werner Koch
dcdabf5f2e
python: Silence a few warnings.
* src/gpgme.h.in: Obsolete "class" also for Python.
* lang/python/gpgme.i: Silenece a swig warning.  Silence a gcc
warning.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 17:45:07 +02:00
Maximilian Krambach
ec2d2b78bc js: renamed keygen algo option
--

* src/Keyring.js: Confused default-future with future-default

* reverts commit 34be6163f6
2018-09-20 15:48:19 +02:00
Werner Koch
9f19b3aaec
python: Fix regression in the test suite.
* lang/python/tests/Makefile.am (GNUPGHOME): Remove stray backslash.
--

Fixes-commit: d09d19fa9f
Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 12:13:03 +02:00
Werner Koch
a824f4498e
tests: Don't try using keys from a scmartcard.
* tests/gpg/Makefile.am: Disable scdaemon
* lang/python/tests/Makefile.am: Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 12:13:03 +02:00
Ben McGinnes
5cb67257f2 docs: python bindings and its special request
* 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>
2018-09-20 11:38:20 +10:00
Maximilian Krambach
34be6163f6 js: add 'default-future' as createKey option
--
* src/Keyring.js: default-future can be used now for key creation as
  algo.
2018-09-19 17:56:55 +02:00
Werner Koch
c569adb5e3
json: Remove subkey-algo from createkey command.
* 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>
2018-09-19 11:51:31 +02:00
Maximilian Krambach
7f14958606 js: add configuration option on startup
--

* 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.
2018-09-19 10:56:36 +02:00
Ben McGinnes
362caaf02f docs: python bindings
* Updated the Cython example code slightly, along with the
  corresponding explanation.
2018-09-18 08:32:30 +10:00
Ben McGinnes
f4d83800d8 docs: python bindings howto
* Tightened up the Cython demonstration.
2018-09-17 14:33:02 +10:00
Ben McGinnes
44c846345e docs: cython sanitized
* 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.
2018-09-16 13:58:34 +10:00
Ben McGinnes
61c08f7435 docs: python bindings howto
* 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.
2018-09-16 13:48:12 +10:00
Ben McGinnes
fbec29fdac docs: even more edits
* doc/gpgme-python-howto.texi: hunting down and killing commas,
  Oxford or not it can't stay in a heading.
2018-09-16 11:06:32 +10:00
Ben McGinnes
2a1b0b88d9 docs: more edits
* 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.
2018-09-16 10:52:30 +10:00
Ben McGinnes
91b26b0638 docs: whitespace culled
* 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.
2018-09-16 09:47:05 +10:00
Ben McGinnes
766ec0e4a3 docs: renaming and drafts
* 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.
2018-09-16 08:36:10 +10:00
Ben McGinnes
7e9df9b9e3 docs: Python howto update
* 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.
2018-09-16 06:35:02 +10:00
Ben McGinnes
d04fb0bf12 Python bindings: docs
* 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.
2018-09-16 03:36:14 +10:00
Ben McGinnes
4e8a92ed14 Python bindings: examples
* 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.
2018-09-16 03:34:36 +10:00
Ben McGinnes
864ef9b40f Python examples: backwards compatibility
* 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).
2018-09-15 12:10:05 +10:00
Thomas Oberndörfer
dd7d37ca21
js: Fix errorDetails of GPGME_Signature
* lang/js/src/Signature.js (GPGME_Signature.errorDetails):
Access properties from the summary object.
2018-09-10 13:11:48 +02:00
Maximilian Krambach
53d69af014 js: add new documentation file to extra_dist
--
* jsdoc_index.md is the documentation's 'main page' to offer a better
  intro than only the parser-generated API confusion.
2018-09-06 11:27:39 +02:00
Maximilian Krambach
6463b1cd3b js: fix error in toKeyIdArray
--
* 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.
2018-09-06 10:11:10 +02:00
Maximilian Krambach
1c618166fc js: documentation cleanup
--
2018-09-05 18:46:28 +02:00
Maximilian Krambach
dacb119715 js: key deletion after test
--

* Yet again some wrong syntax in Browsertests
2018-08-31 15:24:38 +02:00
Maximilian Krambach
346dfac0de js: cleanup after key import test
--

* one of the public Keys imported was not removed afterwards.
2018-08-31 10:36:54 +02:00
Ben McGinnes
55991aa916 docs: python bindings
* minor typographic update.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-08-31 17:36:45 +10:00
Maximilian Krambach
87bbe728fa 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.
2018-08-30 16:16:13 +02:00
Maximilian Krambach
5d6039f6bf 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.
2018-08-30 15:37:37 +02:00
Maximilian Krambach
3201ded91f 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)
2018-08-30 15:00:19 +02:00
Maximilian Krambach
44691995b7 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
2018-08-30 14:46:54 +02:00
Maximilian Krambach
a9863717b1 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'
2018-08-30 12:09:26 +02:00
Ben McGinnes
1d00fb987b 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
  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>
2018-08-30 15:41:31 +10:00
Maximilian Krambach
61ac70cfb5 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.
2018-08-29 17:45:55 +02:00
Ben McGinnes
18ea838671 python bindings: core
* lang/python/src/core.py: expanded gpgme_error check lists.
2018-08-30 01:01:23 +10:00
Ben McGinnes
dcedddecb6 python bindings: core
* lang/python/src/core.py: added gpgme_data_set_flag to the errorcheck
  funtion.
2018-08-30 01:01:23 +10:00
Ben McGinnes
6078b53033 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.
2018-08-30 01:01:23 +10:00
Ben McGinnes
f7e5ae7f16 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.
2018-08-29 20:30:57 +10:00
Ben McGinnes
02d0b97bfe docs: python bindings HOWTO
* Finished CFFI vs SWIG bit in known issues.
* tidied up some of the structure.
* Fixed some minor errors and links.
2018-08-29 04:14:24 +10:00
Ben McGinnes
a8a983c5bc docs: python bindings
* Added section on why no CFFI.
2018-08-29 03:42:46 +10:00
Ben McGinnes
c2831e2377 docs: python howto
* Added another key import example using ProtonMail's new keyserver.
2018-08-28 18:45:37 +10:00
Ben McGinnes
1c261b9fa3 docs: python bindings
* Added details on installation troubleshooting.
2018-08-28 06:42:27 +10:00
Maximilian Krambach
8aa61fd3a2 js: small documentation update
--
2018-08-27 13:25:58 +02:00
Maximilian Krambach
28086252f1 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.
2018-08-27 13:00:50 +02:00
Maximilian Krambach
766d42c248 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
2018-08-27 12:38:32 +02:00
Maximilian Krambach
4f28fbddd3 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.
2018-08-27 11:50:09 +02:00
Maximilian Krambach
557fec6002 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
2018-08-27 11:21:02 +02:00
Maximilian Krambach
138e1dde02 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
2018-08-24 10:33:42 +02:00
Maximilian Krambach
f62dd4bb27 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)
2018-08-23 17:58:22 +02:00
Maximilian Krambach
352c53040d 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.
2018-08-23 12:30:49 +02:00
Maximilian Krambach
3fd6837fce js: use destructured option parameters
--
* Adds to f0409bbdaf and makes use of
  destructuring, allowing for defaults, and cleaning up the
  validation.
2018-08-23 12:15:59 +02:00
Maximilian Krambach
60dc499abd 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.
2018-08-23 11:28:18 +02:00
Maximilian Krambach
24a0005865 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.
2018-08-22 19:07:05 +02:00
Maximilian Krambach
f0409bbdaf 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
2018-08-22 18:37:46 +02:00
Maximilian Krambach
129fa919b9 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@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.
2018-08-22 16:32:31 +02:00
Maximilian Krambach
94a0ed361e 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.
2018-08-22 14:49:11 +02:00
Andre Heinecke
59ed27bae1
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
2018-08-22 13:15:35 +02:00
Maximilian Krambach
d8fd4aad8a js: changed verify signature result infos
--

* the resulting information of verify now are as documented,
  and the same as in a decrypt callback
2018-08-22 12:44:05 +02:00
Maximilian Krambach
93f674d33d 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
2018-08-22 12:18:55 +02:00
Maximilian Krambach
6d720137dd 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)
2018-08-21 15:26:17 +02:00
Maximilian Krambach
9dd6c67cd5 js: remove outdated checklists
--

* They are heavily outdated and offer no more useful information
2018-08-21 14:37:50 +02:00
Andre Heinecke
0036b9bc49
js: Fix library name mentioned in js Makefiles
--
2018-08-21 13:58:51 +02:00
Andre Heinecke
738a8e6f95
js: Update extra_dist files
* lang/js/BrowserTestExtension/Makefile.am,
lang/js/Makefile.am (EXTRA_DIST): Update.
2018-08-21 13:58:51 +02:00
Andre Heinecke
605eb8a8bf
js: Improve README
* lang/js/README: Clarify structure at the beginning.
2018-08-21 13:58:51 +02:00
Maximilian Krambach
8b8c009dee 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.
2018-08-21 11:42:11 +02:00
Maximilian Krambach
d77a1c887d js: add option "subkey-algo" to generateKey
--

* The option was recently added to gpgme-json; this reflects this on
  javascript side
2018-08-20 18:05:34 +02:00
Maximilian Krambach
91c2362550 js: set expiry date on generateKey
--

* on the javascript side a Date is expected, gpggme-json expects
  seconds from 'now'
2018-08-20 17:46:29 +02:00
Maximilian Krambach
dd32daad0b js: add and apply eslint rules
--

* mainly spacing, see .eslintrc.json for details
2018-08-20 15:12:01 +02:00
Maximilian Krambach
1954d27be8 js: revert changes to class read/write restriction
--

* undoes 94ee0988d4 and
  e16a87e839.
  I do not fully understand why my approach was bad, but I am not in
  a position to argue. This revert was requested to me after a review,
  and I'm doing it in the assumption that more experienced people know
  better than me.
* unittests: Also changed some outdated tests that stopped working
  since 754e799d35 (as GPGME_Key is not
  exported, one cannot check for instanceof in the tests anymore)
2018-08-20 12:12:43 +02:00
Ben McGinnes
75bc5e6356 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.
2018-08-19 14:32:30 +10:00
Ben McGinnes
03b899dbe1 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.
2018-08-19 00:21:47 +10:00
Ben McGinnes
5facba45c8 Python bindings tests: Near PEP8 compliance
* PEP8 compliance for the vast majoeity of the tests.
2018-08-18 20:29:14 +10:00
Ben McGinnes
b5fbe90676 Python bindings examples: PEP8 conpliance
* Appears to be complete compliance.
2018-08-18 18:46:47 +10:00
Ben McGinnes
fc55caccfc 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.
2018-08-18 18:19:16 +10:00
Ben McGinnes
8a6a73b9c4 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.
2018-08-18 15:36:23 +10:00
Ben McGinnes
7962cde13c Python bindings src: PEP8 compliance
* import namespace clearance for src/*.py.
* Fixed a handful of is/is not None checks as well.
2018-08-18 15:05:34 +10:00
Maximilian Krambach
74684f24c6 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
2018-08-17 19:20:35 +02:00
Maximilian Krambach
3cbafb97ec 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.
2018-08-17 18:25:57 +02:00
Maximilian Krambach
fff365ffc5 js: expect additional 'info' to arrive on decrypt, too
--

* src/permittedOperations.js: if decrypt includes a verification,
  this info needs to pass, too.
2018-08-17 17:55:11 +02:00