aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Add ctx flag for auto-key-locateAndre Heinecke2018-07-096-0/+67
| | | | | | | | | | | | | | | | | | | * src/context.h (gpgme_context): Add auto_key_locate. * src/engine-gpg.c (engine_gpg): Add auto_key_locate. (gpg_set_engine_flags, build_argv): Handle auto_key_locate. (gpg_release): Free auto_key_locate. * src/gpgme.c (gpgme_release): Free auto_key_locate. (gpgme_get_ctx_flag, gpgme_set_ctx_flag): Handle auto-key-locate. * doc/gpgme.texi: Document auto-key-locate flag. * tests/run-keylist.c (show_usage, main): Add --from-wkd option. -- This enables users of GPGME to control more fine grained what auto-key-locate does. Especially for WKD lookups / refreshes can this be useful. GnuPG-Bug-Id: T2917 Differential Revision: https://dev.gnupg.org/D463
* python bindings: howto examplesBen McGinnes2018-07-0713-67/+71
| | | | | * Made sure all example scripts meet PEP8 compliance. * Required fixing approx. a dozen of them in minor ways.
* qt: Handle OpenPGP Diagnostic logAndre Heinecke2018-07-051-5/+27
| | | | | * lang/qt/src/threadedjobmixin.cpp (_detail::audit_log_as_html): Handle OpenPGP audit log differently.
* cpp: Add enum mapping for GPGME_AUDIT_LOG_DIAGAndre Heinecke2018-07-052-0/+5
| | | | | * src/context.cpp (to_auditlog_flags): Map DIAG value. * src/context.h (AuditLogFlags): Add it.
* core: Add gpg auditlog to get diagnosticsAndre Heinecke2018-07-057-4/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/engine-gpg.c (engine_gpg): Add diagnostics member. (gpg_release): Release diagnostics data. (gpg_new): Set up logger-fd and diagnostics. (gpg_getauditlog): New. Copy diagnostics to a user data. (engine_ops): Add getauditlog. * src/engine-gpgsm.c (gpgsm_getauditlog): Return not implemented for GPGME_AUDITLOG_DIAG. * src/getauditlog.c (getauditlog_start): Don't reset engine for diagnostics. * src/gpgme.h.in (GPGME_AUDITLOG_DIAG): New. (GPGME_AUDITLOG_DEFAULT): New alias to 0. * tests/run-decrypt.c (show_usage, main): Add --diagnostics. * doc/gpgme.texi(Additional Logs): Document getauditlog. -- This enables users of GPGME to get more verbose information from gpg which can assist users in figuring out a problem that was before hidden behind a generalized error like "Decryption Failed". For GPGSM it is not yet available as it is problematic to get it properly in server mode and GPGSM already had the original audit log mechanism in place. GPGME_AUDITLOG_DEFAULT was added for a more explicit documentation.
* cpp: Fix memory of DecryptionResult::symkeyAlgoAndre Heinecke2018-07-041-0/+7
| | | | | * lang/cpp/src/decryptionresult.cpp (Private, ~Private): strdup the symkey algo.
* json: Add keylist mode locateAndre Heinecke2018-07-041-0/+6
| | | | | | | | * src/gpgme-json.c (op_keylist, hlp_keylist): Add locate. -- The same rationale for the KEYLIST_MODE_LOCATE in GPGME also applies here. It makes the API a little less magic.
* python bindings: scheming serpentsBen McGinnes2018-07-011-69/+17
| | | | | | * Apparently I am wrong and Scheme is the new Python after all. * Non-import related PEP8 compliance must wait for another day, though the other PEP8 fixes remain.
* python bindings: gpg.coreBen McGinnes2018-07-011-27/+79
| | | | | | | | | * Changed id/else statements to a more pythonic form from scheme masquerading as python - sorry Justus, it had to go ;). * With the added bonus of enabling PEP8 compliance in those sections. * Fixed remaining PEP8 compliance issues with the exception of the imports at the beginning of the file (changing those will break the entire module, so we'll cope with it as it is).