aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* core: New function gpgme_op_createsubkey.Werner Koch2016-09-144-27/+157
| | | | | | | | | | | | * src/genkey.c (createsubkey_start): New. (gpgme_op_createsubkey_start, gpgme_op_createsubkey): New. * src/gpgme.def, src/libgpgme.vers: Add them. * src/engine-gpg.c (gpg_createkey): Factor some code out to ... (gpg_add_algo_usage_expire): new. (gpg_addkey): Implement. * tests/run-genkey.c: Add option --addkey. Signed-off-by: Werner Koch <[email protected]>
* core: Use const char * where appropriate.Werner Koch2016-09-138-25/+35
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: Cast away the common const problem with spawn and argv.Werner Koch2016-09-132-5/+5
| | | | | | * src/dirinfo.c (read_gpgconf_dirs): Use a cast to assignd to ARGV. Signed-off-by: Werner Koch <[email protected]>
* core: Fix condition-always-true warning in trace macro.Werner Koch2016-09-131-1/+1
| | | | | | * src/data-compat.c (old_user_read): Cast AMT. Signed-off-by: Werner Koch <[email protected]>
* core: Mark unused function args.Werner Koch2016-09-1320-1/+86
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: Do not pass const char* to functions taking a char*.Werner Koch2016-09-135-8/+20
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_create_key.Werner Koch2016-09-1310-58/+413
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/engine-backend.h (engine_ops): Change prototype of genkey. * src/engine-gpgsm.c (gpgsm_genkey): Change accordingly. * src/engine-gpg.c (gpg_genkey): Change it to a dispatcher. (gpg_createkey_from_param): New for the old functionality. (gpg_createkey_legacy): New. Stub for now. (gpg_createkey): New. (gpg_addkey): New. Stub for now. (gpg_adduid): New. Stub for now. * src/engine.c (_gpgme_engine_op_genkey): Add new args. * src/genkey.c (op_data_t): Add field ERROR_CODE. (parse_error): New. (genkey_status_handler): Parse ERROR status line. (genkey_start): Use NULL/0 for the new args. (createkey_start): New. (gpgme_op_createkey_start, gpgme_op_createkey): New. * src/gpgme.def, src/libgpgme.vers: Add gpgme_op_createkey_start and gpgme_op_createkey. * src/gpgme.h.in (_gpgme_op_genkey_result): Add fields PUBKEY and SECKEY. (GPGME_CREATE_SIGN): New. (GPGME_CREATE_ENCR): New. (GPGME_CREATE_CERT): New. (GPGME_CREATE_AUTH): New. (GPGME_CREATE_NOPASSWD): New. (GPGME_CREATE_SELFSIGNED): New. (GPGME_CREATE_NOSTORE): New. (GPGME_CREATE_WANTPUB): New. (GPGME_CREATE_WANTSEC): New. (GPGME_CREATE_FORCE): New. * tests/run-genkey.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add it. -- This function uses the new --quick-gen-key API of gpg. A limited compatibility mode to use older gpg versions and gpgsm will eventually be provided. Not all flags are currently implemented. ./run-genkey --unprotected --force [email protected] Create a new standard key with the given user id. --force is used to allow creating more than one key with that user id in the keyring. ./run-genkey --unprotected --force \ [email protected] default default 2145826800 Creates a new standard key with an expiration date of 2037-12-31. ./run-genkey --unprotected --force \ [email protected] future-default default 2145826800 Create a standard key using the fugure default algorithms. Signed-off-by: Werner Koch <[email protected]>
* core,cpp: Extend the TOFU information.Werner Koch2016-09-073-10/+40
| | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (struct _gpeme_tofu_info): Rename FIRSTSEEN to SIGNFIRST and LASTSEEN to SIGNLAST. Add ENCRFIST and ENCRLAST. * src/keylist.c (parse_tfs_record): Parse to ENCRFIRST and ENCRLAST. * src/verify.c (parse_tofu_stats): Ditto. * tests/run-keylist.c (main): Adjust and print encrypt stats. * tests/run-verify.c (print_result): Ditto. * lang/cpp/src/tofuinfo.h (TofuInfo): Rename firstSeen to signFirst and lastSeen to signLast. Add encrCount, encrFirst and encrLast. * lang/cpp/src/tofuinfo.cpp (encrCount, encrFirst, encrLast): New. -- The latest GnuPG commits have the needed changes but we also allow the use of currently released GnuPG version. Signed-off-by: Werner Koch <[email protected]>
* core: Check for gpg version for loopback modeAndre Heinecke2016-09-061-1/+1
| | | | | | | | | | * src/engine-gpg.c (build_argv): Check for version 2.1.0 before adding pinentry-mode. -- This is a compatibility fix for older versions that don't support this flag which would otherwise result in an invalid argument error.
* core: Fix passphrase cb for mixed sym encryptAndre Heinecke2016-09-062-3/+2
| | | | | | | | | | * src/encrypt.c (encrypt_start): Handle SYMMETRIC flag. * src/encrypt-sign.c (encrypt_sign_start): Ditto. -- This causes the passphrace command handler to be properly registered which in turn will result in the passphrase callback beeing called.
* core: Add GPGME_KEYLIST_MODE_WITH_TOFU.Werner Koch2016-08-253-6/+104
| | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_TOFU): New. * src/engine-gpg.c (gpg_keylist_build_options): Use that. * src/keylist.c: Include limits.h. (parse_tfs_record): New. (keylist_colon_handler): Support TFS record. * tests/run-keylist.c: Include time.h. (isotimestr): New. (main): Add option --tofu. Print TOFU info. * tests/run-verify.c: Include time.h. (isotimestr): New. (print_result): Use isotimestr for TOFU dates. Signed-off-by: Werner Koch <[email protected]>
* core: Adjust for TOFU_STATS change in gnupg 2.1.16.Werner Koch2016-08-242-9/+5
| | | | | | | | | | | | | | | * src/gpgme.h.in (_gpgme_tofu_info): Change 'firstseen' and 'lastseen' to a timestamp value. * src/verify.c (parse_tofu_stats): Do not cap these values at UINT_MAX. -- Using an unsigned long here is okay: We will never get an error and even on machines where unsigned long is 32 bit (e.g. Windows64) this allows us to operate until 2106. By then Windows will be a footnote in history or Windows128 has changed that type to something larger than 32 bit ;-) Signed-off-by: Werner Koch <[email protected]>
* core: Set the 'encrcount' field in gpgme_tofu_info_t.Werner Koch2016-08-241-2/+8
| | | | | | * src/verify.c (parse_tofu_stats): Set ENCRCOUNT field. Signed-off-by: Werner Koch <[email protected]>
* core: Put the protocol into a TOFU created key object.Werner Koch2016-08-231-2/+3
| | | | | | | | * src/verify.c (parse_tofu_user): Add arg 'protocol' and store it in the KEY. (_gpgme_verify_status_handler): Pass protocol. Signed-off-by: Werner Koch <[email protected]>
* core: Change the way TOFU information are represented.Werner Koch2016-08-235-95/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (struct _gpgme_signature): Remove field 'tofu'. Add field 'key'. (struct _gpgme_key): Add field 'fpr'. (struct _gpgme_user_id): Add field 'tofu'. (struct _gpgme_tofu_info): Remove fields 'address' and 'fpr'. * src/key.c (gpgme_key_unref): Release TOFU and FPR. * src/keylist.c (keylist_colon_handler): Store the fingerprint of the first subkey also in KEY. * src/verify.c (release_tofu_info): Remove. (release_op_data): Release KEY. (parse_tofu_user): Rewrite for new data structure. (parse_tofu_stats): Ditto. (parse_tofu_stats_long): Ditto. * tests/run-verify.c (print_result): Ditto. * tests/run-keylist.c (main): Print more fields. -- TOFU information are now associated with the user ID and not with a separate object. Note that this breaks code relying on the former non-released TOFU feature. The C++ bindings won't work right now. Signed-off-by: Werner Koch <[email protected]>
* core: Extend gpgme_user_id_t with 'address'.Werner Koch2016-08-235-25/+62
| | | | | | | | | * src/mbox-util.c, src/mbox-util.h: Adjust for use in gpgme. * src/Makefile.am (main_sources): Add mbox-util. * src/key.c (_gpgme_key_append_name): Set 'address' field of uid. (gpgme_key_unref): Free it. Signed-off-by: Werner Koch <[email protected]>
* core: New code for parsing mail addresses.Werner Koch2016-08-222-0/+268
| | | | | | | | | | | | | | * src/mbox-util.c: New. * src/mbox-util.h: New. -- The files haven been copied verbatim from GnuPG 2.1.15 commit 54245979e691129ed9d3a6c642087fb8d3227449 after the license has been changed in GnuPG. We need this file too match GnuPG's idea of a mail address. Signed-off-by: Werner Koch <[email protected]>
* core: Add new items for gpgme_get_dirinfo.Werner Koch2016-08-221-3/+65
| | | | | | | | | | | | | * src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New. (WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New (WANT_DIRMNGR_SOCKET): New. (dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir', 'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'. (parse_output): Set these fields. (get_gpgconf_item): Return them. (gpgme_get_dirinfo): Likewise. Signed-off-by: Werner Koch <[email protected]>
* core: Base gpgme_get_dirinfo(uiserver-socket) on the socket dir.Werner Koch2016-08-221-10/+23
| | | | | | | * src/dirinfo.c (dirname_len): New. (parse_output): Change computation of UISRV_SOCKET. Signed-off-by: Werner Koch <[email protected]>
* core: New commands --lang and --have-lang for gpgme-configWerner Koch2016-08-211-10/+25
| | | | | | | | * configure.ac (GPGME_CONFIG_AVAIL_LANG): New ac_subst. * src/gpgme-config.in (avail_lang): Add commands --lang and --have-lang. Signed-off-by: Werner Koch <[email protected]>
* core: Remove (now) useless diagnosticAndre Heinecke2016-08-181-2/+0
| | | | | | | | | | | * src/w32-io.c(_gpgme_io_spawn): Remove spawnhelper not found diagnostic. -- When spawnhelper is not found the error is now catched before the CreateProcess call so the added diagnostic in bb2d11c (which was not helpful because the value for spawnhelper would be NULL in that case) is now no longer needed.
* core: Fail loudly in case w32 spawner not foundAndre Heinecke2016-08-181-0/+26
| | | | | | | | | | | | | | | | * src/w32-io.c (_gpgme_io_spawn): Show a message box in case gpgme-w32spawn.exe not found. -- Otherwise every engine call will just fail with unsupported protocol. Even in the debug output the problem was not made clear because CreateProcess will fail with error code 87 (Invalid Parameter) because spawnhelper is NULL. The helpful error message for ERROR_INVALID_PARAMETER would have been: "is 'NULL' correctly installed" As GpgME basically becomes useless on Windows without the spawnhelper we want to fail very loud in that case.
* core: New global flag "require-gnupg".Werner Koch2016-08-163-0/+39
| | | | | | | | | | | * src/gpgme.c (gpgme_set_global_flag): Add flag. * src/engine.c (engine_minimal_version): New variable. (_gpgme_set_engine_minimal_version): New function. (gpgme_get_engine_info): Check that flag. * tests/run-keylist.c (main): New option --require-gnupg. Signed-off-by: Werner Koch <[email protected]>
* core: Simplify setting of dummy versions.Werner Koch2016-08-165-14/+42
| | | | | | | | | | | | | | | | * src/engine.c (_gpgme_engine_info_release): Do not assert but free FILE_NAME. (gpgme_get_engine_info): Provide default for VERSION and REQ_VERSION. Use calloc instead of malloc. (_gpgme_set_engine_info): Ditto. * src/engine-assuan.c (llass_get_version): Return NULL. (llass_get_req_version): Ditto. * src/engine-spawn.c (engspawn_get_version): Ditto. (engspawn_get_req_version): Ditto. * src/engine-uiserver.c (uiserver_get_version): Ditto. (uiserver_get_req_version): Ditto. Signed-off-by: Werner Koch <[email protected]>
* core: Make use of the "size-hint" in engine-gpg.Werner Koch2016-08-121-2/+43
| | | | | | | | | | | | | | * src/engine-gpg.c: Include data.h. (add_input_size_hint): New. (gpg_decrypt, gpg_encrypt, gpg_encrypt_sign, gpg_sign) (gpg_verify): Call new function, * tests/run-encrypt.c (status_cb): Print to stderr. (progress_cb): New.o (main): Add option --progress. Print full-status lines. Provide a size for the input data. Signed-off-by: Werner Koch <[email protected]>
* core: Add gpgme_data_set_flag to add more meta data to data objects.Werner Koch2016-08-127-0/+67
| | | | | | | | | | | * src/gpgme.h.in (gpgme_data_set_flag): New public function. * src/data.c (gpgme_data_set_flag): New. (_gpgme_data_get_size_hint): New. * src/data.h (strucy gpgme_data): Add field 'size_hint'. * src/gpgme.def, src/libgpgme.vers: Add new function. * src/conversion.c (_gpgme_string_to_off): New. Signed-off-by: Werner Koch <[email protected]>
* core: Do not identify PNG files as PGP signatures.Werner Koch2016-08-101-0/+5
| | | | | | | | * src/data-identify.c (next_openpgp_packet): Blacklist PNG files. -- GnuPG-bug-id: 2314 Signed-off-by: Werner Koch <[email protected]>
* core: Handle ENCRYPT_SYMMETRIC also for sig & encAndre Heinecke2016-08-101-4/+7
| | | | | * src/engine-gpg.c (gpg_encrypt_sign): Handle ENCRYPT_SYMMETRIC flag.
* core: Ensure err is initalized in gpg_encryptAndre Heinecke2016-08-101-1/+1
| | | | * src/engine-gpg.c (gpg_encrypt): Initialize err.
* core: Add support for mixed symmetric and asym encAndre Heinecke2016-08-092-4/+8
| | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_encrypt_flags_t): New flag GPGME_ENCRYPT_SYMMETRIC. * src/engine-gpg.c (gpg_encrypt): Also add --symmetric if the flag is given. * NEWS: Mention new flag. * tests/run-encrypt.c (show_usage): Extend for --symmetric. (main): Handle --symmetric. (main): Set passphrase_cb in loopback mode. (main): Fix encrypt call if no recipients are given. * tests/gpg/t-encrypt-mixed.c: New. * tests/gpg/Makefile.am (c_tests): Add new test. * doc/gpgme.texi: Document new flag.
* core: Let GPGME_PROTOCOL_ASSUAN pass Assuan comments through.Werner Koch2016-08-081-0/+1
| | | | | | | | * src/engine-assuan.c (llass_new): Set ASSUAN_CONVEY_COMMENTS, -- GnuPG-bug-id: 2429 Signed-off-by: Werner Koch <[email protected]>
* core: Extend gpgme_subkey_t to carry the keygrip.Werner Koch2016-08-044-7/+37
| | | | | | | | | | | | * src/gpgme.h.in (struct _gpgme_subkey): Add file 'keygrip'. * src/key.c (gpgme_key_unref): Free KEYGRIP. * src/keylist.c (keylist_colon_handler): Parse GRP records. * src/engine-gpg.c (gpg_keylist_build_options): Do not use --with-fingerprint options for gpg versions >= 2.1.15. * tests/run-keylist.c (main): Print subkeys and keygrips. Signed-off-by: Werner Koch <[email protected]>
* src: Fix dummy engine versions.Justus Winter2016-07-283-6/+6
| | | | | | | | | | | | | | | Previously, 'gpgme_engine_check_version' failed for these protocols because the version parser failed to parse the dummy versions. * src/engine-assuan.c (llass_get_version): Use a version triple that the parser can understand. (llass_get_req_version): Likewise. * src/engine-spawn.c (engspawn_get_version): Likewise. (engspawn_get_req_version): Likewise. * src/engine-uiserver.c (uiserver_get_version): Likewise. (uiserver_get_req_version): Likewise. Signed-off-by: Justus Winter <[email protected]>
* Fix including nil bytes in keylist output.Ben Kibbey2016-07-191-6/+6
| | | | | | * src/gpgme-tool.c (cmd_keylist,gt_result): use strlen(). Signed-off-by: Ben Kibbey <[email protected]>
* core: New GPGME_DATA_ENCODING_MIME.Werner Koch2016-07-134-4/+30
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_DATA_ENCODING_MIME): New. * src/data.c (gpgme_data_set_encoding): Adjust check. * src/engine-gpg.c (have_gpg_version): New. (gpg_encrypt, gpg_encrypt_sign): Pass flag '--mimemode'. (gpg_sign): Ditto. * lang/cpp/src/data.h (GpgME): Add MimeEncoding. * lang/cpp/src/data.cpp (encoding, setEncoding): Support MimeEncoding. * src/gpgme-tool.c (server_data_encoding): Add flag --mime. -- This feature allows an application to declare that the encrypted or signed data is a valid MIME part. What is missing is a way to return that information to the application after decryption/verification. This can be done by setting the encoding of the output data object; however this requires some internal additions to our processing model. Signed-off-by: Werner Koch <[email protected]>
* core: Pass the engine's version string to the engine's new function.Werner Koch2016-07-139-9/+42
| | | | | | | | | | | | | | | | | * src/engine-backend.h (engine_ops): Add arg 'version' to NEW. * src/engine-assuan.c (llass_new): Add dummy arg 'version'. * src/engine-g13.c (g13_new): Ditto. * src/engine-gpgconf.c (gpgconf_new): Ditto. * src/engine-gpgsm.c (gpgsm_new): Ditto. * src/engine-spawn.c (engspawn_new): Ditto. * src/engine-uiserver.c (uiserver_new): Ditto. * src/engine.c (_gpgme_engine_new): Pass version string to the new function. * src/engine-gpg.c (struct engine_gpg): Add field 'version'. (gpg_new): Add arg 'version'. (gpg_release): Free VERSION. Signed-off-by: Werner Koch <[email protected]>
* src: Fix error handling.Justus Winter2016-07-081-2/+7
| | | | | | | * src/encrypt.c (encrypt_status_handler): Fix error handling, || conflates errors. Signed-off-by: Justus Winter <[email protected]>
* w32: Fallback to 2.1 reg key for gpgconf searchAndre Heinecke2016-07-051-3/+14
| | | | | | | | | * src/w32-util.c (_gpgme_get_gpgconf_path): Fallback to 2.1 installer registry key. -- Finding gpgconf is utterly important so we should be as compatible as possible.
* core: Clarify documentation of tofu_stats addressAndre Heinecke2016-07-011-1/+6
| | | | | | | | * src/gpgme.h.in: Mention that Address is not always in addr-spec. -- The old comment made it look like you could always expect the address to be parsable as a mailbox address.
* core: Fix identify for armored detached sigsAndre Heinecke2016-07-011-1/+1
| | | | | | | | | | | | | * src/data-identify.c (basic_detection): Return signature for signature. -- This causes identify to return signature for both binary and ascii armored detached signatures where previously it would have returned signed for armored signatures and signature for binary signatures. GnuPG-Bug-Id: 2314
* core: Add closer inspection of "PGP MESSAGE".Werner Koch2016-06-231-2/+27
| | | | | | | * src/data-identify.c (inspect_pgp_message): New. (basic_detection): Un-const arg DATA. Call inspect_pgp_message. Signed-off-by: Werner Koch <[email protected]>
* core: Add a base 64 decoder.Werner Koch2016-06-233-1/+272
| | | | | | | | | | | | | | * src/b64dec.c: New. Taken from gnupg. Prefix function names with _gpgme_ and change to use standard C malloc functions. * src/util.h.h (struct b64state): New. * src/Makefile.am (main_sources): Add file. -- The file b64dec.c has been taken from gnupg commit e430ff6ad0b7dcfcebd92b825dd5168205447ff3 Signed-off-by: Werner Koch <[email protected]>
* core: Detect compressed signed OpenPGP data.Werner Koch2016-06-221-9/+18
| | | | | | | | * src/data-identify.c (next_openpgp_packet): Allow partial encoding. (pgp_binary_detection): Handle compressed packets. -- Signed-off-by: Werner Koch <[email protected]>
* tests: Add new test tool run-identify.Werner Koch2016-06-211-0/+2
| | | | | | | | * src/gpgme-tool.c (gt_identify): Add new strings. * tests/run-identify.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add run-identify. Signed-off-by: Werner Koch <[email protected]>
* core: Enhance gpgme_data_identify to detect binary PGP messages.Werner Koch2016-06-212-1/+231
| | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_DATA_TYPE_PGP_ENCRYPTED): New. (GPGME_DATA_TYPE_PGP_SIGNATURE): New. * src/data-identify.c: Add enum for OpenPGP packet types. (buf32_to_ulong): New. (next_openpgp_packet): New. Based on the gnupg/kbx/keybox-openpgp.c implementation and relicensed to LGPL by g10 Code. (pgp_binary_detection): New. (basic_detection): Call pgp_binary_detection instead of returning unknown. Signed-off-by: Werner Koch <[email protected]>
* core: Make sure FD_SET is not used with an out of range fd.Werner Koch2016-06-141-0/+12
| | | | | | | * src/posix-io.c (_gpgme_io_select): Check for FD out of range. -- Signed-off-by: Werner Koch <[email protected]>
* core: Set notation flags for verify.Werner Koch2016-06-013-8/+42
| | | | | | | | | | | | | * src/gpgme.h.in (GPGME_STATUS_NOTATION_FLAGS): New. * src/status-table.c (status_table): Add new status. * src/verify.c (parse_notation): Handle flags. Also fix NOTATION_DATA in case gpg would not percent-escape spaces. (_gpgme_verify_status_handler): Handle flags. * tests/run-verify.c (print_result): Print notaion data. -- Note that this does only work with the soon to be released GnuPG 2.1.13.
* Speedup closing of fds before exec.Werner Koch2016-05-271-7/+47
| | | | | | | | * src/posix-io.c [__linux__]: Include dirent.h. (get_max_fds) [__linux__]: Try to figure out the highest used fd. -- Signed-off-by: Werner Koch <[email protected]>
* src: Fix typo.Justus Winter2016-05-271-1/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* Improve comments.Justus Winter2016-05-271-4/+6
| | | | | | | | * src/gpgme.h.in (gpgme_data_seek_cb_t, gpgme_data_seek): Clarify that these functions return the new offset. (gpgme_data_release_cb_t): Fix name of parameter. Signed-off-by: Justus Winter <[email protected]>