aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | js: don't allow message operation changesMaximilian Krambach2018-04-233-30/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | -- Once an operation is changed, their set of allowed/required parameters will change. So we shouldn't set/change the operation later.
| * | | js: Key handling stubs, Error handling, refactoringMaximilian Krambach2018-04-238-131/+756
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- * Error handling: introduced GPGMEJS_Error class that handles errors at a more centralized and consistent position * src/Connection.js: The nativeMessaging port now opens per session instead of per message. Some methods were added that reflect this change - added methods disconnect() and reconnect() - added connection status query * src/gpgmejs.js - stub for key deletion - error handling - high level API for changing connection status * src/gpgmejs_openpgpjs.js - added stubs for Key/Keyring handling according to current state of discussion. It is still subject to change * src/Helpers.js - toKeyIdArray creates an array of KeyIds, now accepting fingerprints, GPGMEJS_Key objects and openpgp Key objects. * Key objects (src/Key.js) Querying information about a key directly from gnupg. Currently a stub, only the Key.fingerprint is functional. * Keyring queries (src/Keyring.js): Listing and searching keys. Currently a stub.
| * | | js: encrypt improvement and decrypt methodMaximilian Krambach2018-04-2018-306/+887
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Compatibility class gpgme_openpgpjs offers an API that should accept openpgpjs syntax, throwing errors if a parameter is unexpected/not implemented * tried to be more generic in methods * waiting for multiple answers if 'more' is in the answer * more consistency checking on sending and receiving * updated the example extension --
| * | | Merge branch 'master' into javascript-bindingMaximilian Krambach2018-04-2037-535/+1993
| |\ \ \
| * | | | js: Initial commit for JavaScript Native Messaging API[email protected]2018-04-1014-1/+472
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- Note this code misses all the legal boilerplate; please add this as soon as possible and provide a DCO so we can merge it into master. I also removed the dist/ directory because that was not source code.
* | | | | json: Add proper decrypt_result_t handlingAndre Heinecke2018-08-211-7/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | | | json: Add subkey_algo and defaults to createkeyAndre Heinecke2018-08-201-4/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | | | Python bindings examplesBen McGinnes2018-08-193-1/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | | | Python bindings setup fileBen McGinnes2018-08-181-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | | | Python bindings tests: Near PEP8 complianceBen McGinnes2018-08-1831-500/+773
| | | | | | | | | | | | | | | | | | | | * PEP8 compliance for the vast majoeity of the tests.
* | | | | Python bindings examples: PEP8 conplianceBen McGinnes2018-08-1812-35/+49
| | | | | | | | | | | | | | | | | | | | * Appears to be complete compliance.
* | | | | Python bindings setup: Near PEP8 complianceBen McGinnes2018-08-182-89/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | | | Python bindings constants: PEP8 compliance (almost)Ben McGinnes2018-08-1819-35/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PEP8 compliance for all constants except the globals in src/constants/__init__.py depending on whether the import sequence affects the globals themselves.
* | | | | Python bindings src: PEP8 complianceBen McGinnes2018-08-185-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | * import namespace clearance for src/*.py. * Fixed a handful of is/is not None checks as well.
* | | | | Symmetric exampleBen McGinnes2018-08-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* | | | | Symmetric encryption exampleBen McGinnes2018-08-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * lang/python/examples/howto/symcrypt-file.py: Fixed the error code and the passphrase key word arg.
* | | | | Symmetric encryption example.Ben McGinnes2018-08-131-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | * lang/python/examples/howto/symcrypt-file.py: A variation on standard key based encryption.
* | | | | PEP8 compliance and other code fixesBen McGinnes2018-08-1010-130/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* | | | | Link fixesBen McGinnes2018-08-092-18/+18
| | | | | | | | | | | | | | | | | | | | * lang/python/README: Fixed links in both versions of the README.
* | | | | json: Wipe memory in cJSON_DeleteAndre Heinecke2018-08-081-2/+8
| | | | | | | | | | | | | | | | | | | | * src/cJSON.c (cJSON_Delete): Wipe memory on deletion.
* | | | | json: Only use calloc instead of mallocAndre Heinecke2018-08-082-8/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | | | json: Add checks when skipping byteAndre Heinecke2018-08-081-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/cJSON.c (parse_string, cJSON_Minify): Check for terminating NULL byte when skipping the byte after a an escaped quote.
* | | | | json: Don't error out if chunksize is omittedAndre Heinecke2018-08-081-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | | | cpp: Fix use after free in gencardkeyinteractorAndre Heinecke2018-08-081-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* | | | | Make GNUPGHOME for tests overridableAndre Heinecke2018-08-066-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* | | | | cpp: Add safety checks for key updateAndre Heinecke2018-07-242-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lang/cpp/src/key.cpp (Key::update): Check that the key is not NULL. * lang/cpp/src/verificationresult.cpp (GpgME::Signature::key): Check for fingerprint.
* | | | | docs: python bindings howtoBen McGinnes2018-07-221-170/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fixed and tested the changes necessary for org-mode to correctly parse pythonic (Python 3) indentation. * Updated the source blocks to recommended upper case for BEGIN_SRC and END_SRC. * Tested and confirmed XHTML output matches correct examples. * Tested against pseudo-control output via exporting from org-mode to org-mode and then exporting that to XHTML. Remaining differences appear to be discarding the custom tags used to provide X[HT]ML id elements to each section which does not appear to offer any benefit. * Exporting directly to XHTML or other HTML output should no longer cause problems, but if there are any then the first step should be exporting from org-to-org and then exporting that to XHTML. Tested-by: Ben McGinnes <[email protected]> Signed-off-by: Ben McGinnes <[email protected]>
* | | | | doc: python bindings howtoBen McGinnes2018-07-221-624/+623
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Another retrofitting of the HOWTO Python example code, this time following adjustments to python-mode configuration and having trawled through the org-mode mailing lists for clues.
* | | | | doc: python bindings howtoBen McGinnes2018-07-221-0/+1
| | | | | | | | | | | | | | | | | | | | * Added org-mode byline.
* | | | | core: Clear all flags for a new data property.Werner Koch2018-07-191-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/data.c (PROPERTY_TABLE_ALLOCATION_CHUNK): New. (insert_into_property_table): Use it here. Clear all flags. -- Fixes-commit: 085cdeddef637cc057362fcbde13b0261b8699ec Signed-off-by: Werner Koch <[email protected]>
* | | | | core: Blank out the plaintext after decryption failure.Werner Koch2018-07-197-16/+361
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/data.h (data_prop_t): New enum. (struct gpgme_data): Add field propidx. * src/data.c (property_t): New. (property_table, property_table_size, property_table_lock): New. (insert_into_property_table): New. (remove_from_property_table): New. (_gpgme_data_get_dserial): New. (_gpgme_data_set_prop): New. (_gpgme_data_get_prop): New. (_gpgme_data_new): Connect new object to property_table. (_gpgme_data_release): Remove from property_table. (gpgme_data_read): With DATA_PROP_BLANKOUT set don't fill the buffer. * src/data-mem.c (gpgme_data_release_and_get_mem): Likewise. * src/decrypt.c (struct op_data): Add field plaintext_dserial. (_gpgme_op_decrypt_init_result): Add arg plaintext and init new field. (_gpgme_decrypt_status_handler): Set DATA_PROP_BLANKOUT on decryption failure. (_gpgme_decrypt_start): Pass PLAIN to the init function. * src/decrypt-verify.c (decrypt_verify_start): Ditto. * configure.ac: Check for stdint.h and bail out if uint64_t is not available. -- This is a best effort feature to not output plaintext after a decryption failure (e.g. due to no or broken authenticated encryption). It always work when using a memory object and reading it after the decryption but it can't work reliable when the user is reading from the data object while the decryption process is still running. This is quite a large change because the data objects and the context objects are allowed to be owned by different threads. Thus a synchronization is needed and we do this with a global table of all data objects to which the context objects can do soft-linking via a unique data object serial number. Signed-off-by: Werner Koch <[email protected]>
* | | | | cpp: Print origin and last update for key/uidAndre Heinecke2018-07-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * lang/cpp/src/key.cpp: Print origin and last update in iostream operators.
* | | | | json: Don't use strdup but the xtrystrdup wrapper.Werner Koch2018-07-191-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (create_keylist_patterns): Use CNT as first arg for xcalloc. (process_request): s/strdup/xtrystrdup/. -- calloc takes two arguments so to be able to detect integer overflow. Thus if we switch from malloc to calloc we should utilize that. Signed-off-by: Werner Koch <[email protected]>
* | | | | core: New interface gpgme_data_new_from_estream.Werner Koch2018-07-196-1/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_data_new_from_estream): New. * src/data-estream.c: New. * src/data.h (gpgme_data): New union member e_stream. -- The estream functions (gpgrt_fopen et al.) are any waypart of the required libgpg-error library and thus it makes sense to provide this convenience interface. Signed-off-by: Werner Koch <[email protected]>
* | | | | json: Fix memleak in native msging replAndre Heinecke2018-07-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (native_messaging_repl): Free request and response after each loop. -- If we only accept once request we should not loop. If we loop we should do it properly.
* | | | | json: Ensure that native msging request is stringAndre Heinecke2018-07-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (native_messaging_repl): Ensure that the request is NULL terminated. -- This avoids potential memory leaks and access to unmapped memory in case the request was not terminated. Other request functions use es_read_line which gurantees NULL termination.
* | | | | json: Fix crash by ensuring response is never NULLAndre Heinecke2018-07-181-7/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (encode_and_chunk): Try to always return at least an error. (process_request): Double check that it does not return NULL. -- If process_request returns NULL the following strlen on it would crash.
* | | | | json: Fix memory errors in create_keylist_patternsAndre Heinecke2018-07-181-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (create_keylist_patterns): Reserve two pointers more then linefeeds. (create_keylist_patterns): Fix loop to count linebreaks. (create_keylist_patterns): Use calloc for good measure. -- This fixes crashes and memory corruption as cnt did not match i.
* | | | | qt: Handle encoding for diagnosticsAndre Heinecke2018-07-181-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lang/qt/src/threadedjobmixin.cpp (fromEncoding) (stringFromGpgOutput): New helpers. (markupDiagnostics): Use it. -- The Problem is that on my western windows system GnuPG gets CP 437 as GetConsoleOutputCP and prints in that codepage. In a W32 GUI Application we get 0 as GetConsoleOutputCP and 1252 with GetACP. The only thing that seemed to somehow match was GetOEMCP but that might just be luck and it might still be broken in other windows languages. This code is also used in Kleopatra so it might make sense to make it public once it is demonstrated that it works on most systems.
* | | | | json: Fix crash on invalid jsonAndre Heinecke2018-07-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (process_request): Init res. Check for json object before encode and chunk. -- If json is invalid we can't read chunksize and would crash in encode and chunk.
* | | | | json: Fix uninitialized key unref in op_deleteAndre Heinecke2018-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (op_delete): Init key.
* | | | | json: Minor cleanups in cJSON.cWerner Koch2018-07-161-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/cJSON.c: Add comments on the origin of the code. (parse_string): Allocate an extra byte for safeness. (cJSON_AddItemToArray): Allo ARRAY to be NULL. Signed-off-by: Werner Koch <[email protected]>
* | | | | json: Fix buffer overflow in cJSON.cWerner Koch2018-07-161-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/cJSON.c (parse_string): Correctly detect bad hex. -- The call to parse_hex4 checks that only hex digits follow and in the error case returns 0. However, by the time of the combined check for an invalid value and the error PTR has already been set to the last hex character and thus if the end-of-string or a quote character was one of the bad hex digits the loop will miss the end of the string which does not match with the simple buffer length allocation test at the begin of the function. Signed-off-by: Werner Koch <[email protected]>
* | | | | python bindings: example scriptsBen McGinnes2018-07-132-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fixed incorrect mention of output prompt referencing secret keys when the scripts are only for exporting public keys in whole or minimised forms.
* | | | | json: Add with-sec-fprs param to exportAndre Heinecke2018-07-111-5/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (add_secret_fprs): New helper. (op_export, hlp_export): Extend for with-sec fprs. -- This is a request from Mailvelope, to import an export they need the information for which keys from the export a secret key is also available. For simplicity it is much preferred to get this information in a single call without the need to do and parse a keylisting additionally in a second native-messaging call. So we make it optional to include that info in the export.
* | | | | example scripts: python work-aroundsBen McGinnes2018-07-101-3/+3
| | | | | | | | | | | | | | | | | | | | * fixed three typos which were guaranteed to break said script.
* | | | | docs: python bindings howtoBen McGinnes2018-07-091-1251/+1235
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Complete typographic overhaul. * Removed all section level indentation since it does not affect output formatting, but might affect source code examples. * In text-mode stripped out all tabs which had crept in and replaced them with four spaces. * Updated all code examples (again) to conform with Python-mode. * Bumped version number in preparation for next release of GPG 2.2.9 and corresponding GPGME release.
* | | | | json: Add with-secret without secret onlyAndre Heinecke2018-07-091-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (op_keylist, hlp_keylist): Add "with-secret" as a flag to do a public keylist with secret information.
* | | | | tests: Add --with-secret to run-keylist.cAndre Heinecke2018-07-091-0/+6
| | | | | | | | | | | | | | | | | | | | * run-keylist.c (show_usage, main): Add --with-secret.
* | | | | doc: More explicit doc for EXTERN and LOCAL modes.Andre Heinecke2018-07-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/gpgme.texi (GPGME_KEYLIST_MODE_EXTERN), (GPGME_KEYLIST_MODE_LOCATE, GPGME_KEYLIST_MODE_LOCAL): Mention command line flags for CMS and OpenPGP Protocol. -- This might help new users coming to gnupg to understand what the flags do.