├── lang ├── cl │ ├── .gitignore │ ├── Makefile.am │ ├── gpgme-grovel.lisp │ ├── gpgme.asd.in │ ├── README │ ├── gpgme-package.lisp │ └── ChangeLog-2011 ├── js │ ├── .babelrc │ ├── DemoExtension │ │ ├── testicon.png │ │ ├── popup.html │ │ ├── manifest.json │ │ ├── ui.css │ │ ├── Makefile.am │ │ ├── entry.js │ │ └── mainui.html │ ├── BrowserTestExtension │ │ ├── testicon.png │ │ ├── popup.html │ │ ├── manifest.json │ │ ├── unittests.html │ │ ├── longTests.html │ │ ├── browsertest.html │ │ ├── runbrowsertest.js │ │ ├── rununittests.js │ │ ├── setup_testing.js │ │ ├── popup.js │ │ ├── Makefile.am │ │ ├── testkey.pub │ │ ├── testkey2.pub │ │ ├── tests │ │ │ ├── KeyInfos.js │ │ │ ├── longRunningTests.js │ │ │ ├── signTest.js │ │ │ └── startup.js │ │ └── testkey.sec │ ├── package.json │ ├── jsdoc.conf │ ├── build_extensions.sh │ ├── src │ │ ├── Makefile.am │ │ └── index.js │ ├── Makefile.am │ ├── .eslintrc.json │ ├── webpack.conf_unittests.js │ ├── webpack.conf.js │ └── jsdoc_index.md ├── README └── Makefile.am ├── tests ├── t-data-1.txt ├── opassuan │ ├── .gitignore │ └── Makefile.am ├── json │ ├── t-delete.out.json │ ├── t-version.in.json │ ├── t-createkey.out.json │ ├── t-config.in.json │ ├── t-encrypt.out.json │ ├── final.test │ ├── initial.test │ ├── t-encrypt-sign.out.json │ ├── t-chunking.out.json │ ├── t-sign.out.json │ ├── t-delete.in.json │ ├── t-export.in.json │ ├── t-createkey.in.json │ ├── t-config-opt.in.json │ ├── t-keylist.in.json │ ├── t-chunking.in.json │ ├── t-config-opt.out.json │ ├── t-keylist-revokers.in.json │ ├── t-keylist-secret.in.json │ ├── t-export-secret-info.in.json │ ├── t-sign.in.json │ ├── t-encrypt.in.json │ ├── t-encrypt-sign.in.json │ ├── t-verify.in.json │ ├── t-version.out.json │ ├── t-sig-notations.in.json │ ├── t-decrypt.out.json │ ├── t-decrypt.in.json │ ├── t-config.out.json │ ├── t-import.out.json │ ├── t-decrypt-verify.in.json │ ├── key-with-revokers.asc │ ├── t-verify.out.json │ ├── t-import.in.json │ ├── t-export.out.json │ ├── t-export-secret-info.out.json │ ├── t-decrypt-verify.out.json │ ├── t-sig-notations.out.json │ └── t-keylist.out.json ├── t-data-2.txt ├── gpg │ ├── geheim.txt │ ├── final.test │ ├── initial.test │ ├── 13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F │ ├── 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD │ ├── 76F7E2B35832976B50A27A282D9B87E44577EB66 │ ├── 7A030357C0F253A5BBCD282FFC4E521B37558F5C │ ├── A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD │ ├── gpg.conf.in │ ├── ownertrust.txt │ ├── .gitignore │ ├── cipher-no-sig.asc │ ├── cipher-1.asc │ ├── pinentry │ ├── cipher-2.asc │ ├── cipher-3.asc │ ├── pubkey-1.asc │ ├── seckey-1.asc │ ├── mkdemodirs.in │ ├── t-wait.c │ ├── t-thread-keylist.c │ ├── t-decrypt.c │ ├── t-encrypt.c │ ├── t-export.c │ ├── t-encrypt-sym.c │ └── t-file-name.c ├── gpgsm │ ├── initial.test │ ├── cert_dfn_pca01.der │ ├── cert_dfn_pca15.der │ ├── final.test │ ├── cert_g10code_test1.der │ ├── .gitignore │ ├── 32100C27173EF6E9C4E9A25D3D69F86D37A4F939 │ ├── t-encrypt.c │ ├── t-export.c │ ├── Makefile.am │ ├── t-decrypt.c │ ├── cms-decrypt.c │ └── t-support.h ├── .gitignore ├── Makefile.am ├── start-stop-agent ├── t-version.c └── run-receive-keys.c ├── src ├── versioninfo.rc.in ├── .gitignore ├── gpgme.pc.in ├── gpgme-glib.pc.in ├── mbox-util.h ├── sema.h ├── stpcpy.c ├── parsetlv.h ├── sys-util.h ├── data-fd.c ├── progress.c ├── data-estream.c ├── data-user.c ├── data-stream.c ├── get-env.c ├── parsetlv.c ├── wait.h ├── getauditlog.c └── signers.c ├── doc ├── .gitignore ├── examples │ ├── gpgme-mozilla.json │ └── gpgme-chrome.json ├── DCO ├── gpgme-json.texi └── Makefile.am ├── conf └── whatisthis ├── autogen.rc ├── ChangeLog ├── m4 ├── ltversion.m4 ├── glibc21.m4 └── ChangeLog-2011 ├── .gitignore ├── tools └── Makefile.am ├── THANKS ├── LICENSES ├── gpgme.spec.in ├── gpgme.txt ├── README.GIT ├── acinclude.m4 └── AUTHORS /lang/cl/.gitignore: -------------------------------------------------------------------------------- 1 | gpgme.asd 2 | -------------------------------------------------------------------------------- /tests/t-data-1.txt: -------------------------------------------------------------------------------- 1 | Just GNU it! 2 | -------------------------------------------------------------------------------- /lang/js/.babelrc: -------------------------------------------------------------------------------- 1 | { "presets": ["es2015"] } 2 | -------------------------------------------------------------------------------- /tests/opassuan/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | t-command 4 | -------------------------------------------------------------------------------- /tests/json/t-delete.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "success": true 3 | } 4 | -------------------------------------------------------------------------------- /tests/json/t-version.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "version" 3 | } 4 | -------------------------------------------------------------------------------- /tests/json/t-createkey.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "fingerprint": "*" 3 | } 4 | -------------------------------------------------------------------------------- /tests/t-data-2.txt: -------------------------------------------------------------------------------- 1 | Just GNU it! 2 | Just GNU it! 3 | Just GNU it! 4 | -------------------------------------------------------------------------------- /tests/gpg/geheim.txt: -------------------------------------------------------------------------------- 1 | Wenn Sie dies lesen können, ist es wohl nicht 2 | geheim genug. 3 | -------------------------------------------------------------------------------- /src/versioninfo.rc.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/src/versioninfo.rc.in -------------------------------------------------------------------------------- /tests/json/t-config.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "config", 3 | "component": "gpg" 4 | } 5 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | gpgme.info 2 | gpgme.info-1 3 | gpgme.info-2 4 | stamp-vti 5 | version.texi 6 | -------------------------------------------------------------------------------- /tests/gpg/final.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${top_srcdir}/tests/start-stop-agent --stop 4 | exit 0 5 | -------------------------------------------------------------------------------- /tests/json/t-encrypt.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "ciphertext", 3 | "base64": true 4 | } 5 | -------------------------------------------------------------------------------- /tests/gpg/initial.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${top_srcdir}/tests/start-stop-agent --start 4 | exit 0 5 | -------------------------------------------------------------------------------- /tests/gpgsm/initial.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${top_srcdir}/tests/start-stop-agent --start 4 | exit 0 5 | -------------------------------------------------------------------------------- /tests/json/final.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${top_srcdir}/tests/start-stop-agent --stop 4 | exit 0 5 | -------------------------------------------------------------------------------- /tests/json/initial.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${top_srcdir}/tests/start-stop-agent --start 4 | exit 0 5 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | gpgme-config 4 | gpgme-tool 5 | gpgme.h 6 | versioninfo.rc 7 | *.la 8 | -------------------------------------------------------------------------------- /tests/gpgsm/cert_dfn_pca01.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/tests/gpgsm/cert_dfn_pca01.der -------------------------------------------------------------------------------- /tests/gpgsm/cert_dfn_pca15.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/tests/gpgsm/cert_dfn_pca15.der -------------------------------------------------------------------------------- /tests/gpgsm/final.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${top_srcdir}/tests/start-stop-agent --stop 4 | 5 | exit 0 6 | -------------------------------------------------------------------------------- /tests/json/t-encrypt-sign.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "ciphertext", 3 | "base64": false 4 | } 5 | -------------------------------------------------------------------------------- /tests/json/t-chunking.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "base64": true, 3 | "more": true, 4 | "response": "*" 5 | } 6 | -------------------------------------------------------------------------------- /lang/js/DemoExtension/testicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/lang/js/DemoExtension/testicon.png -------------------------------------------------------------------------------- /tests/gpgsm/cert_g10code_test1.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/tests/gpgsm/cert_g10code_test1.der -------------------------------------------------------------------------------- /tests/json/t-sign.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "signature", 3 | "base64": false, 4 | "data": "*" 5 | } 6 | -------------------------------------------------------------------------------- /tests/json/t-delete.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "delete", 3 | "key": "E8143C489C8D41124DC40D0B47AF4B6961F04784" 4 | } 5 | -------------------------------------------------------------------------------- /tests/json/t-export.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "export", 3 | "keys": "victor@example.org", 4 | "armor": true 5 | } 6 | -------------------------------------------------------------------------------- /tests/json/t-createkey.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "createkey", 3 | "userid": "foo@bar.baz", 4 | "algo": "rsa1024" 5 | } 6 | -------------------------------------------------------------------------------- /conf/whatisthis: -------------------------------------------------------------------------------- 1 | Configuration files may go here. Note that config.h.in is 2 | auto-generated so that this file is not in git. 3 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/testicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/lang/js/BrowserTestExtension/testicon.png -------------------------------------------------------------------------------- /tests/json/t-config-opt.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "config_opt", 3 | "component": "gpg", 4 | "option": "default-key" 5 | } 6 | -------------------------------------------------------------------------------- /tests/json/t-keylist.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "keylist", 3 | "keys": [ "zulu@example.net" ], 4 | "with-secret": false 5 | } 6 | -------------------------------------------------------------------------------- /tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F -------------------------------------------------------------------------------- /tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD -------------------------------------------------------------------------------- /tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66 -------------------------------------------------------------------------------- /tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C -------------------------------------------------------------------------------- /tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/gpgme/master/tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD -------------------------------------------------------------------------------- /tests/json/t-chunking.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "keylist", 3 | "keys": ["alpha@example.net", "bravo@example.net"], 4 | "chunksize": 64 5 | } 6 | -------------------------------------------------------------------------------- /tests/json/t-config-opt.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "option": { 3 | "name": "default-key", 4 | "argname": "NAME" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/json/t-keylist-revokers.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "keylist", 3 | "keys": [ "key-with-revokers@example.net" ], 4 | "with-secret": false 5 | } 6 | -------------------------------------------------------------------------------- /tests/gpg/gpg.conf.in: -------------------------------------------------------------------------------- 1 | # This is required for t-sig-notations. 2 | no-force-v3-sigs 3 | 4 | # This is required for t-edit-sign. 5 | allow-weak-key-signatures 6 | -------------------------------------------------------------------------------- /tests/json/t-keylist-secret.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "keylist", 3 | "keys": [ "bravo@example.net", "alpha@example.net" ], 4 | "with-secret": true 5 | } 6 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | run-export 4 | run-import 5 | run-keylist 6 | run-sign 7 | run-verify 8 | t-data 9 | t-engine-info 10 | t-version 11 | -------------------------------------------------------------------------------- /tests/json/t-export-secret-info.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "export", 3 | "keys": "alpha@example.net", 4 | "armor": true, 5 | "with-sec-fprs":true 6 | } 7 | -------------------------------------------------------------------------------- /tests/gpg/ownertrust.txt: -------------------------------------------------------------------------------- 1 | # List of assigned trustvalues, created Mi 08 Feb 2023 09:52:04 CET 2 | # (Use "gpg --import-ownertrust" to restore them) 3 | A0FF4590BB6122EDEF6E3C542D727CC768697734:6: 4 | -------------------------------------------------------------------------------- /lang/js/DemoExtension/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/json/t-sign.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "sign", 3 | "keys": "A0FF4590BB6122EDEF6E3C542D727CC768697734", 4 | "sender": "alpha@example.net", 5 | "data": "Hello world", 6 | "armor": true, 7 | "base64": false 8 | } 9 | -------------------------------------------------------------------------------- /tests/json/t-encrypt.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "encrypt", 3 | "keys": ["bravo@example.net", "alpha@example.net"], 4 | "data": "Hello world", 5 | "file_name": "test.txt", 6 | "armor": false, 7 | "always-trust": true 8 | } 9 | -------------------------------------------------------------------------------- /doc/examples/gpgme-mozilla.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gpgmejson", 3 | "description": "Integration with GnuPG", 4 | "path": "/usr/bin/gpgme-json", 5 | "type": "stdio", 6 | "allowed_extensions": [ 7 | "jid1-AQqSMBYb0a8ADg@jetpack" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /tests/gpgsm/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | cms-decrypt 4 | cms-keylist 5 | gpgsm.conf 6 | private-keys-v1.d 7 | pubring.kbx 8 | pubring.kbx~ 9 | t-decrypt 10 | t-encrypt 11 | t-export 12 | t-genkey 13 | t-import 14 | t-keylist 15 | t-sign 16 | t-verify 17 | trustlist.txt 18 | -------------------------------------------------------------------------------- /tests/json/t-encrypt-sign.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "encrypt", 3 | "keys": ["alpha@example.net", "victor@example.org"], 4 | "signing_keys": ["A0FF4590BB6122EDEF6E3C542D727CC768697734"], 5 | "data": "Hello world", 6 | "armor": true, 7 | "always-trust": true 8 | } 9 | -------------------------------------------------------------------------------- /doc/examples/gpgme-chrome.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gpgmejson", 3 | "description": "Integration with GnuPG", 4 | "path": "/usr/bin/gpgme-json", 5 | "type": "stdio", 6 | "allowed_origins": [ 7 | "chrome-extension://kajibbejlbohfaggdiogboambcijhkke/" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /autogen.rc: -------------------------------------------------------------------------------- 1 | # autogen.sh configuration for GPGME -*- sh -*- 2 | 3 | case "$myhost" in 4 | w32) 5 | configure_opts="" 6 | ;; 7 | 8 | amd64) 9 | configure_opts="" 10 | ;; 11 | esac 12 | 13 | 14 | final_info="mkdir build && cd build && ../configure --enable-maintainer-mode && make" 15 | -------------------------------------------------------------------------------- /tests/json/t-verify.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "verify", 3 | "data": "Hello world", 4 | "signature": "-----BEGIN PGP SIGNATURE-----\n\niHAEABECADAWIQSg/0WQu2Ei7e9uPFQtcnzHaGl3NAUCW+we3RIcYWxwaGFAZXhh\nbXBsZS5uZXQACgkQLXJ8x2hpdzSwIgCfdfk+n6SsYwa9SYfBwr/o4FmWsa8Anj3V\n8p3ahr3rxNbK7cDbSk/p1zD0\n=oS5d\n-----END PGP SIGNATURE-----" 5 | } 6 | -------------------------------------------------------------------------------- /tests/json/t-version.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": [{ 3 | "protocol": "OpenPGP" 4 | }, { 5 | "protocol": "spawn", 6 | "fname": "/nonexistent", 7 | "version": "1.0.0", 8 | "req_version": "1.0.0" 9 | }] 10 | } 11 | -------------------------------------------------------------------------------- /src/gpgme.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | includedir=@includedir@ 4 | libdir=@libdir@ 5 | host=@GPGME_CONFIG_HOST@ 6 | api_version=@GPGME_CONFIG_API_VERSION@ 7 | 8 | Name: gpgme 9 | Description: GnuPG Made Easy to access GnuPG 10 | Requires.private: gpg-error, libassuan 11 | Version: @PACKAGE_VERSION@ 12 | Cflags: @GPGME_CONFIG_CFLAGS@ 13 | Libs: @GPGME_CONFIG_LIBS@ 14 | URL: https://www.gnupg.org/software/gpgme/index.html 15 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | 4 | "name": "Browsertests for gpgmejs", 5 | "description": "Run the browsertests.", 6 | "version": "0.1", 7 | "content_security_policy": "default-src 'self' filesystem:", 8 | "browser_action": { 9 | "default_icon": "testicon.png", 10 | "default_popup": "popup.html" 11 | }, 12 | "permissions": ["nativeMessaging", "activeTab"] 13 | } 14 | -------------------------------------------------------------------------------- /tests/json/t-sig-notations.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "verify", 3 | "data": "-----BEGIN PGP MESSAGE-----\n\nowGbwMvMwCSoW1RzPCOz3ITxtFASQ/SbgPceiTk5+Qo+qaUlqVwd51kYBJkY+sUU\nWRb8d52wO1Hp7fs8mxCYHlYmkAaDKQ0MQKDAwF5QlJqWWlSUmqKbmpuYmaObmpec\nn5KZl+5QkF6gl5yfC6RyM3NTlUXAGrgZ+HMSS9MzQApyU71Ki0sUggtLU1OrUhV8\nU2WkMkpKCoqt9PXLy8v10vNK9fKL0vUL8nMykyv1Gbg4BWBuYP7OMN9VdOep8HTD\nKQLOd+7+Cshs6jVTfsMwT3sje7Pmui779IU/657Lb575u9z/LgA=\n=iqJ/\n-----END PGP MESSAGE-----\n\n" 4 | } 5 | -------------------------------------------------------------------------------- /lang/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gpgmejs", 3 | "version": "0.0.1-dev", 4 | "description": "Javascript part of the GPGME nativeMessaging integration", 5 | "main": "src/index.js", 6 | "private": true, 7 | "keywords": [], 8 | "author": "", 9 | "license": "LGPL-2.1+", 10 | "devDependencies": { 11 | "webpack": "^4.5.0", 12 | "webpack-cli": "^3.0.8", 13 | "chai": "^4.1.2", 14 | "mocha": "^5.1.1", 15 | "jsdoc": "^3.5.5" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/gpgme-glib.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | includedir=@includedir@ 4 | libdir=@libdir@ 5 | host=@GPGME_CONFIG_HOST@ 6 | api_version=@GPGME_CONFIG_API_VERSION@ 7 | 8 | Name: gpgme-glib 9 | Description: GnuPG Made Easy to access GnuPG with Glib 10 | Requires: gpg-error, libassuan, glib-2.0 11 | Version: @PACKAGE_VERSION@ 12 | Cflags: @GPGME_CONFIG_CFLAGS@ 13 | Libs: @GPGME_CONFIG_LIBS@ 14 | URL: https://www.gnupg.org/software/gpgme/index.html 15 | -------------------------------------------------------------------------------- /lang/js/DemoExtension/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | 4 | "name": "gpgme-json with native Messaging", 5 | "description": "A simple demo application", 6 | "version": "0.1", 7 | "content_security_policy": "default-src 'self' filesystem:", 8 | "browser_action": { 9 | "default_icon": "testicon.png", 10 | "default_title": "gpgme.js", 11 | "default_popup": "popup.html" 12 | }, 13 | "permissions": ["nativeMessaging", "activeTab"] 14 | } 15 | -------------------------------------------------------------------------------- /tests/gpg/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .gpg-v21-migrated 3 | .libs 4 | gpg-agent.conf 5 | gpg.conf 6 | pubring.gpg 7 | pubring.gpg~ 8 | secring.gpg 9 | t-cancel 10 | t-decrypt 11 | t-decrypt-verify 12 | t-edit 13 | t-encrypt 14 | t-encrypt-large 15 | t-encrypt-sign 16 | t-encrypt-sym 17 | t-eventloop 18 | t-export 19 | t-file-name 20 | t-genkey 21 | t-gpgconf 22 | t-import 23 | t-keylist 24 | t-keylist-sig 25 | t-sig-notation 26 | t-sign 27 | t-signers 28 | t-thread1 29 | t-trustlist 30 | t-verify 31 | t-wait 32 | trustdb.gpg 33 | -------------------------------------------------------------------------------- /tests/json/t-decrypt.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "dec_info": { 3 | "wrong_key_usage": false, 4 | "is_de_vs": false, 5 | "is_mime": false, 6 | "legacy_cipher_nomdc": false, 7 | "recipients": [{ 8 | "pubkey_algo_name": "ELG-E", 9 | "status_string": "Success", 10 | "status_code": 0 11 | }] 12 | }, 13 | "type": "plaintext", 14 | "base64": false, 15 | "data": "Hello\n" 16 | } 17 | -------------------------------------------------------------------------------- /tests/json/t-decrypt.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "decrypt", 3 | "data": "hQEOA2rm1+5GqHH4EAQAhzzu7VYpE9vFVdqkAALRHSyz8698b8MES7j5ldzXGVnGSWmN0+YXGyWyeB5tnAXAvUiV10tzoiNaPXoNeOFrHQOWrDsQ1vYukdtblDc3FW/Ywf7aelcFIGh9qydmkPX/EPeULsbgdZp6sybGoPpEuxzb4CYeRjogB9VvPCRAPb4D/1hRdpoVgWI78JvaeI+xwrP71RuHggZEsM8FSYFBD8c5dY+iAHbPSBI6QSZMvMHCu8YVlV40rHFjjoKQ1ox9DHHyvaZkwAZbI/U7+CYZoPoXMAARjCCCW4TIB3VrM70QLjnLSVfWaCtTnYp2KWaRae0Ze7yPt/h1dYe4ofn/O3UH0kEBqJ99Srtrmr9UWdgikgrWCz5TAV27g2vsZubfMe8vC1QnqASazyBy74ibvrXrIvHnhHQvPCkZFRdbgYhV/+KQIQ==", 4 | "base64": true 5 | } 6 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | No more ChangeLog files 2 | ======================== 3 | 4 | Do not modify any of the ChangeLog files in GPGME. Starting on 5 | December 1st, 2011 we put change information only in the GIT commit 6 | log, and generate a top-level ChangeLog file from logs at "make dist" 7 | time. As such, there are strict requirements on the form of the 8 | commit log messages. See doc/HACKING for details. The old ChangeLog 9 | files have all be renamed to ChangeLog-2011. 10 | 11 | 12 | 13 | Local Variables: 14 | buffer-read-only: t 15 | mode: text 16 | End: 17 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/unittests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

Unit tests

10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /lang/js/DemoExtension/ui.css: -------------------------------------------------------------------------------- 1 | ul { 2 | list-style-type: none; 3 | padding-left: 0px; 4 | } 5 | 6 | ul li span { 7 | float: left; 8 | width: 120px; 9 | margin-top: 6px; 10 | } 11 | 12 | div .left { 13 | float: left; 14 | align-items: stretch; 15 | width: 40%; 16 | } 17 | div .center { 18 | width: 50%; 19 | align-content: space-between; 20 | } 21 | 22 | div .center button { 23 | align-self: stretch; 24 | } 25 | div .right { 26 | float: right; 27 | align-items: stretch; 28 | width: 40%; 29 | } 30 | 31 | div .bottom { 32 | clear:both; 33 | } -------------------------------------------------------------------------------- /tests/json/t-config.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "components": [{ 3 | "name": "gpg", 4 | "description": "OpenPGP", 5 | "options": [{ 6 | "name": "Monitor", 7 | "flags": 1, 8 | "level": 0, 9 | "type": 0, 10 | "alt_type": 0 11 | }, { 12 | "name": "verbose", 13 | "description": "verbose", 14 | "level": 0, 15 | "type": 0, 16 | "alt_type": 0 17 | }] 18 | }] 19 | } 20 | -------------------------------------------------------------------------------- /lang/js/jsdoc.conf: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "allowUnknownTags": false, 4 | "dictionaries": ["jsdoc"] 5 | }, 6 | "source": { 7 | "include": ["jsdoc_index.md", "./src"], 8 | "includePattern": ".+\\.js(doc|x)?$", 9 | "excludePattern": "(^|\\/|\\\\)_" 10 | }, 11 | "opts":{ 12 | "destination": "./doc/", 13 | "recurse": true 14 | }, 15 | "sourceType": "module", 16 | "plugins": [], 17 | "templates": { 18 | "cleverLinks": false, 19 | "monospaceLinks": false, 20 | "default": { 21 | "outputSourceFiles": true 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /lang/README: -------------------------------------------------------------------------------- 1 | Language Support for GPGME 2 | -------------------------- 3 | 4 | This directory contains support for other languages than C. 5 | 6 | Please note that language support components may be under a different 7 | license than GPGME itself. You can find more information in each 8 | sub-directory. 9 | 10 | Directory Language 11 | 12 | cl Common Lisp 13 | js Native messaging client for the gpgme-json server. 14 | 15 | More language bindings are available in separate repositories. 16 | 17 | Repository Language 18 | 19 | gpgmepp C++ 20 | gpgmeqt Qt-Framework API 21 | gpgmepy Python 3 (module name: gpg) 22 | -------------------------------------------------------------------------------- /lang/js/build_extensions.sh: -------------------------------------------------------------------------------- 1 | #/!bin/bash 2 | 3 | npx webpack --config webpack.conf.js 4 | npx webpack --config webpack.conf_unittests.js 5 | mkdir -p BrowserTestExtension/libs 6 | cp node_modules/chai/chai.js \ 7 | node_modules/mocha/mocha.css \ 8 | node_modules/mocha/mocha.js \ 9 | build/gpgmejs.bundle.js \ 10 | build/gpgmejs_unittests.bundle.js BrowserTestExtension/libs 11 | rm -rf build/extensions 12 | mkdir -p build/extensions 13 | zip -r build/extensions/browsertest.zip BrowserTestExtension 14 | 15 | mkdir -p DemoExtension/libs 16 | cp build/gpgmejs.bundle.js DemoExtension/libs 17 | zip -r build/extensions/demoextension.zip DemoExtension 18 | -------------------------------------------------------------------------------- /tests/gpg/cipher-no-sig.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | 3 | hQEOA++dwnahcsiBEAP8CPkDWzZrcMJ1fyaPoQAhlx18p44+7vTF5zYCkMVT+i4E 4 | X/zcIreDYDpFNHzK2orNW/LGGNpMf3ZyDAYw7eDWgPwld2PJh2/ZfR/dXoGcAEd4 5 | vhbhA1D/ymQn+lxgSXNLMonxaoCqFK7cKStLCHfaPMbQ0S5GXU0IRwjfSn76oxwE 6 | AKzTa/54g8XNL9Dku9c/KATzopdDLzAzN6oBJlgRbjhc3T8mzTVJF91s+ow8dEC+ 7 | 0U2GBwkL5ZOKTFelSO3dBsH7RBNbYiJA+DbZ6nZia2KAtlLgyr4Z5vGh9bmltJl/ 8 | 1qdIdRF/La3wA/6bL10YMYF+7IJ9DiuDi/NRmSsO/ZWt0nMBXnzOeyLgxdbW1RS1 9 | NPWzKC/4RqvnWJmm7W3p0JG8v2ad+97O5KsOcqJnaKJOY0jKXeORrhih2DG32rpe 10 | 4bhskRTIBJBaPtPnRGevlxardQi+Spbd75yqccCLjkQF0HhCLiHW9SJiLSMdnY1U 11 | U9th3ZR5 12 | =uvfB 13 | -----END PGP MESSAGE----- 14 | -------------------------------------------------------------------------------- /tests/gpg/cipher-1.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | 3 | hQEOA2rm1+5GqHH4EAP/XKz8pdonnZg2dqJhjdas4vQHPxspxLhgf7OuYigodBpI 4 | l7srTvqtuRsDFNorgURW6DjPqfGqpZsn2uf8enUskunHVMQFBILX38d+G5SkisqF 5 | uOZUlmh0ZfVocCBGYt8ZPfa9ObmitPmZvhCReCHFlTj588ZjofKuNjmfw+QfmNcD 6 | /j4z4ijv6dKHQCm7EAjnOsCw9SbrAVpRXjibN7KT+w6QT6m+5w9k4RfhkTOlqrHq 7 | 5d3ZyxLctdTkXlk0hXz1Mey4AEKTtlZGvrQVIhaX4hcB4NFJB0fZJ/pnKypi1H6q 8 | 0bSBq2p6kCzJuNvrEr4wk4B1NsOTBacUSffXLrfsEH2F0ngBzN7d/KHBImu81F8w 9 | x96f6dELyYetV0UwhyFrPrA3lBQf9q5cNDqPiCHooUFOudQ5t0h7VtSU3fyaYoit 10 | cJGPFkIxhv+VAbEW/h5muEg3KO1iEqLP4RK3y0Jjy4pyEauAgviM68Vjf4OVvgta 11 | /IblIrp1FHxoCpA= 12 | =sEuD 13 | -----END PGP MESSAGE----- 14 | -------------------------------------------------------------------------------- /tests/gpg/pinentry: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Dummy pinentry 3 | # 4 | # Copyright 2008 g10 Code GmbH 5 | # 6 | # This file is free software; as a special exception the author gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | # 10 | # This file is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 12 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 13 | # PURPOSE. 14 | 15 | echo OK Your orders please 16 | 17 | while read cmd; do 18 | case $cmd in 19 | GETPIN) echo D abc; echo OK;; 20 | *) echo OK;; 21 | esac 22 | done 23 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/longTests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Browsertest

9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /tests/json/t-import.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "result": { 3 | "considered": 1, 4 | "no_user_id": 0, 5 | "imported_rsa": 0, 6 | "new_user_ids": 0, 7 | "new_sub_keys": 0, 8 | "new_signatures": 0, 9 | "new_revocations": 0, 10 | "secret_read": 0, 11 | "secret_imported": 0, 12 | "secret_unchanged": 0, 13 | "skipped_new_keys": 0, 14 | "not_imported": 0, 15 | "skipped_v3_keys": 0, 16 | "imports": [{ 17 | "fingerprint": "E8143C489C8D41124DC40D0B47AF4B6961F04784", 18 | "error_string": "Success", 19 | "status": 1 20 | }] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # GnuPG exclusions 2 | /aclocal.m4 3 | /autom4te.cache 4 | /configure 5 | /config.log 6 | /config.status 7 | /conf/config.h.in 8 | /conf/config.h 9 | /libtool 10 | /VERSION 11 | Makefile.in 12 | Makefile 13 | stamp-h1 14 | *.o 15 | *.lo 16 | 17 | # Hidden files 18 | *~ 19 | 20 | # Byte compiled Python 21 | *.py[cod] 22 | __pycache__ 23 | 24 | # C extensions 25 | *.so 26 | 27 | # Packages 28 | *.egg 29 | *.egg-info 30 | build 31 | eggs 32 | parts 33 | develop-eggs 34 | .installed.cfg 35 | 36 | # Installer logs 37 | pip-log.txt 38 | 39 | # Unit test / coverage reports 40 | .coverage 41 | .tox 42 | nosetests.xml 43 | 44 | # Translations 45 | *.mo 46 | 47 | # Mr Developer 48 | .mr.developer.cfg 49 | .project 50 | .pydevproject 51 | 52 | # Assorted Apple crap 53 | default.profraw 54 | .DS_Store 55 | ._.DS_Store 56 | -------------------------------------------------------------------------------- /tests/gpg/cipher-2.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | 3 | hQEOA++dwnahcsiBEAQAqaF1yuTJ26FmJHndyaHUjazx7j8/Z/Ht3O+jSAOaoJFR 4 | 84rK4Tte0JQYTCl3XxwSEwr48OAtyeTstLjabGAvBoHrXVP3xC0U7kBalZm2lwcq 5 | A8dDDoa3uMkWi1OJ3e2o79/z6SdTHEgRIRomAku1JaXFGTd8OsFhW782RpKUBOID 6 | /jMs9o2sa/gDhWVaeC3SaQovl2xb45ev0nMibED916BQvv3NkH5/EzeM6v788h63 7 | 4yUkWWNr0/bnJ21chlxIbvICjHfuGAEDw+i4HhK/nLBL3Ep4ADtLP7OPZJHlcQgI 8 | g8mAztasBxTGGUuFYvRT0X7sbaSPxLR26vbTCYAo/P/80sA4AYGhBuYPsRN4JzX9 9 | QaSrToKjPbaZqq+nHQYCvi6m5xAjMT0HVdXejMtZMKwv4TRm7IVCimtIZqrlvw7c 10 | Kj+ZcDGq9qb7urnzC5mdAZkXyNtZxmMKYFI0ci7zMnflvIM87JrVEjZbjjiXlcVy 11 | mSxhufOOweLJARkJ4mKVq1tr8REu8/ots4fDzUIAITM3z8pKA7doWAH2VTo0Idmc 12 | wYOoTLkiq1Z8fxeryB6U66C831PDiWe7W0usRSVo5rZ7laLZeOGl33fAAZCNLTgv 13 | tOPWWg5rCpRTVXgQ6Edl7DtzKI1z4EJbuEUs6shW+OT3bNISiDz2am8remU= 14 | =9AEU 15 | -----END PGP MESSAGE----- 16 | -------------------------------------------------------------------------------- /lang/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for gpgme/lang. 2 | # Copyright (C) 2003, 2006 g10 Code GmbH 3 | # 4 | # This file is part of GPGME. 5 | # 6 | # GPGME is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | # Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, see . 18 | # SPDX-License-Identifier: LGPL-2.1-or-later 19 | 20 | SUBDIRS = $(ENABLED_LANGUAGES) 21 | DIST_SUBDIRS = cl js 22 | 23 | EXTRA_DIST = README 24 | -------------------------------------------------------------------------------- /tests/gpg/cipher-3.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | 3 | hQEOA++dwnahcsiBEAQApowkbz0idxMfLIT/a1G4QbZy77cWyaYOM/qh4lH4h7ra 4 | f19MZzbRViZYBtJeITszTFmulp31qrF++6gBy8tU7l8VfVfOtvwn1WlRvn2+bsns 5 | SicJAXtUiwIF8fbapSrkN6qpg2l+Fnx3SYV7+lh/7Fbf93DquwVEn+GwvgkyCQkD 6 | /j5UVU6PJ+k5E5JG7CMzLZHnpW1MtKUqKRG9sTW83SvvI5Wl9VMgjmdO6bZRPKPY 7 | Fr5udYJ1v4CIpVTb0O/TgAaiw7/Ak4SOg6jK0H0l1vuPPRjyzx43G4Y4lZ/EoCzT 8 | gU+0kiDD+O7xLDml5jPWTYov7LkhRMKI4Ugp37FzbF9p0sClAR1mY4WlAN23ku0W 9 | 3bw54zSi7S6sh+i/uOmjZ+ziXr/S1pHFN2TNAkpH42o6VDhJ4vYk5KIB/mn/IoP1 10 | G57JUhLqpSHO7LF8X45eBLT3tKC3rIaILHXcXE5PeyMiOrl1snIClrpX+Qn6dRPX 11 | cYssX/0OQwE77bAla5QpZEy6YLOC4Ej4oTX5QU1rHNyLfvIDhwtphKMvbbssmsVI 12 | tAMvrGQudEwLSlvNlnJsI79jqmbi5W8PYr+ssvOvrd5hWoKti7EdglWddFNVVjZl 13 | ooJgztXUnPcufhaimQtNvX0Tj2hI8QwTxGPNO3aesPCQI0GbSUSqpvu6mlaQY2Qe 14 | NJNkfTH23fzoG61nFxIQ0HYbuBp0hJnGOXfHtMNxyjoAs1yEJbyQ20Lso/Vrsf3J 15 | sY7jkisFrURxTGQyBxxbnIO+nJPemOzV9Q/qo6Lj9yW0KagaffWogw/6X/xOvL4u 16 | aM8pI7NOi48b 17 | =mh2s 18 | -----END PGP MESSAGE----- 19 | -------------------------------------------------------------------------------- /tests/json/t-decrypt-verify.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "decrypt", 3 | "base64": true, 4 | "data": "hQEOA2rm1+5GqHH4EAP+NCYW3vVuCLDTUYhBaKHNgp4fMq9TNACH2NiZyVSaYLe0VE+2LLurHN/XLwlP7xhl2XijBUe6Q7M+KyoPd9iNIgX9q914dPUN0Q3sJinSbujnFzsy0L2x6kgUJCK/XA7rp0VpmJGUWIQYAET8Xx6SaWd2XxIdIITUz2MqrTzWrgED/iOuRxuT4loNJ/DM2YrOZr0He25SxJskg0t1bik2nM+wHAbJrSa6BqPJYU4scnG6AH0RRxFV177ADjOcBLeutXw7DE+6YOExWZD2Fb0oax/ppDulMudrJnj6Wg5/EHbBLDF96Xd6vQX1rcHmrxImvaQNbavEKswlDZgoYwaV7PYPhQEOAwQHH7gHKHE0EAP/So0a3deCbXVSPkABRO3yZa6kHcVuO5+lTsunfxav1TwaMkBOiK6usRz2zt3rjozNrh3vXn3o2WpFKebwhIUF0q2qPw3OKIGq9jFT63t+DPjpbSorAevmVqXWdmaqDPJZ/QIY6NkBhprTdIGPSTFh66eggQLz+BBUVx2myM7AqgcD/3PnOGIiqINQzFkfa6lHiV/TZ8AaMNfvyx4FFG4Zi45ZnDwLCJZ+J7ATXzECauEDLzhjk8M9OP0PwFT1WsnWefKDSLzbO5hEnf8NYdY6i8f2MJKYcnpeI4PZA3OK9ovmAoJl31K+/vBJRP4kiJ4Weu7fzMi6Zz87tfHDEpbRR7N80qoBTlT7I044LG5OJKgQukb7HOv+c668i56UzZVgz+LCsFpjYEFTlrPVR5Me3PjSSb8M+tt9NUjenNnghJEcxeD902YJcqgRWPotouzx5fKDTay/LofFqckEWGlP5pnkeNfYIBIaSSrG/KcdQ0rPOAxKrZzIifYVwnJm/ISxU6uMpNfDJGOJppf4xqXgTKBdIsCljg5LlgNvGhNMYaXQkGQInzXvLSUbxLerWw==" 5 | } 6 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/browsertest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Browsertest

9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/runbrowsertest.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | /* global mocha */ 25 | 26 | mocha.run(); 27 | -------------------------------------------------------------------------------- /lang/cl/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for GPGME-CL. 2 | # Copyright (C) 2003, 2006 g10 Code GmbH 3 | # 4 | # This file is part of GPGME-CL. 5 | # 6 | # GPGME-CL is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # GPGME-CL is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, see . 18 | # SPDX-License-Identifier: LGPL-2.1-or-later 19 | 20 | clfiles = gpgme.asd gpgme-package.lisp gpgme-grovel.lisp gpgme.lisp 21 | 22 | # FIXME: Should be configurable. 23 | clfilesdir = $(datadir)/common-lisp/source/gpgme 24 | dist_clfiles_DATA = $(clfiles) 25 | 26 | EXTRA_DIST = README ChangeLog-2011 27 | -------------------------------------------------------------------------------- /lang/cl/gpgme-grovel.lisp: -------------------------------------------------------------------------------- 1 | ;;;; gpgme-grovel.lisp 2 | 3 | ;;; This file is part of GPGME-CL. 4 | ;;; 5 | ;;; GPGME-CL is free software; you can redistribute it and/or modify it 6 | ;;; under the terms of the GNU General Public License as published by 7 | ;;; the Free Software Foundation; either version 2 of the License, or 8 | ;;; (at your option) any later version. 9 | ;;; 10 | ;;; GPGME-CL is distributed in the hope that it will be useful, but 11 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | ;;; Lesser General Public License for more details. 14 | ;;; 15 | ;;; You should have received a copy of the GNU General Public License 16 | ;;; along with GPGME; if not, write to the Free Software Foundation, 17 | ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | 20 | (in-package :gpgme) 21 | 22 | 23 | (include "errno.h" "sys/types.h") 24 | 25 | (constant (+ebadf+ "EBADF")) 26 | 27 | (ctype off-t "off_t") 28 | (ctype size-t "size_t") 29 | (ctype ssize-t "ssize_t") 30 | 31 | (cvar ("errno" *errno*) :int) 32 | -------------------------------------------------------------------------------- /lang/js/DemoExtension/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for gpgme.js. 2 | # Copyright (C) 2018 Intevation GmbH 3 | # 4 | # This file is part of gpgme.js. 5 | # 6 | # gpgme.js is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # gpgme.js is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | # 02111-1307, USA 20 | 21 | EXTRA_DIST = manifest.json \ 22 | popup.html \ 23 | entry.js \ 24 | maindemo.js \ 25 | mainui.html \ 26 | testicon.png \ 27 | ui.css 28 | -------------------------------------------------------------------------------- /m4/glibc21.m4: -------------------------------------------------------------------------------- 1 | # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) 2 | dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. 3 | dnl This file is free software, distributed under the terms of the GNU 4 | dnl General Public License. As a special exception to the GNU General 5 | dnl Public License, this file may be distributed as part of a program 6 | dnl that contains a configuration script generated by Autoconf, under 7 | dnl the same distribution terms as the rest of that program. 8 | 9 | # Test for the GNU C Library, version 2.1 or newer. 10 | # From Bruno Haible. 11 | 12 | AC_DEFUN([jm_GLIBC21], 13 | [ 14 | AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, 15 | ac_cv_gnu_library_2_1, 16 | [AC_EGREP_CPP([Lucky GNU user], 17 | [ 18 | #include 19 | #ifdef __GNU_LIBRARY__ 20 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) 21 | Lucky GNU user 22 | #endif 23 | #endif 24 | ], 25 | ac_cv_gnu_library_2_1=yes, 26 | ac_cv_gnu_library_2_1=no) 27 | ] 28 | ) 29 | AC_SUBST(GLIBC21) 30 | GLIBC21="$ac_cv_gnu_library_2_1" 31 | ] 32 | ) 33 | -------------------------------------------------------------------------------- /tests/gpgsm/32100C27173EF6E9C4E9A25D3D69F86D37A4F939: -------------------------------------------------------------------------------- 1 | (private-key 2 | (oid.1.2.840.113549.1.1.1 3 | (n #00e0ce96f90b6c9e02f3922beada93fe50a875eac6bcc18bb9a9cf2e84965caa2d1ff95a7f542465c6c0c19d276e4526ce048868a7a914fd343cc3a87dd74291ffc565506d5bbb25cbac6a0e2dd1f8bcaab0d4a29c2f37c950f363484bf269f7891440464baf79827e03a36e70b814938eebdc63e964247be75dc58b014b7ea251#) 4 | (e #010001#) 5 | (d #046129F2489D71579BE0A75FE029BD6CDB574EBF57EA8A5B0FDA942CAB943B117D7BB95E5D28875E0F9FC5FCC06A72F6D502464DABDED78EF6B716177B83D5BDC543DC5D3FED932E59F5897E92E6F58A0F33424106A3B6FA2CBF877510E4AC21C3EE47851E97D12996222AC3566D4CCB0B83D164074ABF7DE655FC2446DA1781#) 6 | (p #00e861b700e17e8afe6837e7512e35b6ca11d0ae47d8b85161c67baf64377213fe52d772f2035b3ca830af41d8a4120e1c1c70d12cc22f00d28d31dd48a8d424f1#) 7 | (q #00f7a7ca5367c661f8e62df34f0d05c10c88e5492348dd7bddc942c9a8f369f935a07785d2db805215ed786e4285df1658eed3ce84f469b81b50d358407b4ad361#) 8 | (u #304559a9ead56d2309d203811a641bb1a09626bc8eb36fffa23c968ec5bd891eebbafc73ae666e01ba7c8990bae06cc2bbe10b75e69fcacb353a6473079d8e9b#) 9 | ) 10 | ) 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/json/key-with-revokers.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | 3 | mDMEZkTFQxYJKwYBBAHaRw8BAQdApgZAhIh3+NFiBeVAvKCPj9OxuO5LW7TXyKlQ 4 | nm+N+n+IkAQfFgoAOBYhBJqVhuvPPf7z+/Er2IsiFlFyHN5RBQJmRMVDFwzAEaD/ 5 | RZC7YSLt7248VC1yfMdoaXc0AgcAAAoJEIsiFlFyHN5RprYBALLUmpXhjsOwhbi7 6 | MQ3OU1vq+EXh/D2xNqTshbTmhjhLAQDlzsjRpNkqjRdGVnCB0kJ9dpgJ9UkXSuUR 7 | npnR7ok7BIiQBB8WCgA4FiEEmpWG6889/vP78SvYiyIWUXIc3lEFAmZExUMXDIAR 8 | I/00ekGUKbrM1ecta8R3gFSs0kYCBwAACgkQiyIWUXIc3lFM/AEAiaiJFQCO/5yo 9 | 3um8OBOkDNOVB8F9q7B3Htm7eejsL98BAObrBoBrLj5/rYWJgOh8wzlllvWgScMT 10 | G/o1sZB+AWwMtB1rZXktd2l0aC1yZXZva2Vyc0BleGFtcGxlLm5ldIiTBBMWCgA7 11 | FiEEmpWG6889/vP78SvYiyIWUXIc3lEFAmZExUMCGwMFCwkIBwICIgIGFQoJCAsC 12 | BBYCAwECHgcCF4AACgkQiyIWUXIc3lGZfQD/WRE+fUZj8nbc/Gy2gGjtTOsXRvny 13 | Ibd4WW46SGrT35gA/2PlO9qWsRLwyom1GnVFniXs3CmyGIQPkcIA1Q9pPBoGuDgE 14 | ZkTFQxIKKwYBBAGXVQEFAQEHQA5dJyq7Yr/9tLObqow5dHsKlr1JW2T/WGbJvR+O 15 | dO8pAwEIB4h4BBgWCgAgFiEEmpWG6889/vP78SvYiyIWUXIc3lEFAmZExUMCGwwA 16 | CgkQiyIWUXIc3lFalwD/WrgY63p78C9Szor0kgsJxe7bJyDl9iERsvMUBw+qg2IA 17 | /AuiTiG0YL9iTSsZLIbWEDrALbEG2ALQXV/ihI50YEcD 18 | =xCgr 19 | -----END PGP PUBLIC KEY BLOCK----- 20 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/rununittests.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | /* global Gpgmejs_test, mocha*/ 25 | 26 | Gpgmejs_test.unittests(); 27 | mocha.run(); 28 | -------------------------------------------------------------------------------- /tools/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - Makefile for GPGME tools. 2 | # Copyright (C) 2025 g10 Code GmbH 3 | # 4 | # This file is part of GPGME. 5 | # 6 | # GPGME is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | # Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, see . 18 | # SPDX-License-Identifier: LGPL-2.1-or-later 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | GNUPGHOME=$(abs_builddir) 23 | 24 | AM_CFLAGS = -I$(top_builddir)/src $(GPG_ERROR_CFLAGS) 25 | 26 | LDADD = ../src/libgpgme.la $(GPG_ERROR_LIBS) 27 | 28 | bin_PROGRAMS = gnupg-key-manage 29 | 30 | 31 | gnupg_key_manage_SOURCES = gnupg-key-manage.c 32 | -------------------------------------------------------------------------------- /lang/js/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for gpgme.js. 2 | # Copyright (C) 2018 Intevation GmbH 3 | # 4 | # This file is part of GPGME. 5 | # 6 | # gpgme.js is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # gpgme.js is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | # 02111-1307, USA 20 | 21 | EXTRA_DIST = Connection.js \ 22 | Errors.js \ 23 | gpgmejs.js \ 24 | Helpers.js \ 25 | index.js \ 26 | Key.js \ 27 | Keyring.js \ 28 | Message.js \ 29 | permittedOperations.js \ 30 | Signature.js 31 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/setup_testing.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | /* global mocha, chai */ 25 | 26 | mocha.setup('bdd'); 27 | const expect = chai.expect; //eslint-disable-line no-unused-vars 28 | chai.config.includeStack = true; -------------------------------------------------------------------------------- /lang/js/DemoExtension/entry.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | /* global chrome */ 25 | 26 | document.addEventListener('DOMContentLoaded', function () { 27 | chrome.tabs.create({ 28 | url: './mainui.html' 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/popup.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | /* global chrome */ 25 | 26 | document.addEventListener('DOMContentLoaded', function() { 27 | chrome.tabs.create({ 28 | url: './index.html' 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /tests/opassuan/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 g10 Code GmbH 2 | # 3 | # This file is part of GPGME. 4 | # 5 | # GPGME is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU Lesser General Public License as 7 | # published by the Free Software Foundation; either version 2.1 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # GPGME is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | # Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this program; if not, see . 17 | # SPDX-License-Identifier: LGPL-2.1-or-later 18 | 19 | ## Process this file with automake to produce Makefile.in 20 | 21 | GNUPGHOME=$(abs_builddir) 22 | TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) GPG_AGENT_INFO= 23 | 24 | noinst_HEADERS = 25 | TESTS = 26 | 27 | EXTRA_DIST = 28 | 29 | AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ 30 | LDADD = ../../src/libgpgme.la @LDADD_FOR_TESTS_KLUDGE@ 31 | 32 | noinst_PROGRAMS = $(TESTS) t-command 33 | 34 | DISTCLEANFILES = 35 | 36 | -------------------------------------------------------------------------------- /lang/js/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for gpgme.js. 2 | # Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | # 4 | # This file is part of gpgme.js. 5 | # 6 | # gpgme.js is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # gpgme.js is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, see . 18 | # SPDX-License-Identifier: LGPL-2.1-or-later 19 | 20 | SUBDIRS = src BrowserTestExtension DemoExtension 21 | 22 | EXTRA_DIST = build_extensions.sh \ 23 | jsdoc.conf \ 24 | jsdoc_index.md \ 25 | .eslintrc.json \ 26 | package.json \ 27 | README \ 28 | unittest_inputvalues.js \ 29 | unittests.js \ 30 | webpack.conf.js \ 31 | webpack.conf_unittests.js 32 | -------------------------------------------------------------------------------- /src/mbox-util.h: -------------------------------------------------------------------------------- 1 | /* mbox-util.h - Defs for mail address helper functions 2 | * Copyright (C) 2015 Werner Koch 3 | * 4 | * This file is part of GnuPG. 5 | * 6 | * This file is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * This file is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, see . 18 | */ 19 | #ifndef GNUPG_COMMON_MBOX_UTIL_H 20 | #define GNUPG_COMMON_MBOX_UTIL_H 21 | 22 | /* int has_invalid_email_chars (const void *buffer, size_t length); */ 23 | int _gpgme_is_valid_mailbox (const char *name); 24 | /* int _gpgme_is_valid_mailbox_mem (const void *buffer, size_t length); */ 25 | char *_gpgme_mailbox_from_userid (const char *userid); 26 | /* int is_valid_user_id (const char *uid); */ 27 | 28 | 29 | #endif /*GNUPG_COMMON_MBOX_UTIL_H*/ 30 | -------------------------------------------------------------------------------- /tests/json/t-verify.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "is_mime": false, 4 | "signatures": [{ 5 | "summary": { 6 | "sigsum": [], 7 | "valid": false, 8 | "green": false, 9 | "red": false, 10 | "revoked": false, 11 | "key-expired": false, 12 | "sig-expired": false, 13 | "key-missing": false, 14 | "crl-missing": false, 15 | "crl-too-old": false, 16 | "bad-policy": false, 17 | "sys-error": false 18 | }, 19 | "wrong_key_usage": false, 20 | "chain_model": false, 21 | "is_de_vs": false, 22 | "status_string": "Success", 23 | "fingerprint": "A0FF4590BB6122EDEF6E3C542D727CC768697734", 24 | "validity_string": "unknown", 25 | "pubkey_algo_name": "DSA", 26 | "hash_algo_name": "SHA1", 27 | "status_code": 0, 28 | "timestamp": 1542201053, 29 | "exp_timestamp": 0, 30 | "pka_trust": 0, 31 | "validity": 0, 32 | "validity_reason": 0 33 | }] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lang/js/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es6": true 5 | }, 6 | "extends": "eslint:recommended", 7 | "parserOptions": { 8 | "sourceType": "module" 9 | }, 10 | "rules": { 11 | "indent": [ 12 | "warn", 13 | 4 14 | ], 15 | "linebreak-style": [ 16 | "error", 17 | "unix" 18 | ], 19 | "quotes": [ 20 | "error", 21 | "single" 22 | ], 23 | "semi": [ 24 | "error", 25 | "always" 26 | ], 27 | "no-var": [ 28 | "warn" 29 | ], 30 | "max-len": 1, 31 | "default-case": 2, 32 | "no-invalid-this": 2, 33 | "no-lone-blocks": 1, 34 | "no-self-compare": 2, 35 | "radix": 2, 36 | "no-use-before-define": ["error", { 37 | "functions": false, 38 | "classes": false, 39 | "variables": true 40 | }], 41 | "no-useless-constructor": 1, 42 | "space-before-function-paren": ["error", "always"], 43 | "keyword-spacing": 2, 44 | "spaced-comment": 1, 45 | "space-unary-ops": 2, 46 | "object-curly-spacing": ["error", "always"], 47 | "array-bracket-spacing": ["error", "never"] 48 | } 49 | } -------------------------------------------------------------------------------- /tests/json/t-import.in.json: -------------------------------------------------------------------------------- 1 | { 2 | "op": "import", 3 | "data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQGiBDbjs5oRBACjAxqGzA6j190iiN/1vJvS5jYLQ1H3xxhzXdZ6ZxjPJkslX1ox\nFqBINhjzBJnV9/7b1FFe5089NiCcGUVZa2xD3Vu+niLTAGNTQeNy6Y0E6wEfvplQ\nLJbpVGOmuVeZyShHNCKjrsZFtS1mr7o19SUb5QWS3gZHabFTbmhibcFBXwCg36qG\nVAnGcZzvnUTGpRy3xjp+zuED/2qTJNpnPhicKSksVwb6EJFXH7mQSZlyblAnOAVF\nMx19GUijW4MWP5FUdcTd5KzIDgkenRLBrpCLIFVkQ4/baP/hOiCLOmCoRu3xnFyo\nRPM/Jn94Qy3Jo2wigwkhQU+zyOU5C85QBD9ctkbYp/0mu9bpxmYTchHwD1v3dXUX\nEVajA/9lnEz1GiI0bwKpm8VKXp0YYP5hea8Jh5fNVb1QW2QqGd+XNHnRGSqX5smG\nyrs+xoYxD8+jv1FhmGaSv+6+n+JBVK4TuWrQpZ0cgZL5jZnX27TOYXeY4d5YKgE+\n7ZO57TwCIfF/P6puflGm+t5GcFwj4kkfohMEaeNhm1S+xf29q7QrVmljdG9yIFRl\nc3QgKGRlbW8ga2V5KSA8dmljdG9yQGV4YW1wbGUub3JnPohVBBMRAgAVBQI247Oa\nAwsKAwMVAwIDFgIBAheAAAoJEEevS2lh8EeEzEkAoMA+KfY9bA8EdfvWwa8zUM1S\nMs5rAKDS+6X3HVuCaLtVxzXOob+DKbB7b7kBDQQ247O+EAQAh5FAgdvaTJL3jBGc\njYiiJosxeTWf3L/dUY99fZN8R39DSVoUKf9Rt/EsS5DywXVnKAeJiUTYw8lbMRVF\n70VhSDHpMC9KtbB0lk3CcAqULPiyirT5g9ywN24W7k0naWIJisttUh+Hqbm6gc5P\nz9Nfd5ll8x4Ehi3lKE6Nze3gUNMAAwUD/AtUN1hqwWTTphVZctHq3JaUEb9agmu/\nOcsf24/bq9i8R8FaMwBF4fI5qIimcqAM+2BZ6dvZEdqrVaZR9aHjzchcHmaiI7Zm\nW4gmk+LHFFWf9y7mG8YDKFBXkaBuJpxFb1FIfJpmaLzJmRa76dLqI3A7H2E8dFQa\n/MGsYCa4NmILiEUEGBECAAYFAjbjs74ACgkQR69LaWHwR4RT3QCgnMlRAiGtvL5l\nD4Gdo5F0KEP5zZEAlA6Ri9WmZ9Xiqw5R3Bsg+As8sJ4=\n=FRd4\n-----END PGP PUBLIC KEY BLOCK-----\n" 4 | } 5 | -------------------------------------------------------------------------------- /doc/DCO: -------------------------------------------------------------------------------- 1 | GPGME Developer's Certificate of Origin. Version 1.0 2 | ===================================================== 3 | 4 | By making a contribution to the GPGME project, I certify that: 5 | 6 | (a) The contribution was created in whole or in part by me and I 7 | have the right to submit it under the free software license 8 | indicated in the file; or 9 | 10 | (b) The contribution is based upon previous work that, to the 11 | best of my knowledge, is covered under an appropriate free 12 | software license and I have the right under that license to 13 | submit that work with modifications, whether created in whole 14 | or in part by me, under the same free software license 15 | (unless I am permitted to submit under a different license), 16 | as indicated in the file; or 17 | 18 | (c) The contribution was provided directly to me by some other 19 | person who certified (a), (b) or (c) and I have not modified 20 | it. 21 | 22 | (d) I understand and agree that this project and the contribution 23 | are public and that a record of the contribution (including 24 | all personal information I submit with it, including my 25 | sign-off) is maintained indefinitely and may be redistributed 26 | consistent with this project or the free software license(s) 27 | involved. 28 | 29 | Signed-off-by: [Your name and mail address] 30 | -------------------------------------------------------------------------------- /tests/json/t-export.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "keys", 3 | "base64": false, 4 | "data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQGiBDbjs5oRBACjAxqGzA6j190iiN/1vJvS5jYLQ1H3xxhzXdZ6ZxjPJkslX1ox\nFqBINhjzBJnV9/7b1FFe5089NiCcGUVZa2xD3Vu+niLTAGNTQeNy6Y0E6wEfvplQ\nLJbpVGOmuVeZyShHNCKjrsZFtS1mr7o19SUb5QWS3gZHabFTbmhibcFBXwCg36qG\nVAnGcZzvnUTGpRy3xjp+zuED/2qTJNpnPhicKSksVwb6EJFXH7mQSZlyblAnOAVF\nMx19GUijW4MWP5FUdcTd5KzIDgkenRLBrpCLIFVkQ4/baP/hOiCLOmCoRu3xnFyo\nRPM/Jn94Qy3Jo2wigwkhQU+zyOU5C85QBD9ctkbYp/0mu9bpxmYTchHwD1v3dXUX\nEVajA/9lnEz1GiI0bwKpm8VKXp0YYP5hea8Jh5fNVb1QW2QqGd+XNHnRGSqX5smG\nyrs+xoYxD8+jv1FhmGaSv+6+n+JBVK4TuWrQpZ0cgZL5jZnX27TOYXeY4d5YKgE+\n7ZO57TwCIfF/P6puflGm+t5GcFwj4kkfohMEaeNhm1S+xf29q7QrVmljdG9yIFRl\nc3QgKGRlbW8ga2V5KSA8dmljdG9yQGV4YW1wbGUub3JnPohVBBMRAgAVBQI247Oa\nAwsKAwMVAwIDFgIBAheAAAoJEEevS2lh8EeEzEkAoMA+KfY9bA8EdfvWwa8zUM1S\nMs5rAKDS+6X3HVuCaLtVxzXOob+DKbB7b7kBDQQ247O+EAQAh5FAgdvaTJL3jBGc\njYiiJosxeTWf3L/dUY99fZN8R39DSVoUKf9Rt/EsS5DywXVnKAeJiUTYw8lbMRVF\n70VhSDHpMC9KtbB0lk3CcAqULPiyirT5g9ywN24W7k0naWIJisttUh+Hqbm6gc5P\nz9Nfd5ll8x4Ehi3lKE6Nze3gUNMAAwUD/AtUN1hqwWTTphVZctHq3JaUEb9agmu/\nOcsf24/bq9i8R8FaMwBF4fI5qIimcqAM+2BZ6dvZEdqrVaZR9aHjzchcHmaiI7Zm\nW4gmk+LHFFWf9y7mG8YDKFBXkaBuJpxFb1FIfJpmaLzJmRa76dLqI3A7H2E8dFQa\n/MGsYCa4NmILiEUEGBECAAYFAjbjs74ACgkQR69LaWHwR4RT3QCgnMlRAiGtvL5l\nD4Gdo5F0KEP5zZEAlA6Ri9WmZ9Xiqw5R3Bsg+As8sJ4=\n=FRd4\n-----END PGP PUBLIC KEY BLOCK-----\n" 5 | } 6 | -------------------------------------------------------------------------------- /lang/js/webpack.conf_unittests.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * This is the configuration file for building the gpgmejs-Library with webpack 21 | */ 22 | /* global require, module, __dirname */ 23 | 24 | const path = require('path'); 25 | 26 | module.exports = { 27 | entry: './unittests.js', 28 | mode: 'production', 29 | output: { 30 | path: path.resolve(__dirname, 'build'), 31 | filename: 'gpgmejs_unittests.bundle.js', 32 | libraryTarget: 'var', 33 | libraryExport: 'default', 34 | library: 'Gpgmejs_test' 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /lang/js/webpack.conf.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * This is the configuration file for building the gpgmejs-Library with webpack 21 | */ 22 | /* global require, module, __dirname */ 23 | const path = require('path'); 24 | 25 | module.exports = { 26 | entry: './src/index.js', 27 | // mode: 'development', 28 | mode: 'production', 29 | output: { 30 | path: path.resolve(__dirname, 'build'), 31 | filename: 'gpgmejs.bundle.js', 32 | libraryTarget: 'var', 33 | libraryExport: 'default', 34 | library: 'Gpgmejs' 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /lang/cl/gpgme.asd.in: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: lisp -*- 2 | 3 | ;;; Copyright (C) 2006 g10 Code GmbH 4 | ;;; 5 | ;;; This file is part of GPGME. 6 | ;;; 7 | ;;; GPGME is free software; you can redistribute it and/or 8 | ;;; modify it under the terms of the GNU Lesser General Public License 9 | ;;; as published by the Free Software Foundation; either version 2.1 of 10 | ;;; the License, or (at your option) any later version. 11 | ;;; 12 | ;;; GPGME is distributed in the hope that it will be useful, but 13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;;; Lesser General Public License for more details. 16 | ;;; 17 | ;;; You should have received a copy of the GNU Lesser General Public 18 | ;;; License along with GPGME; if not, write to the Free 19 | ;;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | ;;; 02111-1307, USA. 21 | 22 | (defpackage #:gpgme-system 23 | (:use #:common-lisp #:asdf)) 24 | 25 | (in-package #:gpgme-system) 26 | 27 | (defsystem gpgme 28 | :description "GnuPG Made Easy." 29 | :author "g10 Code GmbH" 30 | :version "@VERSION@" 31 | :licence "GPL" 32 | :defsystem-depends-on ("cffi-grovel") 33 | :depends-on ("cffi" "gpg-error" "trivial-garbage") 34 | :components ((:file "gpgme-package") 35 | (:cffi-grovel-file "gpgme-grovel" 36 | :depends-on ("gpgme-package")) 37 | (:file "gpgme" 38 | :depends-on ("gpgme-package" "gpgme-grovel")))) 39 | -------------------------------------------------------------------------------- /src/sema.h: -------------------------------------------------------------------------------- 1 | /* sema.h - Definitions for semaphores. 2 | Copyright (C) 2000 Werner Koch (dd9jn) 3 | Copyright (C) 2001, 2003, 2004, 2007 g10 Code GmbH 4 | 5 | This file is part of GPGME. 6 | 7 | GPGME is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU Lesser General Public License as 9 | published by the Free Software Foundation; either version 2.1 of 10 | the License, or (at your option) any later version. 11 | 12 | GPGME is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this program; if not, write to the Free Software 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | 02111-1307, USA. */ 21 | 22 | #ifndef SEMA_H 23 | #define SEMA_H 24 | 25 | #include 26 | 27 | #define DEFINE_GLOBAL_LOCK(name) \ 28 | gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER 29 | 30 | #define DEFINE_STATIC_LOCK(name) \ 31 | static gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER 32 | 33 | #define INIT_LOCK(name) \ 34 | name = (gpgrt_lock_t) GPGRT_LOCK_INITIALIZER 35 | 36 | #define DECLARE_LOCK(name) gpgrt_lock_t name 37 | 38 | #define DESTROY_LOCK(name) gpgrt_lock_destroy(&name) 39 | 40 | #define LOCK(name) gpgrt_lock_lock(&name) 41 | 42 | #define UNLOCK(name) gpgrt_lock_unlock(&name) 43 | 44 | #endif /* SEMA_H */ 45 | -------------------------------------------------------------------------------- /tests/gpg/pubkey-1.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v2.1.0-gitb3c71eb (GNU/Linux) 3 | 4 | mQGiBDo41NoRBADSfQazKGYf8nokq6zUKH/6INtV6MypSzSGmX2XErnARkIIPPYj 5 | cQRQ8zCbGV7ZU2ezVbzhFLUSJveE8PZUzzCrLp1O2NSyBTRcR5HVSXW95nJfY8eV 6 | pOvZRAKul0BVLh81kYTsrfzaaCjh9VWNP26LoeN2r+PjZyktXe7gM3C4SwCgoTxK 7 | WUVi9HoT2HCLY7p7oig5hEcEALdCJal0UYomX3nJapIVLVZg3vkidr1RICYMb2vz 8 | 58i17h8sxEtobD1vdIKNejulntaRAXs4n0tDYD9z7pRlwG1CLz1R9WxYzeOOqUDr 9 | fnVXdmU8L/oVWABat8v1V7QQhjMMf+41fuzVwDMMGqjVPLhu4X6wp3A8uyM3YDnQ 10 | VMN1A/4n2G5gHoOvjqxn8Ch5tBAdMGfO8gH4RjQOwzm2R1wPQss/yzUN1+tlMZGX 11 | K2dQ2FCWC/hDUSNaEQRlI15wxxBNZ2RQwlzE2A8v113DpvyzOtv0QO95gJ1teCXC 12 | 7j/BN9asgHaBBc39JLO/TcpuI7Hf8PQ5VcP2F0UE3lczGhXbLLRESm9lIFJhbmRv 13 | bSBIYWNrZXIgKHRlc3Qga2V5IHdpdGggcGFzc3BocmFzZSAiYWJjIikgPGpvZUBl 14 | eGFtcGxlLmNvbT6IYgQTEQIAIgUCTbdXqQIbIwYLCQgHAwIGFQgCCQoLBBYCAwEC 15 | HgECF4AACgkQr4IkT5zZ/VUcCACfQvSPi//9/gBv8SVrK6O4DiyD+jAAn3LEnfF1 16 | 4j6MjwlqXTqol2VgQn1yuQENBDo41N0QBACedJb7Qhm50JSPe1V+rSZKLHT5nc3l 17 | 2k1n7//wNsJkgDW2J7snIRjGtSzeNxMPh+hVzFidzAf3sbOlARQoBrMPPKpnJWtm 18 | 6LEDf2lSwO36l0/bo6qDRmiFRJoHWytTJEjxVwRclVt4bXqHfNw9FKhZZbcKeAN2 19 | oHgmBVSU6edHdwADBQP+OGAkEG4PcfSb8x191R+wkV/q2hA5Ay9z289Dx2rO28CO 20 | 4M2fhhcjSmgr6x0DsrkfESCiG47UGJ169eu+QqJwk3HiF4crGN9rE5+VelBVFtrd 21 | MWkX2rPLGQWyw8iCZKbeH8g/ujmkaLovSmalzDcLe4v1xSLaP7Fnfzit0iIGZAGI 22 | RgQYEQIABgUCOjjU3QAKCRCvgiRPnNn9VVSaAJ9+rj1lIQnRl20i8Rom2Hwbe3re 23 | 9QCfSYFnkZUw0yKF2DfCfqrDzdGAsbaIRgQYEQIABgUCOjjU3gAKCRCvgiRPnNn9 24 | Ve4iAJ9FrGMlFR7s+GWf1scTeeyrthKrPQCfSpc/Yps72aFI7hPfyIa9MuerVZ4= 25 | =QRit 26 | -----END PGP PUBLIC KEY BLOCK----- 27 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | For a list of the authors of the source code of GPGME, please see the 2 | file AUTHORS. The following people supported GPGME development in 3 | various ways (for example by finding bugs or giving advice), and we 4 | want to thank them for their help. If we forgot you, please let us 5 | know. 6 | 7 | Adriaan de Groot adridg@cs.kun.nl 8 | Albrecht Dreß albrecht.dress@arcor.de 9 | Alfons Hoogervorst alfons@proteus.demon.nl 10 | Daniel Mueller daniel@danm.de 11 | Enno Cramer uebergeek@web.de 12 | Frank Heckenbach frank@g-n-u.de 13 | Igor Belyi gpgme@katehok.ac93.org 14 | Jan-Oliver Wagner jan@intevation.de 15 | Johannes Poehlmann jhp@caldera.de 16 | Jose C. García Sogo jose@jaimedelamo.eu.org 17 | Leo Gaspard ekleog@gmail.com 18 | Mark Mutz mutz@kde.org 19 | Miguel Coca mcoca@gnu.org 20 | Noel Torres envite@rolamasao.org 21 | Patrick Spendrin patrick.spendrin@kdab.com 22 | Stéphane Corthésy stephane@sente.ch 23 | Timo Schulz twoaday@freakmail.de 24 | Tommy Reynolds reynolds@redhat.com 25 | W. Trevor King wking@tremily.us 26 | 27 | Copyright 2001, 2002, 2004, 2010, 2012 g10 Code GmbH 28 | 29 | This file is free software; as a special exception the author gives 30 | unlimited permission to copy and/or distribute it, with or without 31 | modifications, as long as this notice is preserved. 32 | 33 | This file is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 35 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 36 | -------------------------------------------------------------------------------- /lang/cl/README: -------------------------------------------------------------------------------- 1 | Common Lisp Support for GPGME 2 | ----------------------------- 3 | 4 | Requirements: 5 | 6 | ASDF Packaging Support 7 | CFFI Foreign Function Interface 8 | trivial-garbage Finalizers 9 | gpg-error GPG Error Codes 10 | 11 | Use with: 12 | 13 | > (asdf:load-system "gpgme") 14 | 15 | 16 | Examples 17 | -------- 18 | 19 | (with-open-file (out "/tmp/myout" 20 | :direction :output 21 | :if-exists :supersede 22 | :element-type '(unsigned-byte 8)) 23 | (with-context (ctx) 24 | (setf (armorp ctx) t) 25 | (op-export ctx "DEADBEEF" out))) 26 | 27 | (with-context (ctx) 28 | (with-output-to-string (out) 29 | (setf (armorp ctx) t) 30 | (op-export ctx "McTester" out))) 31 | 32 | (gpgme:with-context (ctx :armor t) 33 | (with-output-to-string (out) 34 | (gpgme:op-export ctx "McTester" out))) 35 | 36 | (gpgme:with-context (ctx :armor t) 37 | (let ((recipient1 (gpgme:get-key ctx "DEADBEEF")) 38 | (recipient2 (gpgme:get-key ctx "Alice")) 39 | (message "Hello, world!")) 40 | (with-output-to-string (out) 41 | (with-input-from-string (in message) 42 | (gpgme:op-encrypt ctx (vector recipient1 recipient2) in out))))) 43 | 44 | (gpgme:with-context (ctx :armor t) 45 | (let ((message "Hello, world!")) 46 | (with-output-to-string (out) 47 | (with-input-from-string (in message) 48 | (gpgme:op-sign ctx in out))))) 49 | 50 | 51 | TODO 52 | ---- 53 | 54 | * When GPGME defines macros for include cert values -2, -1, 0 and 1, 55 | define lisp macros for them as well. 56 | 57 | * 58 | -------------------------------------------------------------------------------- /lang/cl/gpgme-package.lisp: -------------------------------------------------------------------------------- 1 | ;;;; gpgme-package.lisp 2 | 3 | ;;; Copyright (C) 2006 g10 Code GmbH 4 | ;;; 5 | ;;; This file is part of GPGME-CL. 6 | ;;; 7 | ;;; GPGME-CL is free software; you can redistribute it and/or modify 8 | ;;; it under the terms of the GNU General Public License as published 9 | ;;; by the Free Software Foundation; either version 2 of the License, 10 | ;;; or (at your option) any later version. 11 | ;;; 12 | ;;; GPGME-CL is distributed in the hope that it will be useful, but 13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;;; Lesser General Public License for more details. 16 | ;;; 17 | ;;; You should have received a copy of the GNU General Public License 18 | ;;; along with GPGME; if not, write to the Free Software Foundation, 19 | ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | ;;; Conventions: 22 | ;;; 23 | ;;; gpg-error is used for error handling. 24 | ;;; 25 | ;;; Standard I/O streams are used for input and output. 26 | 27 | (defpackage #:gpgme 28 | (:use #:common-lisp #:cffi #:gpg-error) 29 | (:import-from #:trivial-garbage 30 | #:finalize) 31 | (:export #:check-version 32 | #:*version* 33 | #:context 34 | #:protocol 35 | #:armorp 36 | #:textmodep 37 | #:+include-certs-default+ 38 | #:include-certs 39 | #:keylist-mode 40 | #:signers 41 | #:sig-notations 42 | #:with-context 43 | #:key-data 44 | #:get-key 45 | #:op-encrypt 46 | #:op-decrypt 47 | #:op-sign 48 | #:op-verify 49 | #:op-import 50 | #:op-export)) 51 | -------------------------------------------------------------------------------- /src/stpcpy.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1992, 1995, 1997, 2002, 2004 Free Software Foundation, Inc. 2 | * This file is part of the GNU C Library. 3 | * 4 | * The GNU C Library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * The GNU C Library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, see . 16 | * SPDX-License-Identifier: LGPL-2.1-or-later 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | # include 21 | #endif 22 | 23 | #include 24 | 25 | #undef __stpcpy 26 | #undef stpcpy 27 | 28 | #ifndef weak_alias 29 | # define __stpcpy stpcpy 30 | #endif 31 | 32 | /* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */ 33 | char * 34 | __stpcpy (char *dest, const char *src) 35 | { 36 | register char *d = dest; 37 | register const char *s = src; 38 | 39 | do 40 | *d++ = *s; 41 | while (*s++ != '\0'); 42 | 43 | return d - 1; 44 | } 45 | #ifdef libc_hidden_def 46 | libc_hidden_def (__stpcpy) 47 | #endif 48 | #ifdef weak_alias 49 | weak_alias (__stpcpy, stpcpy) 50 | #endif 51 | #ifdef libc_hidden_builtin_def 52 | libc_hidden_builtin_def (stpcpy) 53 | #endif 54 | -------------------------------------------------------------------------------- /lang/js/DemoExtension/mainui.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 |
13 |
    14 |
  • 15 | Input 16 | 17 |
  • 18 |
  • 19 | Fingerprint of Key to use: 20 | 21 |   24 | 27 |
  • 28 |
29 |
30 |
31 |
    32 |
  • 33 | Result 34 | 35 |
  • 36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | 45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for gpgme.js. 2 | # Copyright (C) 2018 Intevation GmbH 3 | # 4 | # This file is part of GPGME. 5 | # 6 | # gpgme.js is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # gpgme.js is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | # 02111-1307, USA 20 | 21 | EXTRA_DIST = browsertest.html \ 22 | index.html \ 23 | longTests.html \ 24 | Makefile.am \ 25 | manifest.json \ 26 | popup.html \ 27 | popup.js \ 28 | runbrowsertest.js \ 29 | rununittests.js \ 30 | setup_testing.js \ 31 | testicon.png \ 32 | testkey2.pub \ 33 | testkey.pub \ 34 | testkey.sec \ 35 | tests/decryptTest.js \ 36 | tests/encryptDecryptTest.js \ 37 | tests/encryptTest.js \ 38 | tests/inputvalues.js \ 39 | tests/KeyImportExport.js \ 40 | tests/KeyInfos.js \ 41 | tests/longRunningTests.js \ 42 | tests/signTest.js \ 43 | tests/startup.js \ 44 | tests/verifyTest.js \ 45 | unittests.html 46 | -------------------------------------------------------------------------------- /tests/gpg/seckey-1.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PRIVATE KEY BLOCK----- 2 | Version: GnuPG v2.1.0-gitb3c71eb (GNU/Linux) 3 | 4 | lQHpBDo41NoRBADSfQazKGYf8nokq6zUKH/6INtV6MypSzSGmX2XErnARkIIPPYj 5 | cQRQ8zCbGV7ZU2ezVbzhFLUSJveE8PZUzzCrLp1O2NSyBTRcR5HVSXW95nJfY8eV 6 | pOvZRAKul0BVLh81kYTsrfzaaCjh9VWNP26LoeN2r+PjZyktXe7gM3C4SwCgoTxK 7 | WUVi9HoT2HCLY7p7oig5hEcEALdCJal0UYomX3nJapIVLVZg3vkidr1RICYMb2vz 8 | 58i17h8sxEtobD1vdIKNejulntaRAXs4n0tDYD9z7pRlwG1CLz1R9WxYzeOOqUDr 9 | fnVXdmU8L/oVWABat8v1V7QQhjMMf+41fuzVwDMMGqjVPLhu4X6wp3A8uyM3YDnQ 10 | VMN1A/4n2G5gHoOvjqxn8Ch5tBAdMGfO8gH4RjQOwzm2R1wPQss/yzUN1+tlMZGX 11 | K2dQ2FCWC/hDUSNaEQRlI15wxxBNZ2RQwlzE2A8v113DpvyzOtv0QO95gJ1teCXC 12 | 7j/BN9asgHaBBc39JLO/TcpuI7Hf8PQ5VcP2F0UE3lczGhXbLP4HAwL0A7A1a/jY 13 | 6s5JxysLUpKA31U2SrKxePmkmzYSuAiValUVdfkmLRrLSwmNJSy5NcrBHGimja1O 14 | fUUmPTg465j1+vD/tERKb2UgUmFuZG9tIEhhY2tlciAodGVzdCBrZXkgd2l0aCBw 15 | YXNzcGhyYXNlICJhYmMiKSA8am9lQGV4YW1wbGUuY29tPohiBBMRAgAiBQJNt1ep 16 | AhsjBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCvgiRPnNn9VRwIAJ9C9I+L 17 | //3+AG/xJWsro7gOLIP6MACfcsSd8XXiPoyPCWpdOqiXZWBCfXKdAWAEOjjU3RAE 18 | AJ50lvtCGbnQlI97VX6tJkosdPmdzeXaTWfv//A2wmSANbYnuychGMa1LN43Ew+H 19 | 6FXMWJ3MB/exs6UBFCgGsw88qmcla2bosQN/aVLA7fqXT9ujqoNGaIVEmgdbK1Mk 20 | SPFXBFyVW3hteod83D0UqFlltwp4A3ageCYFVJTp50d3AAMFA/44YCQQbg9x9Jvz 21 | HX3VH7CRX+raEDkDL3Pbz0PHas7bwI7gzZ+GFyNKaCvrHQOyuR8RIKIbjtQYnXr1 22 | 675ConCTceIXhysY32sTn5V6UFUW2t0xaRfas8sZBbLDyIJkpt4fyD+6OaRoui9K 23 | ZqXMNwt7i/XFIto/sWd/OK3SIgZkAf4HAwIoimqPHVJZM85dNw6JtvLKFvvmkm3X 24 | uoCUG5nU6cgk6vetUYiykuKpU4zG3mDtdZdIZf76hJJ6lZTSHH9frLy7bRYPfu/k 25 | U1AFd1T1OxENiEYEGBECAAYFAjo41N0ACgkQr4IkT5zZ/VVUmgCffq49ZSEJ0Zdt 26 | IvEaJth8G3t63vUAn0mBZ5GVMNMihdg3wn6qw83RgLG2iEYEGBECAAYFAjo41N4A 27 | CgkQr4IkT5zZ/VXuIgCfRaxjJRUe7Phln9bHE3nsq7YSqz0An0qXP2KbO9mhSO4T 28 | 38iGvTLnq1We 29 | =m0YJ 30 | -----END PGP PRIVATE KEY BLOCK----- 31 | -------------------------------------------------------------------------------- /LICENSES: -------------------------------------------------------------------------------- 1 | Additional license notices for GPGME. -*- org -*- 2 | 3 | This file contains the copying permission notices for various files in 4 | the GPGME distribution which are not covered by the GNU Lesser 5 | General Public License (LGPL) or the GNU General Public License (GPL). 6 | 7 | These notices all require that a copy of the notice be included 8 | in the accompanying documentation and be distributed with binary 9 | distributions of the code, so be sure to include this file along 10 | with any binary distributions derived from the GNU C Library. 11 | 12 | * MIT License 13 | 14 | For files: 15 | - cJSON.c, cJSON.h 16 | 17 | #+begin_quote 18 | Copyright (c) 2009 Dave Gamble 19 | 20 | Permission is hereby granted, free of charge, to any person obtaining 21 | a opy of this software and associated documentation files (the 22 | "Software"), to eal in the Software without restriction, including 23 | without limitation the ights to use, copy, modify, merge, publish, 24 | distribute, sublicense, and/or sell copies of the Software, and to 25 | permit persons to whom the Software is furnished to do so, subject to 26 | the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be 29 | included in all copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 32 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 33 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 34 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 35 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 36 | OF CONTRACT, TORT OR OTHERWISE, ARISING ROM, OUT OF OR IN CONNECTION 37 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 38 | #+end_quote 39 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/testkey.pub: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | 3 | mQENBFrsKEkBCADKw4Wt8J6M/88qD8PO6lSMCxH1cpwH8iK0uPaFFYsJkkXo7kWf 4 | PTAtrV+REqF/o80dvYcdLvRsV21pvncZz/HXLu1yQ18mC3XObrKokbdgrTTKA5XE 5 | BZkNsqyaMMJauT18H4hYkSg62/tTdO1cu/zWv/LFf7Xyn6+uA74ovXCJlO1s0N2c 6 | PShtr98QRzPMf2owgVk37JnDNp4gGVDGHxSZOuUwxgYAZYnA8SFc+c+3ZrQfY870 7 | +O4j3Mz4p7yD13AwP4buQLBsb/icxekeQCqpRJhLH9f7MdEcGXa1x36RcEkHdu+M 8 | yJ392eMgD+dKNfRCtyTPhjZTxvbNELIBYICfABEBAAG0EHRlc3RAZXhhbXBsZS5v 9 | cmeJAVQEEwEIAD4WIQTUFzW5Ejb9uIIEjFojAWNe7/DLBQUCWuwoSQIbAwUJA8Jn 10 | AAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRAjAWNe7/DLBf9kB/wOQ/S60HGw 11 | Fq07W9N01HWULyhHKoMmcHL6rfZ64oDqLxolPSasz7WAMW1jN4qtWJ0mFzwO83V6 12 | kaBe+wF6Kqir6udFSBW9rPcFg6/VZXPltT0a6uacIHq6DyQ5iMW4YQWbVy9OR2rN 13 | GkYo1JCBR0XdRJYCSX3yB4TWv/eXnZ37/WjmiTOIZh35rjs+NuU/S5JPDfAp2/k7 14 | 0DevQeBsv+UjVXjWpNTZmPbvDnd995uSmC6UY4hzyP84ORYMYn9n1QAR0goxDN6U 15 | unOf9Rlp1oMzdxMool/d1MlCxg2h3jheuhv7lgUF4KpvHOuEPXQ7UO417E0TYcDZ 16 | 1J8Nsv87SZeEuQENBFrsKEkBCADjoEBhG/QPqZHg8VyoD1xYRAWGxyDJkX/GrSs6 17 | yE+x2hk5FoQCajxKa/d4AVxOnJpdwhAfeXeSNaql5Ejgzax+Tdj9BV6vtGVJVv0p 18 | O7bgAiZxkA6RHxtNqhpPnPQoXvUzkzpRgpuL+Nj4yIg7z1ITH6KQH4u5SI9vd+j/ 19 | 8i9Taz67pdZwuJjac8qBuJHjzAo1bjYctFYUSG5pbmMQyNLySzgiNkFa4DajODlt 20 | 3RuqVGP316Fk+Sy2+60tC/HlX8jgMyMONfOGBQx6jk8tvAphS/LAqrrNepnagIyL 21 | UGKU+L8cB2g1PGGp2biBFWqZbudZoyRBet/0yH/zirBdQJw1ABEBAAGJATwEGAEI 22 | ACYWIQTUFzW5Ejb9uIIEjFojAWNe7/DLBQUCWuwoSQIbDAUJA8JnAAAKCRAjAWNe 23 | 7/DLBf0pCACPp5hBuUWngu2Hqvg+tNiujfsiYzId3MffFxEk3CbXeHcJ5F32NDJ9 24 | PYCnra4L8wSv+NZt9gIa8lFwoFSFQCjzH7KE86XcV3MhfdJTNb/+9CR7Jq3e/4Iy 25 | 0N5ip7PNYMCyakcAsxvsNCJKrSaDuYe/OAoTXRBtgRWE2uyT315em02Lkr+2Cc/Q 26 | k6H+vlNOHGRgnpI/OZZjnUuUfBUvMGHr1phW+y7aeymC9PnUGdViRdJe23nntMSD 27 | A+0/I7ESO9JsWvJbyBmuiZpu9JjScOjYH9xpQLqRNyw4WHpZriN69F0t9Mmd7bM1 28 | +UyPgbPEr0iWMeyctYsuOLeUyQKMscDT 29 | =QyY6 30 | -----END PGP PUBLIC KEY BLOCK----- 31 | -------------------------------------------------------------------------------- /src/parsetlv.h: -------------------------------------------------------------------------------- 1 | /* parsetlv.h - TLV functions definitions 2 | * Copyright (C) 2012 g10 Code GmbH 3 | * 4 | * This file is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as 6 | * published by the Free Software Foundation; either version 2.1 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This file is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #ifndef PARSETLV_H 19 | #define PARSETLV_H 20 | 21 | /* ASN.1 constants. */ 22 | #define ASN1_CLASS_UNIVERSAL 0 23 | #define ASN1_CLASS_APPLICATION 1 24 | #define ASN1_CLASS_CONTEXT 2 25 | #define ASN1_CLASS_PRIVATE 3 26 | #define ASN1_TAG_INTEGER 2 27 | #define ASN1_TAG_OBJECT_ID 6 28 | #define ASN1_TAG_SEQUENCE 16 29 | 30 | 31 | /* Object used with parse_tlv. */ 32 | struct tlvinfo_s 33 | { 34 | int cls; /* The class of the tag. */ 35 | int tag; /* The tag. */ 36 | int is_cons; /* True if it is a constructed object. */ 37 | int is_ndef; /* True if the object has an indefinite length. */ 38 | size_t length; /* The length of the value. */ 39 | size_t nhdr; /* The number of octets in the header (tag,length). */ 40 | }; 41 | typedef struct tlvinfo_s tlvinfo_t; 42 | 43 | /*-- parsetlv.c --*/ 44 | int _gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti); 45 | #define parse_tlv(a,b,c) _gpgme_parse_tlv ((a), (b), (c)) 46 | 47 | 48 | #endif /*PARSETLV_H*/ 49 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/testkey2.pub: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | 3 | mQENBFsMHecBCACqdJgqa+CeNYwPCK+MpOwAV6uFVjDyO2LmOs6+XfDWRBU/Zjtz 4 | 8zdYNKSbLjkWN4ujV5aiyA7MtEofszzYLEoKUt1wiDScHMpW8qmEFDvl9g26MeAV 5 | rTno9D5KodHvEIs8wnrqBs8ix0WLbh6J1Dtt8HQgIbN+v3gaRQrgBFe6z2ZYpHHx 6 | ZfOu3iFKlm2WE/NekRkvvFIo3ApGvRhGIYw6JMmugBlo7s5xosJK0I9dkPGlEEtt 7 | aF1RkcMj8sWG9vHAXcjlGgFfXSN9YLppydXpkuZGm4+gjLB2a3rbQCZVFnxCyG4O 8 | ybjkP8Jw6Udm89bK2ucYFfjdrmYn/nJqRxeNABEBAAG0I1Rlc3QgTm9Qcml2S2V5 9 | IDxub2JvZHlAZXhhbXBsZS5vcmc+iQFOBBMBCAA4FiEE4Fmh4IZtMa4TEXCITZou 10 | EzBBU9EFAlsMHecCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQTZouEzBB 11 | U9F+qwf/SHj4uRnTWgyJ71FBxQDYCBq3jbi6e7hMkRPbJyJdnPIMAb2p0PJjBgjW 12 | 0pp4+kDPZans3UDHbma1u/SFI4/y6isJiK94Bk5xp5YliLGnUceTjgDFe6lBhfQ1 13 | zVWZC/NF3tPgbziIxXQTNt34nS+9dbV/QFDLW0POcN7C0jR/hgkBjMEH2PezWhSj 14 | mL/yLfLfUYAoxVpXjfC5aPJKqw0tR7m5ibznjCphE+FUMRg8EOmJcg6soeJ5QspU 15 | k2dPN3+Y0zCTNRgAHEI+yIQbM6pio6v2c+UCtT1QhW4xSI38/kcEG8QiM55r1TUy 16 | FcWAY5n5t1nNZtMxxse3LqEon3rKiLkBDQRbDB3nAQgAqfAjSjcngERtM+ZYOwN0 17 | QF2v2FuEuMe8mhju7Met7SN2zGv1LnjhTNshEa9IABEfjZirE2Tqx4xCWDwDedK4 18 | u1ToFvcnuAMnq2O47Sh+eTypsf6WPFtPBWf6ctKY31hFXjgoyDBULBvl43XU/D9C 19 | Mt7nsKDPYHVrrnge/qWPYVcb+cO0sSwNImMcwQSdTQ3VBq7MeNS9ZeBcXi+XCjhN 20 | kjNum2AQqpkHHDQV7871yQ8RIILvZSSfkLb0/SNDU+bGaw2G3lcyKdIfZi2EWWZT 21 | oCbH38I/+LV7nAEe4zFpHwW8X0Dkx2aLgxe6UszDH9L3eGhTLpJhOSiaanG+zZKm 22 | +QARAQABiQE2BBgBCAAgFiEE4Fmh4IZtMa4TEXCITZouEzBBU9EFAlsMHecCGwwA 23 | CgkQTZouEzBBU9H5TQgAolWvIsez/WW8N2tmZEnX0LOFNB+1S4L4X983njwNdoVI 24 | w19pbj+8RIHF/H9kcPGi7jK96gvlykQn3uez/95D2AiRFW5KYdOouFisKgHpv8Ay 25 | BrhclHv11yK+X/0iTD0scYaG7np5162xLkaxSO9hsz2fGv20RKaXCWkI69fWw0BR 26 | XlI5pZh2YFei2ZhH/tIMIW65h3w0gtgaZBBdpZTOOW4zvghyN+0MSObqkI1BvUJu 27 | caDFI4d6ZTmp5SY+pZyktZ4bg/vMH5VFxdIKgbLx9uVeTvOupvbAW0TNulYGUBQE 28 | nm+S0zr3W18t64e4sS3oHse8zCqo1iiImpba6F1Oaw== 29 | =y6DD 30 | -----END PGP PUBLIC KEY BLOCK----- 31 | -------------------------------------------------------------------------------- /tests/json/t-export-secret-info.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "keys", 3 | "base64": false, 4 | "data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQGiBDbjjp4RBAC2ZbFDX0wmJI8yLDYQdIiZeAuHLmfyHsqXaLGUMZtWiAvn/hNp\nctwahmzKm5oXinHUvUkLOQ0s8rOlu15nhw4azc30rTP1LsIkn5zORNnFdgYC6RKy\nhOeim/63+/yGtdnTm49lVfaCqwsEmBCEkXaeWDGq+ie1b89J89T6n/JquwCgoQkj\nVeVGG+B/SzJ6+yifdHWQVkcD/RXDyLXX4+WHGP2aet51XlKojWGwsZmc9LPPYhwU\n/RcUO7ce1QQb0XFlUVFBhY0JQpM/ty/kNi+aGWFzigbQ+HAWZkUvA8+VIAVneN+p\n+SHhGIyLTXKpAYTq46AwvllZ5Cpvf02Cp/+W1aVyA0qnBWMyeIxXmR9HOi6lxxn5\ncjajA/9VZufOXWqCXkBvz4Oy3Q5FbjQQ0/+ty8rDn8OTaiPi41FyUnEi6LO+qyBS\n09FjnZj++PkcRcXW99SNxmEJRY7MuNHt5wIvEH2jNEOJ9lszzZFBDbuwsjXHK35+\nlPbGEy69xCP26iEafysKKbRXJhE1C+tk8SnK+Gm62sivmK/5arQpQWxwaGEgVGVz\ndCAoZGVtbyBrZXkpIDxhbHBoYUBleGFtcGxlLm5ldD6IVQQTEQIAFQUCNuOOngML\nCgMDFQMCAxYCAQIXgAAKCRAtcnzHaGl3NDl4AKCBLmRplv/8ZfSqep5IjqEAuaXv\nWwCgl6NEzT+/WewPTGcwZY+pLkycLv2IVQQTEQIAFQUCNuOOngMLCgMDFQMCAxYC\nAQIXgAAKCRAtcnzHaGl3NDl4AJ4rouHB+LpCkNi5C59jHEa1kbANzACgmddtrNSj\n1yPyTCwUwRghPUomECS0EEFsaWNlIChkZW1vIGtleSmIVQQTEQIAFQUCNuO2qwML\nCgMDFQMCAxYCAQIXgAAKCRAtcnzHaGl3NCeMAJ9MeUVrago5Jc6PdwdeN5OMwby3\n7QCghW65cZTQlD1bBlIq/QM8bz9AN4G0J0FsZmEgVGVzdCAoZGVtbyBrZXkpIDxh\nbGZhQGV4YW1wbGUubmV0PohVBBMRAgAVBQI247hYAwsKAwMVAwIDFgIBAheAAAoJ\nEC1yfMdoaXc0t8IAoJPwa6j+Vm5Vi3Nvuo8JZri4PJ/DAJ9dqbmaJdB8FdJnHfGh\n1rXK3y/JcrkBDQQ2448PEAQAnI3XH1f0uyN9fZnw72zsHMw706g7EW29nD4UDQG4\nOzRZViSrUa5n39eI7QrfTO+1meVvs0y8F/PvFst5jH68rPLnGSrXz4sTl1T4cop1\nFBkquvCAKwPLy0lE7jjtCyItOSwIOo8xoTfY4JEEXmcqsbm+KHv9yYSF/YK4Cf7b\nIzcAAwcD/Rnl5jKxoucDA96pD2829TKsLFQSau+Xiy8bvOSSDdlyABsOkNBSaeKO\n3eAQEKgDM7dzjVNTnAlpQ0EQ8Y9Z8pxOWYEQYlaMrnRBC4DZ2IadzEhLlIOz5BVp\n/jfhrr8oVVBwKZXsrz9PZLz+e4Yn+siUUvlei9boD9L2ZgSOHakPiEYEGBECAAYF\nAjbjjw8ACgkQLXJ8x2hpdzQgqQCfcDXmD8uNVdKg/C9vqI3JSndqknsAnRxzVeHi\n/iJ73OCKtvFrHbV9Gogq\n=6f6v\n-----END PGP PUBLIC KEY BLOCK-----\n", 5 | "sec-fprs": ["A0FF4590BB6122EDEF6E3C542D727CC768697734"] 6 | } 7 | -------------------------------------------------------------------------------- /m4/ChangeLog-2011: -------------------------------------------------------------------------------- 1 | 2011-12-02 Werner Koch 2 | 3 | NB: ChangeLog files are no longer manually maintained. Starting 4 | on December 1st, 2011 we put change information only in the GIT 5 | commit log, and generate a top-level ChangeLog file from logs at 6 | "make dist". See doc/HACKING for details. 7 | 8 | 2011-04-06 Werner Koch 9 | 10 | * gpg-error.m4: Update from current libgpg-error repo. 11 | 12 | 2010-05-07 Werner Koch 13 | 14 | * libassuan.m4: Update from libassuan svn. 15 | 16 | 2009-11-10 Marcus Brinkmann 17 | 18 | * libassuan.m4: Fix LIBASSUAN_VERSION. 19 | 20 | 2006-06-08 Marcus Brinkmann 21 | 22 | * pth.m4: Add --all to pth-config invocation. 23 | 24 | 2006-02-22 Marcus Brinkmann 25 | 26 | * pth.m4: Fix code generation (required for Max OS X). 27 | Submitted by Emanuele Giaquinta . 28 | 29 | 2005-11-17 Marcus Brinkmann 30 | 31 | * glib-2.0.m4: New file. 32 | 33 | 2004-12-28 Werner Koch 34 | 35 | * pth.m4: Changed quoting for use with automake 1.9. 36 | 37 | 2004-09-14 Marcus Brinkmann 38 | 39 | * pth.m4: Disable _ac_pth_line, and don't fail if Pth is not 40 | found. 41 | 42 | * glibc21.m4: New file. 43 | * gpg-error.m4: New file. 44 | * pth.m4: New file. 45 | 46 | 47 | Copyright (C) 2004, 2005, 2009, 2010, 2011 g10 Code GmbH 48 | 49 | This file is free software; as a special exception the author gives 50 | unlimited permission to copy and/or distribute it, with or without 51 | modifications, as long as this notice is preserved. 52 | 53 | This file is distributed in the hope that it will be useful, but 54 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 55 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 56 | -------------------------------------------------------------------------------- /lang/js/jsdoc_index.md: -------------------------------------------------------------------------------- 1 | Using gpgme.js 2 | --------------- 3 | At first, make sure that the environment you want to use gpgme.js in has access 4 | and permissions for nativeMessaging, and gpgme-json installed. For details, 5 | see the README. 6 | 7 | The library itself is started via the {@link init} method. This will test the 8 | nativeMessaging connection, and then resolve into an Object offering 9 | the top level API: 10 | 11 | * [encrypt]{@link GpgME#encrypt} 12 | * [decrypt]{@link GpgME#decrypt} 13 | * [sign]{@link GpgME#sign} 14 | * [verify]{@link GpgME#verify} 15 | * [Keyring]{@link GPGME_Keyring} 16 | 17 | ``` 18 | gpgmejs.init() 19 | .then(function(GPGME) { 20 | // using GPGME 21 | }, function(error){ 22 | // error handling; 23 | }) 24 | ``` 25 | 26 | All methods that require communication with nativeMessaging are asynchronous, 27 | using Promises. Rejections will be instances of {@link GPGME_Error}. 28 | 29 | An exaeption are Keys, which can be initialized in a 'sync' mode, allowing them 30 | to be cached and used synchronously until manually refreshed. 31 | 32 | Keyring and Keys 33 | ---------------- 34 | The gnupg keys can be accessed via the [Keyring]{@link GPGME_Keyring}. 35 | 36 | The Keyring offers the methods for accessing information on all Keys known to 37 | gnupg. 38 | 39 | **Due to security constraints, the javascript-binding currently only offers 40 | limited support for secret-Key interaction.** 41 | 42 | The existence of secret Keys is not secret, and those secret Keys can be used 43 | for signing, but Operations that may expose, modify or delete secret Keys are 44 | not supported. 45 | 46 | * [getKeysArmored]{@link GPGME_Keyring#getKeysArmored} 47 | * [getKeys]{@link GPGME_Keyring#getKeys} 48 | * [getDefaultKey]{@link GPGME_Keyring#getDefaultKey} 49 | * [generateKey]{@link GPGME_Keyring#generateKey} 50 | * [deleteKey]{@link GPGME_Keyring#deleteKey} 51 | -------------------------------------------------------------------------------- /tests/json/t-decrypt-verify.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "dec_info": { 3 | "symkey_algo": "TWOFISH.CFB", 4 | "wrong_key_usage": false, 5 | "is_de_vs": false, 6 | "is_mime": false, 7 | "legacy_cipher_nomdc": false, 8 | "recipients": [{ 9 | "keyid": "6AE6D7EE46A871F8", 10 | "pubkey_algo_name": "ELG-E", 11 | "status_string": "Success", 12 | "status_code": 0 13 | }] 14 | }, 15 | "info": { 16 | "is_mime": false, 17 | "signatures": [{ 18 | "summary": { 19 | "sigsum": [], 20 | "valid": false, 21 | "green": false, 22 | "red": false, 23 | "revoked": false, 24 | "key-expired": false, 25 | "sig-expired": false, 26 | "key-missing": false, 27 | "crl-missing": false, 28 | "crl-too-old": false, 29 | "bad-policy": false, 30 | "sys-error": false 31 | }, 32 | "wrong_key_usage": false, 33 | "chain_model": false, 34 | "is_de_vs": false, 35 | "status_string": "Success", 36 | "fingerprint": "A0FF4590BB6122EDEF6E3C542D727CC768697734", 37 | "validity_string": "unknown", 38 | "pubkey_algo_name": "DSA", 39 | "hash_algo_name": "RIPEMD160", 40 | "status_code": 0, 41 | "timestamp": 1542200353, 42 | "exp_timestamp": 0, 43 | "pka_trust": 0, 44 | "validity": 0, 45 | "validity_reason": 0 46 | }] 47 | }, 48 | "type": "plaintext", 49 | "base64": false, 50 | "data": "Hello world" 51 | } 52 | -------------------------------------------------------------------------------- /lang/cl/ChangeLog-2011: -------------------------------------------------------------------------------- 1 | 2011-12-02 Werner Koch 2 | 3 | NB: ChangeLog files are no longer manually maintained. Starting 4 | on December 1st, 2011 we put change information only in the GIT 5 | commit log, and generate a top-level ChangeLog file from logs at 6 | "make dist". See doc/HACKING for details. 7 | 8 | 2008-11-08 Moritz 9 | 10 | * gpgme.lisp (size-t): Wrong call to defctype: function accepts 11 | optional, not keyword argument. 12 | (ssize-t): Likewise. 13 | (off-t): Likewise. 14 | (gpgme-data-t, gpgme-ctx-t): Likewise. 15 | (gpgme-error-t): Likewise. 16 | (gpgme-error-no-signal-t): Likewise. 17 | (gpgme-err-code-t): Likewise. 18 | (gpgme-err-source-t): Likewise. 19 | (gpgme-sig-notation-t, gpgme-engine-info-t): Likewise. 20 | (gpgme-subkey-t): Likewise. 21 | (gpgme-key-sig-t): Likewise. 22 | (gpgme-user-id-t): Likewise. 23 | (gpgme-key-t): Likewise. 24 | (gpgme-data-cbs-t): Likewise. 25 | (gpgme-invalid-key-t): Likewise. 26 | (gpgme-op-encrypt-result-t): Likewise. 27 | (gpgme-recipient-t): Likewise. 28 | (gpgme-op-decrypt-result-t): Likewise. 29 | (gpgme-new-signature-t): Likewise. 30 | (gpgme-op-sign-result-t): Likewise. 31 | (gpgme-signature-t): Likewise. 32 | (gpgme-op-verify-result-t): Likewise. 33 | (gpgme-import-status-t): Likewise. 34 | (gpgme-op-import-result-t): Likewise. 35 | (gpgme-op-genkey-result-t): Likewise. 36 | (gpgme-op-keylist-result-t): Likewise. 37 | 38 | 2006-07-06 Marcus Brinkmann 39 | 40 | * Initial release. 41 | 42 | Copyright (C) 2006, 2008 g10 Code GmbH 43 | 44 | This file is free software; as a special exception the author gives 45 | unlimited permission to copy and/or distribute it, with or without 46 | modifications, as long as this notice is preserved. 47 | 48 | This file is distributed in the hope that it will be useful, but 49 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 50 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 51 | -------------------------------------------------------------------------------- /gpgme.spec.in: -------------------------------------------------------------------------------- 1 | # This is a template. The dist target uses it to create the real file. 2 | Summary: GPGME - GnuPG Made Easy 3 | Name: gpgme 4 | Version: @pkg_version@ 5 | Release: 1 6 | URL: https://gnupg.org/gpgme.html 7 | Source: https://www.gnupg.org/ftp/gcrypt/gpgme/%{name}-%{version}.tar.gz 8 | Group: Development/Libraries 9 | Copyright: GPL 10 | BuildRoot: %{_tmppath}/%{name}-%{version} 11 | BuildRequires: make 12 | Prereq: /sbin/ldconfig /sbin/install-info 13 | Requires: gnupg 14 | 15 | %description 16 | GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG easier 17 | for applications. It provides a High-Level Crypto API for encryption, 18 | decryption, signing, signature verification and key management. 19 | 20 | %prep 21 | %setup -q 22 | 23 | %build 24 | CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS 25 | ./configure --prefix=/usr 26 | make 27 | 28 | %install 29 | rm -fr $RPM_BUILD_ROOT 30 | mkdir -p $RPM_BUILD_ROOT 31 | make install prefix=$RPM_BUILD_ROOT/usr infodir=$RPM_BUILD_ROOT%{_infodir} 32 | rm -f $RPM_BUILD_ROOT%{_infodir}/dir 33 | 34 | %clean 35 | rm -fr $RPM_BUILD_ROOT 36 | make distclean 37 | 38 | %post 39 | /sbin/ldconfig 40 | /sbin/install-info %{_infodir}/gpgme.info.gz %{_infodir}/dir 41 | 42 | %preun 43 | if [ "$1" = 0 ]; then 44 | /sbin/install-info --delete %{_infodir}/gpgme.info.gz %{_infodir}/dir 45 | fi 46 | 47 | %postun 48 | /sbin/ldconfig 49 | 50 | %files 51 | %defattr(-,root,root) 52 | %doc COPYING COPYING.LESSER AUTHORS README INSTALL NEWS ChangeLog TODO THANKS 53 | %attr(0755,root,root) %{_bindir}/gpgme-config 54 | %attr(0755,root,root) %{_libdir}/*gpgme.so* 55 | %attr(0755,root,root) %{_libdir}/*gpgme.la 56 | %attr(0644,root,root) %{_libdir}/*gpgme.a 57 | %{_includedir}/gpgme.h 58 | %{_datadir}/aclocal/gpgme.m4 59 | %{_infodir}/gpgme.info* 60 | 61 | %changelog 62 | * Sat Aug 30 2003 Robert Schiele 63 | - %{_infodir}/dir is not packaged, remove to prevent checking failure 64 | * Mon Jul 01 2002 Wojciech Polak 65 | - initial specfile release for GPGME. 66 | 67 | # EOF 68 | -------------------------------------------------------------------------------- /doc/gpgme-json.texi: -------------------------------------------------------------------------------- 1 | \input texinfo @c -*- mode: texinfo; coding: utf-8; -*- 2 | @documentencoding UTF-8 3 | @setfilename gpgme-json.info 4 | @include defs.inc 5 | 6 | @manpage gpgme-json.1 7 | @ifset manverb 8 | .B gpgme-json 9 | \- Native messaging based GPGME operations 10 | @end ifset 11 | 12 | @mansect synopsis 13 | @ifset manverb 14 | .B gpgme-json 15 | .RB [ \-\-interactive | \-i ] 16 | .RB [ \-\-single | \-s ] 17 | .RB [ \-\-identify 18 | .IR file ] 19 | .RB [ \-\-lib\-version ] 20 | .RB [ \-\-help | \-h ] 21 | @end ifset 22 | 23 | @mansect description 24 | @command{gpgme-json} is a JSON to GPGME bridge. 25 | This interface allows web-browser extensions to communicate with the 26 | GPGME library through the Native Messaging facility from web-browser. 27 | 28 | 29 | @mansect options 30 | @command{gpgme-json} accepts the following options on the command line: 31 | 32 | @item -i 33 | @itemx --interactive 34 | @opindex interactive 35 | Enable interactive mode. Interactive mode also provides some online help. 36 | 37 | @item -s 38 | @itemx --single 39 | @opindex single 40 | Enable single request mode. 41 | 42 | @item --identify @var{file|-} 43 | @opindex identify 44 | Identify the type of the data found in @file{file} or standard input @var{-}. 45 | 46 | @item --debug 47 | @opindex single 48 | Enable debug mode. Logs are saved to to @file{~/.gnupg/S.gpgme-json.log}. 49 | 50 | Note that you can also turn debug mode on and specify a custom logfile using 51 | the environment variable @code{GPGME_JSON_DEBUG}. 52 | 53 | @item --lib-version 54 | @opindex version 55 | Print GPGME library version. 56 | 57 | @item -h 58 | @itemx --help 59 | @opindex help 60 | Print a usage message summarizing the most useful command-line options. 61 | 62 | @mansect bugs 63 | Please report bugs to . 64 | 65 | @mansect copyright 66 | @command{gpgme-json} is Copyright 2018-2024 g10 Code GmbH. 67 | LGPL version 2.1 or later 68 | 69 | This is free software: you are free to change and redistribute it. 70 | There is NO WARRANTY, to the extent permitted by law. 71 | -------------------------------------------------------------------------------- /tests/json/t-sig-notations.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "is_mime": false, 4 | "signatures": [{ 5 | "summary": { 6 | "sigsum": [], 7 | "valid": false, 8 | "green": false, 9 | "red": false, 10 | "revoked": false, 11 | "key-expired": false, 12 | "sig-expired": false, 13 | "key-missing": false, 14 | "crl-missing": false, 15 | "crl-too-old": false, 16 | "bad-policy": false, 17 | "sys-error": false 18 | }, 19 | "wrong_key_usage": false, 20 | "chain_model": false, 21 | "is_de_vs": false, 22 | "status_string": "Success", 23 | "fingerprint": "A0FF4590BB6122EDEF6E3C542D727CC768697734", 24 | "validity_string": "unknown", 25 | "pubkey_algo_name": "DSA", 26 | "hash_algo_name": "SHA1", 27 | "status_code": 0, 28 | "timestamp": 1542213871, 29 | "exp_timestamp": 0, 30 | "pka_trust": 0, 31 | "validity": 0, 32 | "validity_reason": 0, 33 | "notations": [{ 34 | "human_readable": false, 35 | "critical": false, 36 | "value": "https://www.gnu.org/policy/", 37 | "flags": 0 38 | }, { 39 | "human_readable": true, 40 | "critical": false, 41 | "name": "laughing@me", 42 | "value": "Just Squeeze Me", 43 | "flags": 1 44 | }, { 45 | "human_readable": true, 46 | "critical": true, 47 | "name": "preferred-email-encoding@pgp.com", 48 | "value": "pgpmime", 49 | "flags": 3 50 | }] 51 | }] 52 | }, 53 | "type": "plaintext", 54 | "base64": false, 55 | "data": "Hallo Leute\n" 56 | } 57 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - Makefile for GPGME tests. 2 | # Copyright (C) 2000 Werner Koch (dd9jn) 3 | # Copyright (C) 2001, 2004 g10 Code GmbH 4 | # 5 | # This file is part of GPGME. 6 | # 7 | # GPGME is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU Lesser General Public License as 9 | # published by the Free Software Foundation; either version 2.1 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # GPGME is distributed in the hope that it will be useful, but WITHOUT 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | # Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this program; if not, see . 19 | # SPDX-License-Identifier: LGPL-2.1-or-later 20 | 21 | ## Process this file with automake to produce Makefile.in 22 | 23 | GNUPGHOME=$(abs_builddir) 24 | TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) 25 | 26 | TESTS = t-version t-data t-engine-info 27 | 28 | EXTRA_DIST = start-stop-agent t-data-1.txt t-data-2.txt ChangeLog-2011 29 | 30 | AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ 31 | 32 | if HAVE_W32_SYSTEM 33 | AM_LDFLAGS = -no-fast-install 34 | else 35 | AM_LDFLAGS = -no-install 36 | endif 37 | 38 | LDADD = ../src/libgpgme.la @GPG_ERROR_LIBS@ @LDADD_FOR_TESTS_KLUDGE@ 39 | 40 | noinst_HEADERS = run-support.h 41 | 42 | noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \ 43 | run-verify run-encrypt run-identify run-decrypt run-genkey \ 44 | run-keysign run-tofu run-swdb run-threaded \ 45 | run-receive-keys run-setownertrust run-genrandom 46 | 47 | run_threaded_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_MT_CFLAGS@ 48 | run_threaded_LDADD = ../src/libgpgme.la \ 49 | @GPG_ERROR_MT_LIBS@ @LDADD_FOR_TESTS_KLUDGE@ 50 | 51 | if RUN_GPG_TESTS 52 | gpgtests = gpg json 53 | else 54 | gpgtests = 55 | endif 56 | 57 | if RUN_GPGSM_TESTS 58 | gpgsmtests = gpgsm opassuan 59 | else 60 | gpgsmtests = 61 | endif 62 | 63 | SUBDIRS = ${gpgtests} ${gpgsmtests} 64 | -------------------------------------------------------------------------------- /tests/gpg/mkdemodirs.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2004 g10 Code GmbH 3 | # 4 | # This file is part of GPGME. 5 | # 6 | # GPGME is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | # Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | set -e 21 | 22 | GPG="@GPG@ --batch --quiet --no-secmem-warning --no-permission-warning" 23 | NAMES='Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India 24 | Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo 25 | Sierra Tango Uniform Victor Whisky XRay Yankee Zulu' 26 | 27 | if [ "$1" = "--clean" ]; then 28 | (for i in $NAMES; do 29 | [ -d $i ] && rm -r $i || true 30 | done) || true 31 | exit 0 32 | fi 33 | 34 | [ -z "$srcdir" ] && srcdir="../tests" 35 | 36 | 37 | $GPG --dearmor -o secdemo.gpg --yes $srcdir/secdemo.asc 38 | $GPG --dearmor -o pubdemo.gpg --yes $srcdir/pubdemo.asc 39 | [ -f ./tdb.tmp ] && rm ./tdb.tmp 40 | GPGDEMO="$GPG --homedir . --trustdb-name ./tdb.tmp --no-default-keyring 41 | --keyring pubdemo.gpg --secret-keyring secdemo.gpg" 42 | echo -n "Creating:" 43 | for name in $NAMES; do 44 | echo -n " $name" 45 | [ -d $name ] && rm -r $name 46 | mkdir $name 47 | $GPGDEMO --export-secret-key -o - $name > $name/Secret.gpg 48 | $GPG --homedir $name --import $name/Secret.gpg 49 | $GPGDEMO --export -o - $name > $name/Public.gpg 50 | $GPG --homedir $name --import $name/Public.gpg 51 | [ -f $name/pubring.gpg~ ] && rm $name/pubring.gpg~ 52 | done 53 | echo "." 54 | [ -f ./tdb.tmp ] && rm ./tdb.tmp 55 | rm pubdemo.gpg secdemo.gpg 56 | -------------------------------------------------------------------------------- /src/sys-util.h: -------------------------------------------------------------------------------- 1 | /* sys-util.h - System utilities not generally used. 2 | * Copyright (C) 2013 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef SYS_UTIL_H 21 | #define SYS_UTIL_H 22 | 23 | /*-- {posix,w32}-util.c --*/ 24 | int _gpgme_set_default_gpg_name (const char *name); 25 | int _gpgme_set_default_gpgconf_name (const char *name); 26 | int _gpgme_set_override_inst_dir (const char *dir); 27 | int _gpgme_set_get_inst_type (const char *value); 28 | 29 | char *_gpgme_get_gpg_path (void); 30 | char *_gpgme_get_gpgconf_path (void); 31 | 32 | int _gpgme_access (const char *path_utf8, int mode); 33 | 34 | #ifdef HAVE_W32_SYSTEM 35 | const char *_gpgme_get_inst_dir (void); 36 | void _gpgme_w32_cancel_synchronous_io (HANDLE thread); 37 | /* See CreateProcessA returns true on success */ 38 | int _gpgme_create_process_utf8 (const char *application_name_utf8, 39 | char *command_line_utf8, 40 | LPSECURITY_ATTRIBUTES lpProcessAttributes, 41 | LPSECURITY_ATTRIBUTES lpThreadAttributes, 42 | BOOL bInheritHandles, 43 | DWORD dwCreationFlags, 44 | void *lpEnvironment, 45 | char *working_directory_utf8, 46 | LPSTARTUPINFOA lpStartupInfo, 47 | LPPROCESS_INFORMATION lpProcessInformation); 48 | #endif 49 | 50 | #endif /* SYS_UTIL_H */ 51 | -------------------------------------------------------------------------------- /src/data-fd.c: -------------------------------------------------------------------------------- 1 | /* data-fd.c - A file descriptor based data object. 2 | * Copyright (C) 2002, 2004 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #ifdef HAVE_UNISTD_H 26 | # include 27 | #endif 28 | #ifdef HAVE_SYS_TYPES_H 29 | # include 30 | #endif 31 | 32 | #include "debug.h" 33 | #include "data.h" 34 | 35 | 36 | static gpgme_ssize_t 37 | fd_read (gpgme_data_t dh, void *buffer, size_t size) 38 | { 39 | return read (dh->data.fd, buffer, size); 40 | } 41 | 42 | 43 | static gpgme_ssize_t 44 | fd_write (gpgme_data_t dh, const void *buffer, size_t size) 45 | { 46 | return write (dh->data.fd, buffer, size); 47 | } 48 | 49 | 50 | static gpgme_off_t 51 | fd_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) 52 | { 53 | return lseek (dh->data.fd, offset, whence); 54 | } 55 | 56 | 57 | static int 58 | fd_get_fd (gpgme_data_t dh) 59 | { 60 | return (dh->data.fd); 61 | } 62 | 63 | 64 | static struct _gpgme_data_cbs fd_cbs = 65 | { 66 | fd_read, 67 | fd_write, 68 | fd_seek, 69 | NULL, 70 | fd_get_fd 71 | }; 72 | 73 | 74 | gpgme_error_t 75 | gpgme_data_new_from_fd (gpgme_data_t *r_dh, int fd) 76 | { 77 | gpgme_error_t err; 78 | TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_fd", r_dh, "fd=%d", fd); 79 | 80 | err = _gpgme_data_new (r_dh, &fd_cbs); 81 | if (err) 82 | return TRACE_ERR (err); 83 | 84 | (*r_dh)->data.fd = fd; 85 | TRACE_SUC ("dh=%p", *r_dh); 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /tests/gpg/t-wait.c: -------------------------------------------------------------------------------- 1 | /* t-wait.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | /* We need to include config.h so that we know whether we are building 23 | with large file system (LFS) support. */ 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #ifdef HAVE_W32_SYSTEM 33 | #define sleep _sleep 34 | #endif 35 | 36 | #include 37 | 38 | #include "t-support.h" 39 | 40 | 41 | int 42 | main (void) 43 | { 44 | gpgme_ctx_t ctx; 45 | gpgme_error_t err; 46 | gpgme_data_t sig, text; 47 | 48 | init_gpgme (GPGME_PROTOCOL_OpenPGP); 49 | 50 | err = gpgme_new (&ctx); 51 | fail_if_err (err); 52 | 53 | /* Checking a message without a signature. */ 54 | err = gpgme_data_new_from_mem (&sig, "foo\n", 4, 0); 55 | fail_if_err (err); 56 | err = gpgme_data_new (&text); 57 | fail_if_err (err); 58 | err = gpgme_op_verify_start (ctx, sig, NULL, text); 59 | fail_if_err (err); 60 | 61 | while (gpgme_wait (ctx, &err, 0) == NULL && err == 0) 62 | sleep(1); 63 | 64 | if (gpgme_err_code (err) != GPG_ERR_NO_DATA) 65 | { 66 | fprintf (stderr, "%s:%d: %s: %s\n", 67 | __FILE__, __LINE__, gpgme_strsource (err), 68 | gpgme_strerror (err)); 69 | exit (1); 70 | } 71 | 72 | gpgme_data_release (sig); 73 | gpgme_data_release (text); 74 | gpgme_release (ctx); 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /gpgme.txt: -------------------------------------------------------------------------------- 1 | %%comments: 2 | Copyright (C) 2001, 2004 Free Software Foundation, Inc. 3 | 4 | Permission is granted to copy, distribute and/or modify this document 5 | under the terms of the GNU Free Documentation License, Version 1.1 or 6 | any later version published by the Free Software Foundation; with no 7 | Invariant Sections, with no Front-Cover Texts, and with no Back-Cover 8 | Texts. A copy of the license is included in the file COPYING. 9 | 10 | %%name: GPGME 11 | 12 | %%short-description: GnuPG Made Easy 13 | 14 | %%full-description: GPGME is a library designed to make access to 15 | GnuPG easier for applications. It provides a high-level crypto API 16 | for encryption, decryption, signing, signature verification and key 17 | management. Currently it uses GnuPG and GpgSM as its backends to 18 | support OpenPGP and the Cryptographic Message Syntax. 19 | 20 | %%category: security, libraries 21 | 22 | %%license: GPL 23 | %%license verified by: 24 | %%license verified on: 25 | 26 | %%maintainer: g10 Code GmbH 27 | 28 | %%updated: 2004-09-30 29 | 30 | %%keywords: encryption, public key, digital signature, GnuPG 31 | 32 | %%interface: 33 | 34 | %%programs: 35 | 36 | %%GNU: no 37 | 38 | %%web-page: https://www.gnupg.org/gpgme.html 39 | 40 | %%support: paid extension/consulting from https://www.g10code.com 41 | 42 | %%doc: English programmer reference in Texinfo, Postscript, HTML included 43 | 44 | %%developers: Werner Koch . 45 | 46 | %%contributors: 47 | 48 | %%sponsors: 49 | 50 | %%source: https://www.gnupg.org/ftp/gcrypt/gpgme/ 51 | 52 | %%debian: 53 | 54 | %%redhat: 55 | 56 | %%repository: See https://dev.gnupg.org/source/gpgme/ 57 | 58 | %%related: 59 | 60 | %%source-language: C 61 | 62 | %%supported-languages: C, C++ 63 | 64 | %%use-requirements: GnuPG 1.2.2, GpgSM 1.9.6 65 | 66 | %%build-prerequisites: libgpg-error 0.5 67 | 68 | %%weak-prerequisites: Pth 1.2.0 69 | 70 | %%source-prerequisites: 71 | 72 | %%version: 1.0.0 released on 2004-09-30 73 | 74 | %%announce-list: announce@gnupg.org announce-request@gnupg.org 75 | 76 | %%announce-news: 77 | 78 | %%help-list: 79 | 80 | %%help-news: 81 | 82 | %%dev-list: gnupg-devel@gnupg.org gnupg-devel-request@gnupg.org 83 | 84 | %%dev-news: 85 | 86 | %%bug-list: 87 | 88 | %%bug-database: 89 | 90 | %%entry written by: Werner Koch 91 | -------------------------------------------------------------------------------- /tests/gpg/t-thread-keylist.c: -------------------------------------------------------------------------------- 1 | /* t-thread-verify.c - Regression test. 2 | * Copyright (C) 2015 by Bundesamt für Sicherheit in der Informationstechnik 3 | * Software engineering by Intevation GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #include 33 | 34 | #include "t-support.h" 35 | 36 | #define THREAD_COUNT 10 37 | 38 | void * 39 | start_keylist (void *arg) 40 | { 41 | gpgme_error_t err; 42 | gpgme_ctx_t ctx; 43 | gpgme_key_t key; 44 | 45 | (void) arg; 46 | err = gpgme_new (&ctx); 47 | fail_if_err (err); 48 | 49 | err = gpgme_op_keylist_start (ctx, NULL, 0); 50 | fail_if_err (err); 51 | 52 | while (!(err = gpgme_op_keylist_next (ctx, &key))) 53 | { 54 | gpgme_key_unref (key); 55 | } 56 | 57 | gpgme_release (ctx); 58 | 59 | return NULL; 60 | } 61 | 62 | int 63 | main (int argc, char *argv[]) 64 | { 65 | int i; 66 | pthread_t keylist_threads[THREAD_COUNT]; 67 | init_gpgme (GPGME_PROTOCOL_OpenPGP); 68 | 69 | (void)argc; 70 | (void)argv; 71 | 72 | for (i = 0; i < THREAD_COUNT; i++) 73 | { 74 | if (pthread_create(&keylist_threads[i], NULL, start_keylist, NULL)) 75 | { 76 | fprintf(stderr, "%s:%i: failed to create threads \n", 77 | __FILE__, __LINE__); 78 | exit(1); 79 | } 80 | } 81 | for (i = 0; i < THREAD_COUNT; i++) 82 | { 83 | pthread_join (keylist_threads[i], NULL); 84 | } 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /README.GIT: -------------------------------------------------------------------------------- 1 | If you are building from GIT, run the script 2 | 3 | ./autogen.sh 4 | 5 | first, to make sure that you have all the necessary maintainer tools 6 | are installed and to build the actual configuration files. If you 7 | have just checked out from GIT, you should add the option "--force" to 8 | autogen.sh so that meta data is noticed by autom4te.cache. Then run 9 | 10 | ./configure --enable-maintainer-mode 11 | 12 | followed by the usual make. 13 | 14 | If autogen.sh complains about insufficient versions of the required 15 | tools, or the tools are not installed, you may use environment 16 | variables to override the default tool names: 17 | 18 | AUTOMAKE_SUFFIX is used as a suffix for all tools from the automake 19 | package. For example 20 | AUTOMAKE_SUFFIX="-1.7" ./autogen.sh 21 | uses "automake-1.7" and "aclocal-1.7. 22 | AUTOMAKE_PREFIX is used as a prefix for all tools from the automake 23 | page and may be combined with AUTOMAKE_SUFFIX. e.g.: 24 | AUTOMAKE_PREFIX=/usr/foo/bin ./autogen.sh 25 | uses "automake" and "aclocal" in the /usr/foo/bin 26 | directory. 27 | AUTOCONF_SUFFIX is used as a suffix for all tools from the automake 28 | package 29 | AUTOCONF_PREFIX is used as a prefix for all tools from the automake 30 | package 31 | GETTEXT_SUFFIX is used as a suffix for all tools from the gettext 32 | package 33 | GETTEXT_PREFIX is used as a prefix for all tools from the gettext 34 | package 35 | 36 | It is also possible to use the variable name AUTOMAKE, AUTOCONF, 37 | ACLOCAL, AUTOHEADER, GETTEXT and MSGMERGE to directly specify the name 38 | of the programs to run. It is however better to use the suffix and 39 | prefix forms as described above because that does not require 40 | knowledge about the actual tools used by autogen.sh. 41 | 42 | 43 | Please don't use autopoint, libtoolize or autoreconf unless you are 44 | the current maintainer and want to update the standard configuration 45 | files. All those files should be in GIT and only updated manually 46 | if the maintainer decides that newer versions are required. The 47 | maintainer should also make sure that the required version of automake 48 | et al. are properly indicated at the top of configure.ac and take care 49 | to copy the files and not merely use symlinks. 50 | -------------------------------------------------------------------------------- /tests/gpgsm/t-encrypt.c: -------------------------------------------------------------------------------- 1 | /* t-encrypt.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | /* We need to include config.h so that we know whether we are building 23 | with large file system (LFS) support. */ 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | #include "t-support.h" 35 | 36 | int 37 | main (void) 38 | { 39 | gpgme_ctx_t ctx; 40 | gpgme_error_t err; 41 | gpgme_data_t in, out; 42 | gpgme_key_t key[] = { NULL, NULL }; 43 | gpgme_encrypt_result_t result; 44 | 45 | init_gpgme (GPGME_PROTOCOL_CMS); 46 | 47 | err = gpgme_new (&ctx); 48 | fail_if_err (err); 49 | gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); 50 | gpgme_set_armor (ctx, 1); 51 | 52 | err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); 53 | fail_if_err (err); 54 | 55 | err = gpgme_data_new (&out); 56 | fail_if_err (err); 57 | 58 | err = gpgme_get_key (ctx, "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", 59 | &key[0], 0); 60 | fail_if_err (err); 61 | 62 | err = gpgme_op_encrypt (ctx, key, 0, in, out); 63 | fail_if_err (err); 64 | result = gpgme_op_encrypt_result (ctx); 65 | if (result->invalid_recipients) 66 | { 67 | fprintf (stderr, "Invalid recipient encountered: %s\n", 68 | result->invalid_recipients->fpr); 69 | exit (1); 70 | } 71 | print_data (out); 72 | 73 | gpgme_key_unref (key[0]); 74 | gpgme_data_release (in); 75 | gpgme_data_release (out); 76 | gpgme_release (ctx); 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /src/progress.c: -------------------------------------------------------------------------------- 1 | /* progress.c - status handler for progress status 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | #include 26 | #include 27 | #include 28 | 29 | #include "util.h" 30 | #include "context.h" 31 | #include "debug.h" 32 | 33 | 34 | /* The status handler for progress status lines which also monitors 35 | * the PINENTRY_LAUNCHED status. */ 36 | gpgme_error_t 37 | _gpgme_progress_status_handler (void *priv, gpgme_status_code_t code, 38 | char *args) 39 | { 40 | gpgme_ctx_t ctx = (gpgme_ctx_t) priv; 41 | char *p; 42 | char *args_cpy; 43 | int type = 0; 44 | int current = 0; 45 | int total = 0; 46 | 47 | if (code == GPGME_STATUS_PINENTRY_LAUNCHED) 48 | { 49 | ctx->redraw_suggested = 1; 50 | return 0; 51 | } 52 | 53 | if (code != GPGME_STATUS_PROGRESS || !*args || !ctx->progress_cb) 54 | return 0; 55 | 56 | args_cpy = strdup (args); 57 | if (!args_cpy) 58 | return gpg_error_from_syserror (); 59 | 60 | p = strchr (args_cpy, ' '); 61 | if (p) 62 | { 63 | *p++ = 0; 64 | if (*p) 65 | { 66 | type = *(unsigned char *)p; 67 | p = strchr (p+1, ' '); 68 | if (p) 69 | { 70 | *p++ = 0; 71 | if (*p) 72 | { 73 | current = atoi (p); 74 | p = strchr (p+1, ' '); 75 | if (p) 76 | { 77 | *p++ = 0; 78 | total = atoi (p); 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | if (type != 'X') 86 | ctx->progress_cb (ctx->progress_cb_value, args_cpy, type, current, total); 87 | 88 | free (args_cpy); 89 | return 0; 90 | } 91 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/tests/KeyInfos.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | /* global describe, it, expect, before, Gpgmejs */ 25 | /* global inputvalues*/ 26 | 27 | describe('Key information', function () { 28 | let context = null; 29 | before(function (done){ 30 | const prm = Gpgmejs.init({ timeout: 2000 }); 31 | prm.then(function (gpgmejs){ 32 | context = gpgmejs; 33 | done(); 34 | }); 35 | }); 36 | 37 | it('A fingerprint is consistently returned upper case hex', function (done){ 38 | const mixedCase = inputvalues.encrypt.good.fingerprint_mixedcase; 39 | context.Keyring.getKeys({ pattern: mixedCase }).then(function (result){ 40 | expect(result).to.be.an('array'); 41 | expect(result.length).to.equal(1); 42 | expect(result[0].fingerprint).to.equal(mixedCase.toUpperCase()); 43 | done(); 44 | }); 45 | }); 46 | 47 | it('A userId keeps their encoding', function (done){ 48 | context.Keyring.importKey(inputvalues.publicKeyNonAscii.key, true) 49 | .then(function (result){ 50 | expect(result.Keys[0]).to.be.an('object'); 51 | const user = result.Keys[0].key.get('userids')[0]; 52 | expect(user.get('name')).to.equal( 53 | inputvalues.publicKeyNonAscii.userid); 54 | result.Keys[0].key.delete().then(function (){ 55 | done(); 56 | }); 57 | }); 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /tests/start-stop-agent: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2013 g10 Code GmbH 3 | # 4 | # This file is free software; as a special exception the author gives 5 | # unlimited permission to copy and/or distribute it, with or without 6 | # modifications, as long as this notice is preserved. This file is 7 | # distributed in the hope that it will be useful, but WITHOUT ANY 8 | # WARRANTY, to the extent permitted by law; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | 11 | if [ -z "$(command -v gpg-connect-agent)" ]; then 12 | echo "gpg-agent not installed and thus not started" >&2 13 | exit 0; 14 | fi 15 | 16 | GPG_AGENT_INFO= 17 | export GPG_AGENT_INFO 18 | GPG_AGENT=$(which gpg-agent) 19 | 20 | token=$(echo "gpgme-$(pwd)" | tr ' ' '_') 21 | 22 | if [ "$1" = "--stop" ]; then 23 | if [ "$(gpg-connect-agent --no-autostart getval\ $token /bye 2>/dev/null | head -1)" \ 24 | != "D set" ]; then 25 | echo "gpg-agent not running" >&2 26 | exit 0 27 | fi 28 | echo "stopping gpg-agent " >&2 29 | gpg-connect-agent KILLAGENT /bye >/dev/null 2>&1 30 | exit 0 31 | fi 32 | 33 | # Update 'agent-program' in the configuration files to make sure we 34 | # will always start exactly this agent again if we ever need to. 35 | for F in gpg.conf gpgsm.conf 36 | do 37 | if test -f "$GNUPGHOME/$F" 38 | then 39 | cat "$GNUPGHOME/$F" > "$GNUPGHOME/$F~" 40 | sed -e "s#^agent-program.*#agent-program ${GPG_AGENT}|--debug-quick-random#" \ 41 | >"$GNUPGHOME/$F" <"$GNUPGHOME/$F~" 42 | rm -f "$GNUPGHOME/$F~" 43 | fi 44 | done 45 | 46 | if [ "$(gpg-connect-agent --no-autostart getval\ $token /bye 2>/dev/null | head -1)" \ 47 | = "D set" ]; then 48 | echo "gpg-agent already running" >&2 49 | exit 0 50 | fi 51 | 52 | echo "starting gpg-agent.." >&2 53 | 54 | # GnuPG prior to 2.1.12 needs --allow-loopback-pinentry for the 55 | # loopback entry to work. Old versions do not understand this though, 56 | # so we need to be careful. 57 | if "$GPG_AGENT" --gpgconf-test --allow-loopback-pinentry && 58 | test -f "$GNUPGHOME/gpg-agent.conf" && 59 | ! grep -q allow-loopback-pinentry "$GNUPGHOME/gpg-agent.conf"; then 60 | echo allow-loopback-pinentry >> "$GNUPGHOME/gpg-agent.conf" 61 | fi 62 | 63 | gpg-connect-agent --agent-program="${GPG_AGENT}|--debug-quick-random" putval\ $token\ set /bye 64 | if [ $? -ne 0 -o "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ 65 | != "D set" ]; then 66 | echo "error starting gpg-agent" >&2 67 | exit 1 68 | fi 69 | exit 0 70 | -------------------------------------------------------------------------------- /tests/gpg/t-decrypt.c: -------------------------------------------------------------------------------- 1 | /* t-decrypt.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | /* We need to include config.h so that we know whether we are building 23 | with large file system (LFS) support. */ 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | #include "t-support.h" 37 | 38 | 39 | int 40 | main (int argc, char *argv[]) 41 | { 42 | gpgme_ctx_t ctx; 43 | gpgme_error_t err; 44 | gpgme_data_t in, out; 45 | gpgme_decrypt_result_t result; 46 | char *cipher_1_asc = make_filename ("cipher-1.asc"); 47 | char *agent_info; 48 | 49 | (void)argc; 50 | (void)argv; 51 | 52 | init_gpgme (GPGME_PROTOCOL_OpenPGP); 53 | 54 | err = gpgme_new (&ctx); 55 | fail_if_err (err); 56 | 57 | agent_info = getenv("GPG_AGENT_INFO"); 58 | if (!(agent_info && strchr (agent_info, ':'))) 59 | gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); 60 | 61 | err = gpgme_data_new_from_file (&in, cipher_1_asc, 1); 62 | free (cipher_1_asc); 63 | fail_if_err (err); 64 | 65 | err = gpgme_data_new (&out); 66 | fail_if_err (err); 67 | 68 | err = gpgme_op_decrypt (ctx, in, out); 69 | fail_if_err (err); 70 | result = gpgme_op_decrypt_result (ctx); 71 | if (result->unsupported_algorithm) 72 | { 73 | fprintf (stderr, "%s:%i: unsupported algorithm: %s\n", 74 | __FILE__, __LINE__, result->unsupported_algorithm); 75 | exit (1); 76 | } 77 | print_data (out); 78 | 79 | gpgme_data_release (in); 80 | gpgme_data_release (out); 81 | gpgme_release (ctx); 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/tests/longRunningTests.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | /* global describe, it, before, expect, Gpgmejs */ 24 | /* global bigString, inputvalues */ 25 | 26 | describe('Long running Encryption/Decryption', function () { 27 | let context = null; 28 | const good_fpr = inputvalues.encrypt.good.fingerprint; 29 | before(function (done){ 30 | const prm = Gpgmejs.init({ timeout: 2000 }); 31 | prm.then(function (gpgmejs){ 32 | context = gpgmejs; 33 | done(); 34 | }); 35 | }); 36 | 37 | for (let i=1; i < 101; i++) { 38 | it('Successful encrypt/decrypt completely random data ' 39 | + (i) + '/100', function (done) { 40 | const data = bigString(2*1024*1024); 41 | context.encrypt({ data: data, publicKeys: good_fpr }) 42 | .then(function (answer){ 43 | expect(answer).to.not.be.empty; 44 | expect(answer.data).to.be.a('string'); 45 | expect(answer.data).to.include('BEGIN PGP MESSAGE'); 46 | expect(answer.data).to.include('END PGP MESSAGE'); 47 | context.decrypt({ data: answer.data }) 48 | .then(function (result){ 49 | expect(result).to.not.be.empty; 50 | expect(result.data).to.be.a('string'); 51 | expect(result.data).to.equal(data); 52 | done(); 53 | }); 54 | }); 55 | }).timeout(15000); 56 | } 57 | 58 | }); 59 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/tests/signTest.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | /* global describe, it, expect, before, Gpgmejs */ 25 | /* global bigString, inputvalues */ 26 | 27 | describe('Signing', function () { 28 | let context = null; 29 | const good_fpr = inputvalues.encrypt.good.fingerprint; 30 | 31 | before(function (done){ 32 | const prm = Gpgmejs.init({ timeout: 2000 }); 33 | prm.then(function (gpgmejs){ 34 | context = gpgmejs; 35 | done(); 36 | }); 37 | }); 38 | 39 | it('Sign a message', function (done) { 40 | const data = bigString(100); 41 | context.sign({ data: data, keys: good_fpr }).then(function (answer) { 42 | expect(answer).to.not.be.empty; 43 | expect(answer.data).to.be.a('string'); 44 | expect(answer.data).to.include('BEGIN PGP SIGNATURE'); 45 | expect(answer.data).to.include('END PGP SIGNATURE'); 46 | expect(answer.data).to.include(data); 47 | done(); 48 | }); 49 | }); 50 | 51 | it('Detached sign a message', function (done) { 52 | const data = bigString(100); 53 | context.sign({ data: data, keys: good_fpr, mode: 'detached' }) 54 | .then(function (answer) { 55 | expect(answer).to.not.be.empty; 56 | expect(answer.data).to.be.a('string'); 57 | expect(answer.data).to.include(data); 58 | expect(answer.signature).to.be.a('string'); 59 | expect(answer.signature).to.be.a('string'); 60 | done(); 61 | }); 62 | }); 63 | 64 | }); 65 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | dnl Macros to configure GPGME 2 | dnl Copyright (C) 2004 g10 Code GmbH 3 | dnl 4 | dnl This file is part of GPGME. 5 | dnl 6 | dnl GPGME is free software; you can redistribute it and/or modify it 7 | dnl under the terms of the GNU Lesser General Public License as 8 | dnl published by the Free Software Foundation; either version 2.1 of the 9 | dnl License, or (at your option) any later version. 10 | dnl 11 | dnl GPGME is distributed in the hope that it will be useful, but WITHOUT 12 | dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | dnl Public License for more details. 15 | dnl 16 | dnl You should have received a copy of the GNU Lesser General Public 17 | dnl License along with this program; if not, write to the Free Software 18 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | dnl GNUPG_CHECK_VA_COPY() 21 | dnl Do some check on how to implement va_copy. 22 | dnl May define MUST_COPY_VA_BY_VAL. 23 | dnl Actual test code taken from glib-1.1. 24 | AC_DEFUN([GNUPG_CHECK_VA_COPY], 25 | [ AC_MSG_CHECKING(whether va_lists must be copied by value) 26 | AC_CACHE_VAL(gnupg_cv_must_copy_va_byval,[ 27 | if test "$cross_compiling" = yes; then 28 | gnupg_cv_must_copy_va_byval=no 29 | else 30 | gnupg_cv_must_copy_va_byval=no 31 | AC_TRY_RUN([ 32 | #include 33 | void f (int i, ...) 34 | { 35 | va_list args1, args2; 36 | va_start (args1, i); 37 | args2 = args1; 38 | if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) 39 | exit (1); 40 | va_end (args1); 41 | va_end (args2); 42 | } 43 | 44 | int main() 45 | { 46 | f (0, 42); 47 | return 0; 48 | } 49 | ],gnupg_cv_must_copy_va_byval=yes) 50 | fi 51 | ]) 52 | if test "$gnupg_cv_must_copy_va_byval" = yes; then 53 | AC_DEFINE(MUST_COPY_VA_BYVAL,1,[used to implement the va_copy macro]) 54 | fi 55 | if test "$cross_compiling" = yes; then 56 | AC_MSG_RESULT(assuming $gnupg_cv_must_copy_va_byval) 57 | else 58 | AC_MSG_RESULT($gnupg_cv_must_copy_va_byval) 59 | fi 60 | ]) 61 | 62 | dnl LIST_MEMBER() 63 | dnl Check whether an element ist contained in a list. Set `found' to 64 | dnl `1' if the element is found in the list, to `0' otherwise. 65 | AC_DEFUN([LIST_MEMBER], 66 | [ 67 | name=$1 68 | list=$2 69 | found=0 70 | 71 | for n in $list; do 72 | if test "x$name" = "x$n"; then 73 | found=1 74 | fi 75 | done 76 | ]) 77 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/tests/startup.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | /* global describe, it, expect, Gpgmejs, inputvalues */ 25 | 26 | describe('GPGME context', function (){ 27 | it('Starting a GpgME instance', function (done){ 28 | let prm = Gpgmejs.init({ timeout: 2000 }); 29 | const input = inputvalues.someInputParameter; 30 | prm.then( 31 | function (context){ 32 | expect(context).to.be.an('object'); 33 | expect(context.encrypt).to.be.a('function'); 34 | expect(context.decrypt).to.be.a('function'); 35 | expect(context.sign).to.be.a('function'); 36 | expect(context.verify).to.be.a('function'); 37 | context.Keyring = input; 38 | expect(context.Keyring).to.be.an('object'); 39 | expect(context.Keyring).to.not.equal(input); 40 | expect(context.Keyring.getKeys).to.be.a('function'); 41 | expect(context.Keyring.getDefaultKey).to.be.a('function'); 42 | expect(context.Keyring.importKey).to.be.a('function'); 43 | expect(context.Keyring.generateKey).to.be.a('function'); 44 | done(); 45 | }); 46 | }); 47 | 48 | it('Error message on unsuccessful connection (timeout)', function (done) { 49 | let prm = Gpgmejs.init({ timeout: 1 }); 50 | prm.then( 51 | null, 52 | function (error){ 53 | expect(error).to.be.an('error'); 54 | expect(error.code).to.equal('CONN_TIMEOUT'); 55 | done(); 56 | } 57 | ); 58 | }); 59 | }); -------------------------------------------------------------------------------- /tests/gpg/t-encrypt.c: -------------------------------------------------------------------------------- 1 | /* t-encrypt.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | /* We need to include config.h so that we know whether we are building 23 | with large file system (LFS) support. */ 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | #include "t-support.h" 35 | 36 | 37 | int 38 | main (int argc, char *argv[]) 39 | { 40 | gpgme_ctx_t ctx; 41 | gpgme_error_t err; 42 | gpgme_data_t in, out; 43 | gpgme_key_t key[3] = { NULL, NULL, NULL }; 44 | gpgme_encrypt_result_t result; 45 | 46 | (void)argc; 47 | (void)argv; 48 | 49 | init_gpgme (GPGME_PROTOCOL_OpenPGP); 50 | 51 | err = gpgme_new (&ctx); 52 | fail_if_err (err); 53 | gpgme_set_armor (ctx, 1); 54 | 55 | err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); 56 | fail_if_err (err); 57 | 58 | err = gpgme_data_new (&out); 59 | fail_if_err (err); 60 | 61 | err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734", 62 | &key[0], 0); 63 | fail_if_err (err); 64 | err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", 65 | &key[1], 0); 66 | fail_if_err (err); 67 | 68 | err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); 69 | fail_if_err (err); 70 | result = gpgme_op_encrypt_result (ctx); 71 | if (result->invalid_recipients) 72 | { 73 | fprintf (stderr, "Invalid recipient encountered: %s\n", 74 | result->invalid_recipients->fpr); 75 | exit (1); 76 | } 77 | print_data (out); 78 | 79 | gpgme_key_unref (key[0]); 80 | gpgme_key_unref (key[1]); 81 | gpgme_data_release (in); 82 | gpgme_data_release (out); 83 | gpgme_release (ctx); 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /tests/gpgsm/t-export.c: -------------------------------------------------------------------------------- 1 | /* t-export.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | /* We need to include config.h so that we know whether we are building 23 | with large file system (LFS) support. */ 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | #include "t-support.h" 35 | 36 | 37 | int 38 | main (void) 39 | { 40 | gpgme_ctx_t ctx; 41 | gpgme_error_t err; 42 | gpgme_data_t out; 43 | const char *pattern1[] = { "DFN Top Level Certification Authority", NULL }; 44 | const char *pattern2[] = { "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", 45 | "DFN Server Certification Authority", 46 | NULL }; 47 | 48 | init_gpgme (GPGME_PROTOCOL_CMS); 49 | 50 | err = gpgme_new (&ctx); 51 | fail_if_err (err); 52 | gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); 53 | 54 | gpgme_set_armor (ctx, 1); 55 | 56 | /* Check exporting of one certificate. */ 57 | err = gpgme_data_new (&out); 58 | fail_if_err (err); 59 | err = gpgme_op_export_ext (ctx, pattern1, 0, out); 60 | fail_if_err (err); 61 | 62 | fflush (NULL); 63 | fputs ("Begin Result:\n", stdout); 64 | print_data (out); 65 | fputs ("End Result.\n", stdout); 66 | 67 | gpgme_data_release (out); 68 | 69 | /* Check exporting of 2 certificates. */ 70 | err = gpgme_data_new (&out); 71 | fail_if_err (err); 72 | err = gpgme_op_export_ext (ctx, pattern2, 0, out); 73 | fail_if_err (err); 74 | 75 | fflush (NULL); 76 | fputs ("Begin Result:\n", stdout); 77 | print_data (out); 78 | fputs ("End Result.\n", stdout); 79 | 80 | gpgme_data_release (out); 81 | 82 | 83 | gpgme_release (ctx); 84 | 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /tests/json/t-keylist.out.json: -------------------------------------------------------------------------------- 1 | { 2 | "keys": [{ 3 | "revoked": false, 4 | "expired": false, 5 | "disabled": false, 6 | "invalid": false, 7 | "can_encrypt": true, 8 | "can_sign": true, 9 | "can_certify": true, 10 | "can_authenticate": true, 11 | "secret": false, 12 | "is_qualified": false, 13 | "protocol": "OpenPGP", 14 | "fingerprint": "23FD347A419429BACCD5E72D6BC4778054ACD246", 15 | "subkeys": [{ 16 | "revoked": false, 17 | "expired": false, 18 | "disabled": false, 19 | "invalid": false, 20 | "can_encrypt": false, 21 | "can_sign": true, 22 | "can_certify": true, 23 | "can_authenticate": true, 24 | "secret": false, 25 | "is_qualified": false, 26 | "is_cardkey": false, 27 | "is_de_vs": false, 28 | "pubkey_algo_name": "DSA", 29 | "pubkey_algo_string": "dsa1024", 30 | "pubkey_algo": 17, 31 | "length": 1024, 32 | "timestamp": 920892875, 33 | "expires": 0 34 | }, { 35 | "revoked": false, 36 | "expired": false, 37 | "disabled": false, 38 | "invalid": false, 39 | "can_encrypt": true, 40 | "can_sign": false, 41 | "can_certify": false, 42 | "can_authenticate": false, 43 | "secret": false, 44 | "is_qualified": false, 45 | "is_cardkey": false, 46 | "is_de_vs": false, 47 | "pubkey_algo_name": "ELG-E", 48 | "pubkey_algo_string": "elg1024", 49 | "pubkey_algo": 16, 50 | "length": 1024, 51 | "timestamp": 920892914, 52 | "expires": 0 53 | }], 54 | "userids": [{ 55 | "revoked": false, 56 | "invalid": false, 57 | "validity": "unknown", 58 | "uid": "Zulu Test (demo key) ", 59 | "name": "Zulu Test", 60 | "email": "zulu@example.net", 61 | "comment": "demo key", 62 | "address": "zulu@example.net" 63 | }] 64 | }] 65 | } 66 | -------------------------------------------------------------------------------- /tests/t-version.c: -------------------------------------------------------------------------------- 1 | /* t-version.c - Regression test. 2 | * Copyright (C) 2001, 2004 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | static int verbose; 32 | static int debug; 33 | 34 | 35 | int 36 | main (int argc, char **argv) 37 | { 38 | int ret; 39 | const char *null_result; 40 | const char *current_result; 41 | const char *future_result; 42 | 43 | int last_argc = -1; 44 | 45 | if (argc) 46 | { 47 | argc--; argv++; 48 | } 49 | while (argc && last_argc != argc ) 50 | { 51 | last_argc = argc; 52 | if (!strcmp (*argv, "--help")) 53 | { 54 | puts ("usage: ./t-version [options]\n" 55 | "\n" 56 | "Options:\n" 57 | " --verbose Show what is going on\n" 58 | ); 59 | exit (0); 60 | } 61 | if (!strcmp (*argv, "--verbose")) 62 | { 63 | verbose = 1; 64 | argc--; argv++; 65 | } 66 | else if (!strcmp (*argv, "--debug")) 67 | { 68 | verbose = debug = 1; 69 | argc--; argv++; 70 | } 71 | } 72 | 73 | null_result = gpgme_check_version (NULL); 74 | current_result = gpgme_check_version (VERSION); 75 | future_result = gpgme_check_version (VERSION ".1"); 76 | 77 | ret = !(null_result 78 | && ! strcmp (null_result, VERSION) 79 | && current_result 80 | && ! strcmp (current_result, VERSION) 81 | && ! future_result); 82 | 83 | if (verbose || ret) 84 | { 85 | printf ("Version from header: %s (0x%06x)\n", 86 | GPGME_VERSION, GPGME_VERSION_NUMBER); 87 | printf ("Version from binary: %s\n", gpgme_check_version (NULL)); 88 | printf ("Copyright blurb ...:%s\n", gpgme_check_version ("\x01\x01")); 89 | } 90 | 91 | return ret; 92 | } 93 | -------------------------------------------------------------------------------- /tests/gpg/t-export.c: -------------------------------------------------------------------------------- 1 | /* t-export.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | /* We need to include config.h so that we know whether we are building 23 | with large file system (LFS) support. */ 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | #include "t-support.h" 36 | 37 | 38 | int 39 | main (int argc, char **argv) 40 | { 41 | gpgme_ctx_t ctx; 42 | gpgme_error_t err; 43 | gpgme_data_t out; 44 | const char *pattern[] = { "Alpha", "Bob", NULL }; 45 | gpgme_key_t keyarray[3]; 46 | 47 | (void)argc; 48 | (void)argv; 49 | 50 | init_gpgme (GPGME_PROTOCOL_OpenPGP); 51 | 52 | err = gpgme_new (&ctx); 53 | fail_if_err (err); 54 | 55 | err = gpgme_data_new (&out); 56 | fail_if_err (err); 57 | 58 | gpgme_set_armor (ctx, 1); 59 | err = gpgme_op_export_ext (ctx, pattern, 0, out); 60 | fail_if_err (err); 61 | 62 | fflush (NULL); 63 | fputs ("Begin Result:\n", stdout); 64 | print_data (out); 65 | fputs ("End Result.\n", stdout); 66 | 67 | gpgme_data_release (out); 68 | 69 | /* Again. Now using a key array. */ 70 | err = gpgme_data_new (&out); 71 | fail_if_err (err); 72 | 73 | err = gpgme_get_key (ctx, "0x68697734" /* Alpha */, keyarray+0, 0); 74 | fail_if_err (err); 75 | err = gpgme_get_key (ctx, "0xA9E3B0B2" /* Bob */, keyarray+1, 0); 76 | fail_if_err (err); 77 | keyarray[2] = NULL; 78 | 79 | gpgme_set_armor (ctx, 1); 80 | err = gpgme_op_export_keys (ctx, keyarray, 0, out); 81 | fail_if_err (err); 82 | 83 | gpgme_key_unref (keyarray[0]); 84 | gpgme_key_unref (keyarray[1]); 85 | 86 | fflush (NULL); 87 | fputs ("Begin Result:\n", stdout); 88 | print_data (out); 89 | fputs ("End Result.\n", stdout); 90 | 91 | gpgme_data_release (out); 92 | 93 | 94 | gpgme_release (ctx); 95 | 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /src/data-estream.c: -------------------------------------------------------------------------------- 1 | /* data-stream.c - A stream based data object. 2 | * Copyright (C) 2002, 2004, 2018 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #ifdef HAVE_SYS_TYPES_H 27 | # include 28 | #endif 29 | 30 | #include "debug.h" 31 | #include "data.h" 32 | 33 | 34 | static gpgme_ssize_t 35 | stream_es_read (gpgme_data_t dh, void *buffer, size_t size) 36 | { 37 | size_t amt = gpgrt_fread (buffer, 1, size, dh->data.e_stream); 38 | if (amt > 0) 39 | return amt; 40 | return gpgrt_ferror (dh->data.e_stream) ? -1 : 0; 41 | } 42 | 43 | 44 | static gpgme_ssize_t 45 | stream_es_write (gpgme_data_t dh, const void *buffer, size_t size) 46 | { 47 | size_t amt = gpgrt_fwrite (buffer, 1, size, dh->data.e_stream); 48 | if (amt > 0) 49 | return amt; 50 | return gpgrt_ferror (dh->data.e_stream) ? -1 : 0; 51 | } 52 | 53 | 54 | static gpgme_off_t 55 | stream_es_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) 56 | { 57 | int err; 58 | 59 | err = gpgrt_fseeko (dh->data.e_stream, offset, whence); 60 | if (err) 61 | return -1; 62 | 63 | return gpgrt_ftello (dh->data.e_stream); 64 | } 65 | 66 | 67 | static int 68 | stream_es_get_fd (gpgme_data_t dh) 69 | { 70 | gpgrt_fflush (dh->data.e_stream); 71 | return gpgrt_fileno (dh->data.e_stream); 72 | } 73 | 74 | 75 | static struct _gpgme_data_cbs stream_es_cbs = 76 | { 77 | stream_es_read, 78 | stream_es_write, 79 | stream_es_seek, 80 | NULL, 81 | stream_es_get_fd 82 | }; 83 | 84 | 85 | 86 | gpgme_error_t 87 | gpgme_data_new_from_estream (gpgme_data_t *r_dh, gpgrt_stream_t stream) 88 | { 89 | gpgme_error_t err; 90 | TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_estream", r_dh, "estream=%p", 91 | stream); 92 | 93 | err = _gpgme_data_new (r_dh, &stream_es_cbs); 94 | if (err) 95 | return TRACE_ERR (err); 96 | 97 | (*r_dh)->data.e_stream = stream; 98 | TRACE_SUC ("dh=%p", *r_dh); 99 | return 0; 100 | } 101 | -------------------------------------------------------------------------------- /tests/gpg/t-encrypt-sym.c: -------------------------------------------------------------------------------- 1 | /* t-encrypt-sym.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | */ 18 | 19 | /* We need to include config.h so that we know whether we are building 20 | with large file system (LFS) support. */ 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #include "t-support.h" 34 | 35 | 36 | int 37 | main (int argc, char *argv[]) 38 | { 39 | gpgme_ctx_t ctx; 40 | gpgme_error_t err; 41 | gpgme_data_t plain, cipher; 42 | const char *text = "Hallo Leute\n"; 43 | char *text2; 44 | char *p; 45 | size_t len; 46 | 47 | (void)argc; 48 | (void)argv; 49 | 50 | init_gpgme (GPGME_PROTOCOL_OpenPGP); 51 | 52 | err = gpgme_new (&ctx); 53 | fail_if_err (err); 54 | gpgme_set_armor (ctx, 1); 55 | 56 | p = getenv("GPG_AGENT_INFO"); 57 | if (!(p && strchr (p, ':'))) 58 | gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); 59 | 60 | err = gpgme_data_new_from_mem (&plain, text, strlen (text), 0); 61 | fail_if_err (err); 62 | 63 | err = gpgme_data_new (&cipher); 64 | fail_if_err (err); 65 | 66 | err = gpgme_op_encrypt (ctx, 0, 0, plain, cipher); 67 | fail_if_err (err); 68 | 69 | fflush (NULL); 70 | fputs ("Begin Result Encryption:\n", stdout); 71 | print_data (cipher); 72 | fputs ("End Result.\n", stdout); 73 | 74 | gpgme_data_seek (cipher, 0, SEEK_SET); 75 | 76 | gpgme_data_release (plain); 77 | err = gpgme_data_new (&plain); 78 | fail_if_err (err); 79 | 80 | err = gpgme_op_decrypt (ctx, cipher, plain); 81 | fail_if_err (err); 82 | 83 | fputs ("Begin Result Decryption:\n", stdout); 84 | print_data (plain); 85 | fputs ("End Result.\n", stdout); 86 | 87 | text2 = gpgme_data_release_and_get_mem (plain, &len); 88 | if (strncmp (text, text2, len)) 89 | { 90 | fprintf (stderr, "%s:%d: Wrong plaintext\n", __FILE__, __LINE__); 91 | exit (1); 92 | } 93 | 94 | gpgme_data_release (cipher); 95 | free (text2); 96 | gpgme_release (ctx); 97 | 98 | return 0; 99 | } 100 | -------------------------------------------------------------------------------- /lang/js/src/index.js: -------------------------------------------------------------------------------- 1 | /* gpgme.js - Javascript integration for gpgme 2 | * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | * 20 | * Author(s): 21 | * Maximilian Krambach 22 | */ 23 | 24 | 25 | import { GpgME } from './gpgmejs'; 26 | import { gpgme_error } from './Errors'; 27 | import { Connection } from './Connection'; 28 | 29 | /** 30 | * Main entry point for gpgme.js. It initializes by testing the nativeMessaging 31 | * connection once, and then offers the available functions as method of the 32 | * response object. 33 | * An unsuccessful attempt will reject as a GPGME_Error. 34 | * @param {Object} config (optional) configuration options 35 | * @param {Number} config.timeout set the timeout for the initial connection 36 | * check. On some machines and operating systems a default timeout of 1000 ms is 37 | * too low, so a higher number might be attempted. 38 | * @returns {Promise} 39 | * @async 40 | */ 41 | function init ({ timeout = 1000 } = {}){ 42 | return new Promise(function (resolve, reject){ 43 | const connection = new Connection; 44 | connection.checkConnection(false, timeout).then( 45 | function (result){ 46 | if (result === true) { 47 | resolve(new GpgME()); 48 | } else { 49 | if (connection._connectionError) { 50 | if (connection.isNativeHostUnknown){ 51 | reject(gpgme_error('CONN_NO_CONFIG')); 52 | } else { 53 | reject(gpgme_error('CONN_NATIVEMESSAGE', 54 | connection._connectionError) 55 | ); 56 | } 57 | } else { 58 | reject(gpgme_error('CONN_TIMEOUT')); 59 | } 60 | } 61 | }, function (){ // unspecific connection error. Should not happen 62 | reject(gpgme_error('CONN_NO_CONNECT')); 63 | }); 64 | }); 65 | } 66 | 67 | const exportvalue = { init:init }; 68 | export default exportvalue; -------------------------------------------------------------------------------- /src/data-user.c: -------------------------------------------------------------------------------- 1 | /* data-user.c - A user callback based data object. 2 | * Copyright (C) 2002, 2004 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #ifdef HAVE_SYS_TYPES_H 26 | # include 27 | #endif 28 | #include 29 | 30 | #include "debug.h" 31 | #include "data.h" 32 | 33 | 34 | static gpgme_ssize_t 35 | user_read (gpgme_data_t dh, void *buffer, size_t size) 36 | { 37 | if (!dh->data.user.cbs->read) 38 | { 39 | gpg_err_set_errno (EBADF); 40 | return -1; 41 | } 42 | 43 | return (*dh->data.user.cbs->read) (dh->data.user.handle, buffer, size); 44 | } 45 | 46 | 47 | static gpgme_ssize_t 48 | user_write (gpgme_data_t dh, const void *buffer, size_t size) 49 | { 50 | if (!dh->data.user.cbs->write) 51 | { 52 | gpg_err_set_errno (EBADF); 53 | return -1; 54 | } 55 | 56 | return (*dh->data.user.cbs->write) (dh->data.user.handle, buffer, size); 57 | } 58 | 59 | 60 | static gpgme_off_t 61 | user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) 62 | { 63 | if (!dh->data.user.cbs->seek) 64 | { 65 | gpg_err_set_errno (EBADF); 66 | return -1; 67 | } 68 | 69 | return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence); 70 | } 71 | 72 | 73 | static void 74 | user_release (gpgme_data_t dh) 75 | { 76 | if (dh->data.user.cbs->release) 77 | (*dh->data.user.cbs->release) (dh->data.user.handle); 78 | } 79 | 80 | 81 | static struct _gpgme_data_cbs user_cbs = 82 | { 83 | user_read, 84 | user_write, 85 | user_seek, 86 | user_release, 87 | NULL 88 | }; 89 | 90 | 91 | gpgme_error_t 92 | gpgme_data_new_from_cbs (gpgme_data_t *r_dh, gpgme_data_cbs_t cbs, void *handle) 93 | { 94 | gpgme_error_t err; 95 | TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_cbs", r_dh, "handle=%p", handle); 96 | 97 | err = _gpgme_data_new (r_dh, &user_cbs); 98 | if (err) 99 | return TRACE_ERR (err); 100 | 101 | (*r_dh)->data.user.cbs = cbs; 102 | (*r_dh)->data.user.handle = handle; 103 | TRACE_SUC ("dh=%p", *r_dh); 104 | return 0; 105 | } 106 | -------------------------------------------------------------------------------- /src/data-stream.c: -------------------------------------------------------------------------------- 1 | /* data-stream.c - A stream based data object. 2 | * Copyright (C) 2002, 2004 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #ifdef HAVE_SYS_TYPES_H 27 | # include 28 | #endif 29 | 30 | #include "debug.h" 31 | #include "data.h" 32 | 33 | 34 | static gpgme_ssize_t 35 | stream_read (gpgme_data_t dh, void *buffer, size_t size) 36 | { 37 | size_t amt = fread (buffer, 1, size, dh->data.stream); 38 | if (amt > 0) 39 | return amt; 40 | return ferror (dh->data.stream) ? -1 : 0; 41 | } 42 | 43 | 44 | static gpgme_ssize_t 45 | stream_write (gpgme_data_t dh, const void *buffer, size_t size) 46 | { 47 | size_t amt = fwrite (buffer, 1, size, dh->data.stream); 48 | if (amt > 0) 49 | return amt; 50 | return ferror (dh->data.stream) ? -1 : 0; 51 | } 52 | 53 | 54 | static gpgme_off_t 55 | stream_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) 56 | { 57 | int err; 58 | 59 | #ifdef HAVE_FSEEKO 60 | err = fseeko (dh->data.stream, offset, whence); 61 | #else 62 | /* FIXME: Check for overflow, or at least bail at compilation. */ 63 | err = fseek (dh->data.stream, offset, whence); 64 | #endif 65 | 66 | if (err) 67 | return -1; 68 | 69 | #ifdef HAVE_FSEEKO 70 | return ftello (dh->data.stream); 71 | #else 72 | return ftell (dh->data.stream); 73 | #endif 74 | } 75 | 76 | 77 | static int 78 | stream_get_fd (gpgme_data_t dh) 79 | { 80 | fflush (dh->data.stream); 81 | return fileno (dh->data.stream); 82 | } 83 | 84 | 85 | static struct _gpgme_data_cbs stream_cbs = 86 | { 87 | stream_read, 88 | stream_write, 89 | stream_seek, 90 | NULL, 91 | stream_get_fd 92 | }; 93 | 94 | 95 | gpgme_error_t 96 | gpgme_data_new_from_stream (gpgme_data_t *r_dh, FILE *stream) 97 | { 98 | gpgme_error_t err; 99 | TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_stream", r_dh, "stream=%p", 100 | stream); 101 | 102 | err = _gpgme_data_new (r_dh, &stream_cbs); 103 | if (err) 104 | return TRACE_ERR (err); 105 | 106 | (*r_dh)->data.stream = stream; 107 | TRACE_SUC ("dh=%p", *r_dh); 108 | return 0; 109 | } 110 | -------------------------------------------------------------------------------- /tests/gpgsm/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2000 Werner Koch (dd9jn) 2 | # Copyright (C) 2001 g10 Code GmbH 3 | # 4 | # This file is part of GPGME. 5 | # 6 | # GPGME is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | # Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, see . 18 | # SPDX-License-Identifier: LGPL-2.1-or-later 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | GPGSM = gpgsm 23 | GPG_AGENT = gpg-agent 24 | 25 | GNUPGHOME=$(abs_builddir) 26 | TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) LC_ALL=C GPG_AGENT_INFO= \ 27 | top_srcdir=$(top_srcdir) 28 | 29 | noinst_HEADERS = t-support.h 30 | 31 | c_tests = t-import t-keylist t-encrypt t-verify t-decrypt t-sign t-export 32 | 33 | 34 | TESTS = initial.test $(c_tests) final.test 35 | 36 | EXTRA_DIST = cert_dfn_pca01.der cert_dfn_pca15.der cert_g10code_test1.der \ 37 | $(key_id) initial.test final.test 38 | 39 | AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ 40 | AM_LDFLAGS = -no-install 41 | LDADD = ../../src/libgpgme.la @LDADD_FOR_TESTS_KLUDGE@ 42 | 43 | # We don't run t-genkey in the test suite, because it takes too long 44 | # and needs a working pinentry. 45 | noinst_PROGRAMS = $(c_tests) t-genkey cms-keylist cms-decrypt 46 | 47 | key_id = 32100C27173EF6E9C4E9A25D3D69F86D37A4F939 48 | 49 | CLEANFILES = pubring-stamp pubring.kbx pubring.kbx~ gpgsm.conf trustlist.txt \ 50 | random_seed S.gpg-agent gpg-sample.stamp 51 | 52 | clean-local: 53 | -$(TESTS_ENVIRONMENT) $(top_srcdir)/tests/start-stop-agent --stop 54 | -rm -fR private-keys-v1.d 55 | 56 | BUILT_SOURCES = gpgsm.conf trustlist.txt pubring-stamp \ 57 | gpg-sample.stamp 58 | 59 | pubring-stamp: $(srcdir)/cert_g10code_test1.der gpg-sample.stamp 60 | $(TESTS_ENVIRONMENT) $(GPGSM) --import $(srcdir)/cert_g10code_test1.der 61 | touch pubring-stamp 62 | 63 | gpgsm.conf: 64 | echo disable-crl-checks > ./gpgsm.conf 65 | echo faked-system-time 1008241200 >> ./gpgsm.conf 66 | echo "agent-program `which $(GPG_AGENT)`|--debug-quick-random" >> ./gpgsm.conf 67 | 68 | gpg-sample.stamp: $(srcdir)/$(key_id) 69 | -$(TESTS_ENVIRONMENT) gpgconf --kill all 70 | $(MKDIR_P) ./private-keys-v1.d 71 | cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key 72 | echo x > ./gpg-sample.stamp 73 | 74 | trustlist.txt: 75 | echo $(key_id) > ./trustlist.txt 76 | echo >> ./trustlist.txt 77 | echo "# CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=Düsseldorf,C=DE" >> ./trustlist.txt 78 | echo "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E S" >> ./trustlist.txt 79 | 80 | -------------------------------------------------------------------------------- /src/get-env.c: -------------------------------------------------------------------------------- 1 | /* get_env.c - A getenv() replacement. 2 | * Copyright (C) 2003, 2004 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | #include 25 | #include 26 | #include 27 | 28 | #include "util.h" 29 | 30 | 31 | /* Retrieve the environment variable NAME and return a copy of it in a 32 | malloc()'ed buffer in *VALUE. If the environment variable is not 33 | set, return NULL in *VALUE. */ 34 | 35 | #ifdef HAVE_GETENV_R 36 | #define INITIAL_GETENV_SIZE 32 37 | 38 | gpgme_error_t 39 | _gpgme_getenv (const char *name, char **value) 40 | { 41 | size_t len = INITIAL_GETENV_SIZE; 42 | char *env_value; 43 | 44 | env_value = malloc (len); 45 | 46 | while (1) 47 | { 48 | *value = env_value; 49 | if (!env_value) 50 | return gpg_error_from_syserror (); 51 | 52 | if (getenv_r (name, env_value, len) == 0) 53 | break; 54 | 55 | if (errno == ERANGE) 56 | { 57 | len *= 2; 58 | env_value = realloc (env_value, len); 59 | } 60 | else 61 | { 62 | int saved = errno; 63 | 64 | free (env_value); 65 | *value = NULL; 66 | if (errno == ENOENT) 67 | return 0; 68 | else 69 | return gpg_error_from_errno (saved); 70 | } 71 | } 72 | 73 | return 0; 74 | } 75 | #else 76 | #ifndef HAVE_THREAD_SAFE_GETENV 77 | GPGRT_LOCK_DEFINE (environ_lock); 78 | #endif 79 | 80 | gpgme_error_t 81 | _gpgme_getenv (const char *name, char **value) 82 | { 83 | char *env_value; 84 | gpgme_error_t err = 0; 85 | 86 | #ifndef HAVE_THREAD_SAFE_GETENV 87 | gpg_err_code_t rc; 88 | 89 | rc= gpgrt_lock_lock (&environ_lock); 90 | if (rc) 91 | { 92 | err = gpg_error (rc); 93 | goto leave; 94 | } 95 | #endif 96 | env_value = getenv (name); 97 | if (!env_value) 98 | *value = NULL; 99 | else 100 | { 101 | *value = strdup (env_value); 102 | if (!*value) 103 | err = gpg_error_from_syserror (); 104 | } 105 | #ifndef HAVE_THREAD_SAFE_GETENV 106 | rc = gpgrt_lock_unlock (&environ_lock); 107 | if (rc) 108 | err = gpg_error (rc); 109 | leave: 110 | #endif 111 | return err; 112 | } 113 | #endif 114 | -------------------------------------------------------------------------------- /tests/gpg/t-file-name.c: -------------------------------------------------------------------------------- 1 | /* t-file-name.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | /* We need to include config.h so that we know whether we are building 23 | with large file system (LFS) support. */ 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | #include "t-support.h" 35 | 36 | #define TESTNAME "abcde12345" 37 | 38 | 39 | int 40 | main (void) 41 | { 42 | gpgme_ctx_t ctx; 43 | gpgme_error_t err; 44 | gpgme_data_t in, out; 45 | gpgme_key_t key[2] = { NULL, NULL }; 46 | gpgme_decrypt_result_t result; 47 | char *agent_info; 48 | 49 | init_gpgme (GPGME_PROTOCOL_OpenPGP); 50 | 51 | err = gpgme_new (&ctx); 52 | fail_if_err (err); 53 | gpgme_set_armor (ctx, 1); 54 | 55 | agent_info = getenv("GPG_AGENT_INFO"); 56 | if (!(agent_info && strchr (agent_info, ':'))) 57 | gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); 58 | 59 | err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0); 60 | fail_if_err (err); 61 | 62 | err = gpgme_data_set_file_name (in, TESTNAME); 63 | fail_if_err (err); 64 | 65 | err = gpgme_data_new (&out); 66 | fail_if_err (err); 67 | 68 | err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734", 69 | &key[0], 0); 70 | fail_if_err (err); 71 | 72 | err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); 73 | fail_if_err (err); 74 | 75 | gpgme_data_release (in); 76 | err = gpgme_data_new (&in); 77 | fail_if_err (err); 78 | 79 | err = gpgme_data_seek (out, 0, SEEK_SET); 80 | fail_if_err (err); 81 | 82 | err = gpgme_op_decrypt (ctx, out, in); 83 | fail_if_err (err); 84 | result = gpgme_op_decrypt_result (ctx); 85 | 86 | if (strcmp (TESTNAME, result->file_name)) 87 | { 88 | fprintf (stderr, "%s:%i: Unexpected result file name: %s\n", 89 | __FILE__, __LINE__, 90 | result->file_name ? result->file_name : "(null)"); 91 | exit (1); 92 | } 93 | 94 | gpgme_key_unref (key[0]); 95 | gpgme_data_release (in); 96 | gpgme_data_release (out); 97 | gpgme_release (ctx); 98 | return 0; 99 | } 100 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Package: gpgme 2 | Homepage: https://gnupg.org/software/gpgme/ 3 | Download: https://gnupg.org/ftp/gcrypt/gpgme/ 4 | Repository: git://git.gnupg.org/gpgme.git 5 | Maintainer: Werner Koch 6 | Bug reports: https://bugs.gnupg.org 7 | Security related bug reports: security@gnupg.org 8 | License (software): LGPL-2.1-or-later 9 | License (manual+tools): GPL-3.0-or-later 10 | 11 | 12 | GPGME is free software. See the files COPYING.LESSER and COPYING for 13 | copying conditions, and LICENSES for notices about contributions 14 | that require these additional notices to be distributed. License 15 | copyright years may be listed using range notation, e.g., 2000-2013, 16 | indicating that every year in the range, inclusive, is a copyrightable 17 | year that would otherwise be listed individually. 18 | 19 | 20 | List of Copyright holders 21 | ========================= 22 | 23 | Copyright (C) 1991-2013 Free Software Foundation, Inc. 24 | Copyright (C) 2000-2001 Werner Koch 25 | Copyright (C) 2001-2025 g10 Code GmbH 26 | Copyright (C) 2002 Klarälvdalens Datakonsult AB 27 | Copyright (C) 2004-2008 Igor Belyi 28 | Copyright (C) 2002 John Goerzen 29 | Copyright (c) 2009 Dave Gamble 30 | Copyright (C) 2014, 2015 Martin Albrecht 31 | Copyright (C) 2015, 2018 Ben McGinnes 32 | Copyright (C) 2015, 2016, 2018 33 | Bundesamt für Sicherheit in der Informationstechnik 34 | Copyright (C) 2016 Intevation GmbH 35 | 36 | 37 | Authors info 38 | ============ 39 | 40 | FSF 41 | - Code taken from GnuPG 1.0: src/w32-util.c. 42 | - Other from FSF projects: src/setenv.c, src/vasprintf.c, 43 | src/stpcpy.c, src/w32-ce.c. 44 | 45 | g10 Code GmbH 46 | - All stuff since mid March 2001. 47 | 48 | Werner Koch 49 | - Design and most stuff. 50 | 51 | Wojciech Polak 52 | - gpgme.spec 53 | 54 | 55 | Authors with a DCO 56 | ================== 57 | 58 | Daniel Kahn Gillmor 59 | 2014-09-24:878ul9w4j8.fsf@alice.fifthhorseman.net: 60 | 61 | Colin Watson 62 | 2017-09-16:20170916031428.uypfrdojquvjteor@riva.ucam.org: 63 | 64 | Tobias Mueller 65 | 2016-11-23:1479937342.11180.3.camel@cryptobitch.de: 66 | 67 | Ben McGinnes 68 | 2017-12-16:20171216002102.l6aejk5xdp6xhtfi@adversary.org: 69 | 70 | Jacob Adams 71 | 2018-06-03:ad5141df-b6cc-6c2a-59df-b2f18f7160fd@gmail.com: 72 | 73 | Guillaume LE VAILLANT 74 | 2018-10-11:20181011113825.76f9752a@yamatai: 75 | 76 | Collin Funk 77 | 2025-05-23:87jz66yhe0.fsf@gmail.com: 78 | 79 | Chandler Davis 80 | 2025-11-13:IAnpb7D6uyR[...]W8=@chandlerdavis.cc: 81 | 82 | 83 | Copyright 2001, 2002, 2012, 2013 g10 Code GmbH 84 | 85 | This file is free software; as a special exception the author gives 86 | unlimited permission to copy and/or distribute it, with or without 87 | modifications, as long as this notice is preserved. 88 | 89 | This file is distributed in the hope that it will be useful, but 90 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 91 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 92 | -------------------------------------------------------------------------------- /src/parsetlv.c: -------------------------------------------------------------------------------- 1 | /* parsetlv.c - ASN.1 TLV functions 2 | * Copyright (C) 2005, 2007, 2008, 2012 g10 Code GmbH 3 | * 4 | * This file is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as 6 | * published by the Free Software Foundation; either version 2.1 of 7 | * the License, or (at your option) any later version. 8 | * 9 | * This file is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, see . 16 | * SPDX-License-Identifier: LGPL-2.1-or-later 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | # include 21 | #endif 22 | #include 23 | #include 24 | #include 25 | 26 | #include "parsetlv.h" 27 | 28 | 29 | /* Simple but pretty complete ASN.1 BER parser. Parse the data at the 30 | address of BUFFER with a length given at the address of SIZE. On 31 | success return 0 and update BUFFER and SIZE to point to the value. 32 | Do not update them on error. The information about the object are 33 | stored in the caller allocated TI structure. */ 34 | int 35 | _gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti) 36 | { 37 | int c; 38 | unsigned long tag; 39 | const unsigned char *buf = (const unsigned char *)(*buffer); 40 | size_t length = *size; 41 | 42 | ti->cls = 0; 43 | ti->tag = 0; 44 | ti->is_cons = 0; 45 | ti->is_ndef = 0; 46 | ti->length = 0; 47 | ti->nhdr = 0; 48 | 49 | if (!length) 50 | return -1; 51 | c = *buf++; length--; ++ti->nhdr; 52 | 53 | ti->cls = (c & 0xc0) >> 6; 54 | ti->is_cons = !!(c & 0x20); 55 | tag = c & 0x1f; 56 | 57 | if (tag == 0x1f) 58 | { 59 | tag = 0; 60 | do 61 | { 62 | tag <<= 7; 63 | if (!length) 64 | return -1; 65 | c = *buf++; length--; ++ti->nhdr; 66 | tag |= c & 0x7f; 67 | } 68 | while (c & 0x80); 69 | } 70 | ti->tag = tag; 71 | 72 | if (!length) 73 | return -1; 74 | c = *buf++; length--; ++ti->nhdr; 75 | 76 | if ( !(c & 0x80) ) 77 | ti->length = c; 78 | else if (c == 0x80) 79 | ti->is_ndef = 1; 80 | else if (c == 0xff) 81 | return -1; 82 | else 83 | { 84 | unsigned long len = 0; 85 | int count = (c & 0x7f); 86 | 87 | if (count > sizeof (len) || count > sizeof (size_t)) 88 | return -1; 89 | 90 | for (; count; count--) 91 | { 92 | len <<= 8; 93 | if (!length) 94 | return -1; 95 | c = *buf++; length--; ++ti->nhdr; 96 | len |= c & 0xff; 97 | } 98 | ti->length = len; 99 | } 100 | 101 | if (ti->length > ti->nhdr && (ti->nhdr + ti->length) < ti->length) 102 | return -1; /* Integer overflow. */ 103 | 104 | *buffer = (void*)buf; 105 | *size = length; 106 | return 0; 107 | } 108 | -------------------------------------------------------------------------------- /tests/gpgsm/t-decrypt.c: -------------------------------------------------------------------------------- 1 | /* t-encrypt.c - Regression test. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | /* We need to include config.h so that we know whether we are building 23 | with large file system (LFS) support. */ 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | #include "t-support.h" 35 | 36 | 37 | static const char test_text1[] = "Hallo Leute!\n"; 38 | static const char test_cip1[] = 39 | "-----BEGIN CMS OBJECT-----\n" 40 | "MIAGCSqGSIb3DQEHA6CAMIACAQAxggEJMIIBBQIBADBwMGsxCzAJBgNVBAYTAkRF\n" 41 | "MRMwEQYDVQQHFApE/HNzZWxkb3JmMRYwFAYDVQQKEw1nMTAgQ29kZSBHbWJIMRkw\n" 42 | "FwYDVQQLExBBZWd5cHRlbiBQcm9qZWN0MRQwEgYDVQQDEwt0ZXN0IGNlcnQgMQIB\n" 43 | "ADALBgkqhkiG9w0BAQEEgYBOFcOfUtAav+XjKGM1RJtF+8JLkbnu46S3T3709Iok\n" 44 | "u+Z9dwpOyfHwxXOmjzkSKQSBBxxi6ar+sKjU/KfPIvaMpARwT+NfIVSCZRWIJ27z\n" 45 | "wbSrav/kcRRDDA0wXV7dHVmSLPUJNCpiFMNZbkYtI+ai15g0PVeDw+szYd9zdsjJ\n" 46 | "2zCABgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECA8gPQY2NtJToIAECAeoY3MIcz9h\n" 47 | "BAiiytWtOSmqnwAA\n" 48 | "-----END CMS OBJECT-----\n"; 49 | 50 | 51 | int 52 | main (void) 53 | { 54 | gpgme_ctx_t ctx; 55 | gpgme_error_t err; 56 | gpgme_data_t in, out; 57 | size_t len; 58 | char *test_text2; 59 | gpgme_decrypt_result_t result; 60 | 61 | init_gpgme (GPGME_PROTOCOL_CMS); 62 | 63 | err = gpgme_new (&ctx); 64 | fail_if_err (err); 65 | gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); 66 | 67 | err = gpgme_data_new_from_mem (&in, test_cip1, strlen (test_cip1), 0); 68 | fail_if_err (err); 69 | 70 | err = gpgme_data_new (&out); 71 | fail_if_err (err); 72 | 73 | err = gpgme_op_decrypt (ctx, in, out); 74 | fail_if_err (err); 75 | result = gpgme_op_decrypt_result (ctx); 76 | if (result->unsupported_algorithm) 77 | { 78 | fprintf (stderr, "%s:%i: unsupported algorithm: %s\n", 79 | __FILE__, __LINE__, result->unsupported_algorithm); 80 | exit (1); 81 | } 82 | test_text2 = gpgme_data_release_and_get_mem (out, &len); 83 | test_text2[len] = '\0'; 84 | if (strcmp (test_text1, test_text2)) 85 | { 86 | fprintf (stderr, "%s:%i: data mismatch: expected: \n\"%s\"\n" 87 | "got:\n\"%s\"", 88 | __FILE__, __LINE__, test_text1, test_text2); 89 | exit (1); 90 | } 91 | 92 | free (test_text2); 93 | gpgme_data_release (in); 94 | gpgme_release (ctx); 95 | return 0; 96 | } 97 | -------------------------------------------------------------------------------- /tests/gpgsm/cms-decrypt.c: -------------------------------------------------------------------------------- 1 | /* cms-decrypt.c - Helper to debug the decrupt operation. 2 | * Copyright (C) 2008 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | /* We need to include config.h so that we know whether we are building 22 | with large file system (LFS) support. */ 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #define PGM "cms-decrypt" 34 | 35 | #include "t-support.h" 36 | 37 | static const char * 38 | nonnull (const char *s) 39 | { 40 | return s? s :"[none]"; 41 | } 42 | 43 | 44 | int 45 | main (int argc, char **argv) 46 | { 47 | gpgme_error_t err; 48 | gpgme_ctx_t ctx; 49 | gpgme_data_t in, out; 50 | gpgme_decrypt_result_t result; 51 | gpgme_recipient_t recp; 52 | 53 | if (argc) 54 | { argc--; argv++; } 55 | 56 | if (argc != 1) 57 | { 58 | fputs ("usage: " PGM " FILE\n", stderr); 59 | exit (1); 60 | } 61 | 62 | init_gpgme (GPGME_PROTOCOL_CMS); 63 | 64 | err = gpgme_new (&ctx); 65 | fail_if_err (err); 66 | gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); 67 | 68 | 69 | err = gpgme_data_new_from_file (&in, *argv, 1); 70 | fail_if_err (err); 71 | 72 | err = gpgme_data_new (&out); 73 | fail_if_err (err); 74 | 75 | err = gpgme_op_decrypt (ctx, in, out); 76 | printf ("gpgme_op_decrypt: %s <%s> (%u)\n", 77 | gpgme_strerror (err), gpgme_strsource (err), err); 78 | result = gpgme_op_decrypt_result (ctx); 79 | if (!result) 80 | { 81 | fputs (PGM ": error: decryption result missing\n", stderr); 82 | exit (1); 83 | } 84 | 85 | printf ("unsupported_algorithm: %s\n", 86 | nonnull (result->unsupported_algorithm)); 87 | printf ("wrong_key_usage: %u\n", result->wrong_key_usage); 88 | printf ("file_name: %s\n", nonnull (result->file_name)); 89 | for (recp = result->recipients; recp; recp = recp->next) 90 | { 91 | printf ("recipient.status: %s <%s> (%u)\n", 92 | gpgme_strerror (recp->status), gpgme_strsource (recp->status), 93 | recp->status); 94 | printf ("recipient.pkalgo: %d\n", recp->pubkey_algo); 95 | printf ("recipient.keyid : %s\n", nonnull (recp->keyid)); 96 | } 97 | 98 | if (!err) 99 | { 100 | puts ("plaintext:"); 101 | print_data (out); 102 | gpgme_data_release (out); 103 | } 104 | 105 | gpgme_data_release (in); 106 | 107 | gpgme_release (ctx); 108 | return 0; 109 | } 110 | -------------------------------------------------------------------------------- /src/wait.h: -------------------------------------------------------------------------------- 1 | /* wait.h - Definitions for the wait queue interface. 2 | Copyright (C) 2000 Werner Koch (dd9jn) 3 | Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH 4 | 5 | This file is part of GPGME. 6 | 7 | GPGME is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU Lesser General Public License as 9 | published by the Free Software Foundation; either version 2.1 of 10 | the License, or (at your option) any later version. 11 | 12 | GPGME is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this program; if not, write to the Free Software 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | 02111-1307, USA. */ 21 | 22 | #ifndef WAIT_H 23 | #define WAIT_H 24 | 25 | #include "gpgme.h" 26 | #include "sema.h" 27 | 28 | struct fd_table 29 | { 30 | struct io_select_fd_s *fds; 31 | size_t size; 32 | }; 33 | typedef struct fd_table *fd_table_t; 34 | 35 | /* Wait items are hooked into the io_select_fd_s to connect an fd with 36 | a callback handler. */ 37 | struct wait_item_s 38 | { 39 | gpgme_ctx_t ctx; 40 | gpgme_io_cb_t handler; 41 | void *handler_value; 42 | int dir; 43 | }; 44 | 45 | /* A registered fd handler is removed later using the tag that 46 | identifies it. */ 47 | struct tag 48 | { 49 | /* The context for which the fd was registered. */ 50 | gpgme_ctx_t ctx; 51 | 52 | /* The index into the fd table for this context. */ 53 | int idx; 54 | 55 | /* This is used by the wrappers for the user event loop. */ 56 | void *user_tag; 57 | }; 58 | 59 | 60 | void _gpgme_fd_table_init (fd_table_t fdt); 61 | void _gpgme_fd_table_deinit (fd_table_t fdt); 62 | 63 | gpgme_error_t _gpgme_add_io_cb (void *data, int fd, int dir, 64 | gpgme_io_cb_t fnc, void *fnc_data, void **r_tag); 65 | void _gpgme_remove_io_cb (void *tag); 66 | void _gpgme_wait_private_event_cb (void *data, gpgme_event_io_t type, 67 | void *type_data); 68 | void _gpgme_wait_global_event_cb (void *data, gpgme_event_io_t type, 69 | void *type_data); 70 | 71 | gpgme_error_t _gpgme_wait_user_add_io_cb (void *data, int fd, int dir, 72 | gpgme_io_cb_t fnc, void *fnc_data, 73 | void **r_tag); 74 | void _gpgme_wait_user_remove_io_cb (void *tag); 75 | void _gpgme_wait_user_event_cb (void *data, gpgme_event_io_t type, 76 | void *type_data); 77 | 78 | gpgme_error_t _gpgme_run_io_cb (struct io_select_fd_s *an_fds, int checked, 79 | gpgme_error_t *err); 80 | 81 | 82 | /* Session based interfaces require to make a distinction between IPC 83 | errors and operational errors. To glue this into the old 84 | interface, I/O handlers (esp. the status handler) are called with a 85 | struct as the opaque value that contains the handlers opaque value 86 | but also a field for the operational error to be returned. */ 87 | struct io_cb_data 88 | { 89 | /* If this is the first field, the old internal code will still work. */ 90 | void *handler_value; 91 | 92 | /* The I/O callback can pass an operational error here. */ 93 | gpgme_error_t op_err; 94 | }; 95 | 96 | #endif /* WAIT_H */ 97 | -------------------------------------------------------------------------------- /src/getauditlog.c: -------------------------------------------------------------------------------- 1 | /* getauditlog.c - Retrieve the audit log. 2 | * Copyright (C) 2007 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include "gpgme.h" 26 | #include "debug.h" 27 | #include "context.h" 28 | #include "ops.h" 29 | 30 | 31 | static gpgme_error_t 32 | getauditlog_status_handler (void *priv, gpgme_status_code_t code, char *args) 33 | { 34 | (void)priv; 35 | (void)code; 36 | (void)args; 37 | return 0; 38 | } 39 | 40 | 41 | static gpgme_error_t 42 | getauditlog_start (gpgme_ctx_t ctx, int synchronous, 43 | gpgme_data_t output, unsigned int flags) 44 | { 45 | gpgme_error_t err; 46 | 47 | if (!output) 48 | return gpg_error (GPG_ERR_INV_VALUE); 49 | 50 | if (!(flags & GPGME_AUDITLOG_DIAG)) 51 | { 52 | err = _gpgme_op_reset (ctx, ((synchronous&255) | 256) ); 53 | if (err) 54 | return err; 55 | } 56 | 57 | _gpgme_engine_set_status_handler (ctx->engine, 58 | getauditlog_status_handler, ctx); 59 | 60 | return _gpgme_engine_op_getauditlog (ctx->engine, output, flags); 61 | } 62 | 63 | 64 | 65 | /* Return the auditlog for the current session. This may be called 66 | after a successful or failed operation. If no audit log is 67 | available GPG_ERR_NO_DATA is returned. This is the asynchronous 68 | variant. */ 69 | gpgme_error_t 70 | gpgme_op_getauditlog_start (gpgme_ctx_t ctx, 71 | gpgme_data_t output, unsigned int flags) 72 | { 73 | gpg_error_t err; 74 | TRACE_BEG (DEBUG_CTX, "gpgme_op_getauditlog_start", ctx, 75 | "output=%p, flags=0x%x", output, flags); 76 | 77 | if (!ctx) 78 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); 79 | 80 | err = getauditlog_start (ctx, 0, output, flags); 81 | return TRACE_ERR (err); 82 | } 83 | 84 | 85 | /* Return the auditlog for the current session. This may be called 86 | after a successful or failed operation. If no audit log is 87 | available GPG_ERR_NO_DATA is returned. This is the synchronous 88 | variant. */ 89 | gpgme_error_t 90 | gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags) 91 | { 92 | gpgme_error_t err; 93 | 94 | TRACE_BEG (DEBUG_CTX, "gpgme_op_getauditlog", ctx, 95 | "output=%p, flags=0x%x", output, flags); 96 | 97 | if (!ctx) 98 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); 99 | 100 | err = getauditlog_start (ctx, 1, output, flags); 101 | if (!err) 102 | err = _gpgme_wait_one (ctx); 103 | return TRACE_ERR (err); 104 | } 105 | 106 | -------------------------------------------------------------------------------- /src/signers.c: -------------------------------------------------------------------------------- 1 | /* signers.c - Maintain signer sets. 2 | * Copyright (C) 2001 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | #if HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "gpgme.h" 32 | #include "util.h" 33 | #include "context.h" 34 | #include "debug.h" 35 | 36 | 37 | /* Delete all signers from CTX. */ 38 | void 39 | _gpgme_signers_clear (gpgme_ctx_t ctx) 40 | { 41 | unsigned int i; 42 | 43 | if (!ctx || !ctx->signers) 44 | return; 45 | 46 | for (i = 0; i < ctx->signers_len; i++) 47 | { 48 | assert (ctx->signers[i]); 49 | gpgme_key_unref (ctx->signers[i]); 50 | ctx->signers[i] = NULL; 51 | } 52 | ctx->signers_len = 0; 53 | } 54 | 55 | 56 | void 57 | gpgme_signers_clear (gpgme_ctx_t ctx) 58 | { 59 | TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx, ""); 60 | _gpgme_signers_clear (ctx); 61 | } 62 | 63 | 64 | /* Add KEY to list of signers in CTX. */ 65 | gpgme_error_t 66 | gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) 67 | { 68 | TRACE_BEG (DEBUG_CTX, "gpgme_signers_add", ctx, 69 | "key=%p (%s)", key, (key && key->subkeys && key->subkeys->fpr) ? 70 | key->subkeys->fpr : "invalid"); 71 | 72 | if (!ctx || !key) 73 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); 74 | 75 | if (ctx->signers_len == ctx->signers_size) 76 | { 77 | gpgme_key_t *newarr; 78 | int n = ctx->signers_size + 5; 79 | int j; 80 | 81 | newarr = realloc (ctx->signers, n * sizeof (*newarr)); 82 | if (!newarr) 83 | return TRACE_ERR (gpg_error_from_syserror ()); 84 | for (j = ctx->signers_size; j < n; j++) 85 | newarr[j] = NULL; 86 | ctx->signers = newarr; 87 | ctx->signers_size = n; 88 | } 89 | 90 | gpgme_key_ref (key); 91 | ctx->signers[ctx->signers_len++] = key; 92 | TRACE_SUC (""); 93 | return 0; 94 | } 95 | 96 | 97 | /* Return the number of signers in CTX. */ 98 | unsigned int 99 | gpgme_signers_count (const gpgme_ctx_t ctx) 100 | { 101 | return ctx? ctx->signers_len : 0; 102 | } 103 | 104 | 105 | /* Return the SEQth signer's key in CTX with one reference. */ 106 | gpgme_key_t 107 | gpgme_signers_enum (const gpgme_ctx_t ctx, int seq) 108 | { 109 | unsigned int seqno; 110 | 111 | if (!ctx || seq < 0) 112 | return NULL; 113 | 114 | seqno = (unsigned int) seq; 115 | if (seqno >= ctx->signers_len) 116 | return NULL; 117 | gpgme_key_ref (ctx->signers[seqno]); 118 | return ctx->signers[seqno]; 119 | } 120 | -------------------------------------------------------------------------------- /tests/gpgsm/t-support.h: -------------------------------------------------------------------------------- 1 | /* t-support.h - Helper routines for regression tests. 2 | * Copyright (C) 2000 Werner Koch (dd9jn) 3 | * Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH 4 | * 5 | * This file is part of GPGME. 6 | * 7 | * GPGME is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * GPGME is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this program; if not, see . 19 | * SPDX-License-Identifier: LGPL-2.1-or-later 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #ifndef DIM 30 | #define DIM(v) (sizeof(v)/sizeof((v)[0])) 31 | #endif 32 | 33 | #define fail_if_err(err) \ 34 | do \ 35 | { \ 36 | if (err) \ 37 | { \ 38 | fprintf (stderr, "%s:%d: %s: %s (%d.%d)\n", \ 39 | __FILE__, __LINE__, gpgme_strsource (err), \ 40 | gpgme_strerror (err), \ 41 | gpgme_err_source (err), gpgme_err_code (err)); \ 42 | exit (1); \ 43 | } \ 44 | } \ 45 | while (0) 46 | 47 | 48 | void 49 | print_data (gpgme_data_t dh) 50 | { 51 | #define BUF_SIZE 512 52 | char buf[BUF_SIZE + 1]; 53 | int ret; 54 | 55 | ret = gpgme_data_seek (dh, 0, SEEK_SET); 56 | if (ret) 57 | fail_if_err (gpgme_error_from_errno (errno)); 58 | while ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) > 0) 59 | fwrite (buf, ret, 1, stdout); 60 | if (ret < 0) 61 | fail_if_err (gpgme_error_from_errno (errno)); 62 | } 63 | 64 | 65 | gpgme_error_t 66 | passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info, 67 | int last_was_bad, int fd) 68 | { 69 | int res; 70 | char pass[] = "abc\n"; 71 | int passlen = strlen (pass); 72 | int off = 0; 73 | 74 | (void)opaque; 75 | (void)uid_hint; 76 | (void)passphrase_info; 77 | (void)last_was_bad; 78 | 79 | do 80 | { 81 | res = gpgme_io_write (fd, &pass[off], passlen - off); 82 | if (res > 0) 83 | off += res; 84 | } 85 | while (res > 0 && off != passlen); 86 | 87 | return off == passlen ? 0 : gpgme_error_from_errno (errno); 88 | } 89 | 90 | 91 | char * 92 | make_filename (const char *fname) 93 | { 94 | const char *srcdir = getenv ("srcdir"); 95 | char *buf; 96 | 97 | if (!srcdir) 98 | srcdir = "."; 99 | buf = malloc (strlen(srcdir) + strlen(fname) + 2); 100 | if (!buf) 101 | exit (8); 102 | strcpy (buf, srcdir); 103 | strcat (buf, "/"); 104 | strcat (buf, fname); 105 | return buf; 106 | } 107 | 108 | 109 | void 110 | init_gpgme (gpgme_protocol_t proto) 111 | { 112 | gpgme_error_t err; 113 | 114 | gpgme_check_version (NULL); 115 | #ifndef HAVE_W32_SYSTEM 116 | setlocale (LC_ALL, ""); 117 | gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); 118 | gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); 119 | #endif 120 | 121 | err = gpgme_engine_check_version (proto); 122 | fail_if_err (err); 123 | } 124 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # doc - Automake template 2 | # Copyright (C) 2001, 2004 g10 Code GmbH 3 | # 4 | # This file is part of GPGME. 5 | # 6 | # GPGME is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | # Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, see . 18 | # SPDX-License-Identifier: LGPL-2.1-or-later 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | DISTCLEANFILES = gpgme.tmp yat2m-stamp.tmp yat2m-stamp $(myman_pages) 23 | CLEANFILES = mkdefsinc defs.inc 24 | 25 | EXTRA_DIST = module-overview.sk HACKING DCO ChangeLog-2011 \ 26 | mkdefsinc.c defsincdate \ 27 | examples/gpgme-mozilla.json examples/gpgme-chrome.json 28 | 29 | BUILT_SOURCES = defsincdate defs.inc 30 | 31 | YAT2M_OPTIONS = -I $(srcdir) --release "GPGME @PACKAGE_VERSION@" 32 | 33 | myman_sources = gpgme-json.texi 34 | if HAVE_YAT2M 35 | myman_pages = gpgme-json.1 36 | else 37 | myman_pages = 38 | endif 39 | 40 | man_MANS = $(myman_pages) 41 | 42 | info_TEXINFOS = gpgme.texi 43 | gpgme_TEXINFOS = uiserver.texi lesser.texi gpl.texi gpgme-json.texi 44 | 45 | gpgme.texi : defs.inc 46 | 47 | mkdefsinc: mkdefsinc.c Makefile $(top_builddir)/conf/config.h 48 | $(CC_FOR_BUILD) -I. -I$(top_builddir)/conf -I$(srcdir) \ 49 | $(AM_CPPFLAGS) -o $@ $(srcdir)/mkdefsinc.c 50 | 51 | yat2m-stamp: $(myman_sources) defs.inc 52 | @rm -f yat2m-stamp.tmp 53 | @touch yat2m-stamp.tmp 54 | incd="`test -f defsincdate || echo '$(srcdir)/'`defsincdate"; \ 55 | for file in $(myman_sources) ; do \ 56 | $(YAT2M) $(YAT2M_OPTIONS) --store \ 57 | --date "`cat $$incd 2>/dev/null`" \ 58 | `test -f '$$file' || echo '$(srcdir)/'`$$file ; done 59 | @mv -f yat2m-stamp.tmp $@ 60 | 61 | $(myman_pages) : yat2m-stamp defs.inc 62 | @if test -f $@; then :; else \ 63 | trap 'rm -rf yat2m-stamp yat2m-lock' 1 2 13 15; \ 64 | if mkdir yat2m-lock 2>/dev/null; then \ 65 | rm -f yat2m-stamp; \ 66 | $(MAKE) $(AM_MAKEFLAGS) yat2m-stamp; \ 67 | rmdir yat2m-lock; \ 68 | else \ 69 | while test -d yat2m-lock; do sleep 1; done; \ 70 | test -f yat2m-stamp; exit $$?; \ 71 | fi; \ 72 | fi 73 | 74 | dist-hook: defsincdate 75 | 76 | defsincdate: $(gpgme_TEXINFOS) $(info_TEXINFOS) 77 | : >defsincdate ; \ 78 | if test -e $(top_srcdir)/.git; then \ 79 | (cd $(srcdir) && git log -1 --format='%ct' -- \ 80 | $(info_TEXINFOS) $(gpgme_TEXINFOS) 2>/dev/null) >>defsincdate; \ 81 | fi 82 | 83 | defs.inc: defsincdate Makefile mkdefsinc 84 | incd="`test -f defsincdate || echo '$(srcdir)/'`defsincdate"; \ 85 | ./mkdefsinc -C $(srcdir) --date "`cat $$incd 2>/dev/null`" \ 86 | $(info_TEXINFOS) $(gpgme_TEXINFOS) >$@ 87 | 88 | 89 | online: gpgme.html gpgme.pdf 90 | set -e; \ 91 | echo "Uploading current manuals to www.gnupg.org ..."; \ 92 | user=werner ; \ 93 | (cd gpgme.html && rsync -vr --exclude='.svn' . \ 94 | $${user}@ftp.gnupg.org:webspace/manuals/gpgme/ ); \ 95 | rsync -v gpgme.pdf $${user}@ftp.gnupg.org:webspace/manuals/ 96 | -------------------------------------------------------------------------------- /tests/run-receive-keys.c: -------------------------------------------------------------------------------- 1 | /* run-keylist.c - Helper to show a key listing. 2 | * Copyright (C) 2008, 2009 g10 Code GmbH 3 | * 4 | * This file is part of GPGME. 5 | * 6 | * GPGME is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * GPGME is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | /* We need to include config.h so that we know whether we are building 22 | with large file system (LFS) support. */ 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | #define PGM "run-receive-keys" 35 | 36 | #include "run-support.h" 37 | 38 | 39 | static int verbose; 40 | 41 | 42 | static int 43 | show_usage (int ex) 44 | { 45 | fputs ("usage: " PGM " [options] [KEYIDs_or_FINGERPRINTs]\n\n" 46 | "Options:\n" 47 | " --verbose run in verbose mode\n" 48 | , stderr); 49 | exit (ex); 50 | } 51 | 52 | 53 | int 54 | main (int argc, char **argv) 55 | { 56 | int last_argc = -1; 57 | gpgme_error_t err; 58 | gpgme_ctx_t ctx; 59 | const char *keyids[100]; 60 | const char **keyid = NULL; 61 | gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP; 62 | gpgme_import_result_t impres; 63 | 64 | 65 | if (argc) 66 | { argc--; argv++; } 67 | 68 | while (argc && last_argc != argc) 69 | { 70 | last_argc = argc; 71 | if (!strcmp (*argv, "--")) 72 | { 73 | argc--; argv++; 74 | break; 75 | } 76 | else if (!strcmp (*argv, "--help")) 77 | show_usage (0); 78 | else if (!strcmp (*argv, "--verbose")) 79 | { 80 | verbose = 1; 81 | argc--; argv++; 82 | } 83 | else if (!strncmp (*argv, "--", 2)) 84 | show_usage (1); 85 | } 86 | 87 | if (!argc) 88 | show_usage (1); 89 | if (argc > 99) { 90 | argc = 99; 91 | } 92 | for (keyid = keyids; argc; argc--, argv++, keyid++) { 93 | *keyid = *argv; 94 | } 95 | *keyid = NULL; 96 | 97 | init_gpgme (protocol); 98 | 99 | err = gpgme_new (&ctx); 100 | fail_if_err (err); 101 | gpgme_set_protocol (ctx, protocol); 102 | 103 | err = gpgme_op_receive_keys (ctx, keyids); 104 | fail_if_err (err); 105 | impres = gpgme_op_import_result (ctx); 106 | if (!impres) 107 | { 108 | fprintf (stderr, PGM ": no import result returned\n"); 109 | exit (1); 110 | } 111 | print_import_result (impres); 112 | 113 | if (verbose) 114 | { 115 | gpgme_data_t log; 116 | char *buf; 117 | size_t len; 118 | 119 | gpgme_data_new (&log); 120 | err = gpgme_op_getauditlog (ctx, log, GPGME_AUDITLOG_DIAG); 121 | fail_if_err (err); 122 | buf = gpgme_data_release_and_get_mem (log, &len); 123 | printf ("\nDiagnostic output:\n%.*s\n", (int)len, buf); 124 | free (buf); 125 | } 126 | 127 | gpgme_release (ctx); 128 | return 0; 129 | } 130 | -------------------------------------------------------------------------------- /lang/js/BrowserTestExtension/testkey.sec: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PRIVATE KEY BLOCK----- 2 | 3 | lQOYBFrsKEkBCADKw4Wt8J6M/88qD8PO6lSMCxH1cpwH8iK0uPaFFYsJkkXo7kWf 4 | PTAtrV+REqF/o80dvYcdLvRsV21pvncZz/HXLu1yQ18mC3XObrKokbdgrTTKA5XE 5 | BZkNsqyaMMJauT18H4hYkSg62/tTdO1cu/zWv/LFf7Xyn6+uA74ovXCJlO1s0N2c 6 | PShtr98QRzPMf2owgVk37JnDNp4gGVDGHxSZOuUwxgYAZYnA8SFc+c+3ZrQfY870 7 | +O4j3Mz4p7yD13AwP4buQLBsb/icxekeQCqpRJhLH9f7MdEcGXa1x36RcEkHdu+M 8 | yJ392eMgD+dKNfRCtyTPhjZTxvbNELIBYICfABEBAAEAB/wLJ0gyMjs2fFfT83wM 9 | 5Lzz2yQIwV4t3bblBAujdHTqeN5Zmsm/oakFyjSokULK96Kv0R4ej9eoIgMFvxFk 10 | HRkrggxTrbsNJ7I6QcKYHTPeIIj318ykNL6fj0WJUcdPIENukXl5jbqNyk3/4D2y 11 | TTDySyq6jHTgvMH4K4KJUSpglvSJPntTk9RhuFGHAF+sNR9atygDYctAaERMRtSg 12 | LCoSt/AoX5GRMlQjXT9oqQjwSQoZyF4s8HMC8wdTFIE/E0L4IVdHVp8sz2UszNtT 13 | W/evmCA+KVruKjRH/Fhrq4hHkEamW28+j4L6uAyagONP7BONs+S5Oo2zTT9+tV2R 14 | ILTZBADdgLuAgF6C5Lu9jCF6DfFgaT/uafMyQNkEGNlxOHMWHTgLHe475V2eG9gA 15 | amd4yXKyEFKU1PWnvlGuicQSGdzVcwmq61msvXgYD0FK3LP3yWzKnE4X1tzrC9Vp 16 | /uHJxKjewCuyt1f5in919v+T8TbUxBYKC0zX/qWtX+10cTx77QQA6leqhToJ95Yc 17 | u4UBrKMEO+y2v8Svb3LG7yI5oY8tkw0EkJ/kpZ8xTAfZYCe6fXdvVE3PHg2lrxyc 18 | Wv/EU3QY/qA3G82mbXYeJ2jNZaTNYo4MylMrt4Mx25x4ke7JlsE8SVrQ+4CrHkqp 19 | OjSIa7fppLrQ78uW980AtN8NNQGrlTsD/A9aoA60Igxy1Q3K2uSyDCyjLknv57ym 20 | ZSBD3/t7m0l6Q6gbdfhNGosT+Hd4y3actqEqzXZHW2VG4dKZ/wRNkxtSm9adU9vs 21 | EHyzxjb6mKIH32zAG5TaFT20hC+NK6lsyHr9UE2ZrS6ma2sLxGW2O40hqNsdD+5m 22 | NrqeBc2I/js1PMK0EHRlc3RAZXhhbXBsZS5vcmeJAVQEEwEIAD4WIQTUFzW5Ejb9 23 | uIIEjFojAWNe7/DLBQUCWuwoSQIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIe 24 | AQIXgAAKCRAjAWNe7/DLBf9kB/wOQ/S60HGwFq07W9N01HWULyhHKoMmcHL6rfZ6 25 | 4oDqLxolPSasz7WAMW1jN4qtWJ0mFzwO83V6kaBe+wF6Kqir6udFSBW9rPcFg6/V 26 | ZXPltT0a6uacIHq6DyQ5iMW4YQWbVy9OR2rNGkYo1JCBR0XdRJYCSX3yB4TWv/eX 27 | nZ37/WjmiTOIZh35rjs+NuU/S5JPDfAp2/k70DevQeBsv+UjVXjWpNTZmPbvDnd9 28 | 95uSmC6UY4hzyP84ORYMYn9n1QAR0goxDN6UunOf9Rlp1oMzdxMool/d1MlCxg2h 29 | 3jheuhv7lgUF4KpvHOuEPXQ7UO417E0TYcDZ1J8Nsv87SZeEnQOYBFrsKEkBCADj 30 | oEBhG/QPqZHg8VyoD1xYRAWGxyDJkX/GrSs6yE+x2hk5FoQCajxKa/d4AVxOnJpd 31 | whAfeXeSNaql5Ejgzax+Tdj9BV6vtGVJVv0pO7bgAiZxkA6RHxtNqhpPnPQoXvUz 32 | kzpRgpuL+Nj4yIg7z1ITH6KQH4u5SI9vd+j/8i9Taz67pdZwuJjac8qBuJHjzAo1 33 | bjYctFYUSG5pbmMQyNLySzgiNkFa4DajODlt3RuqVGP316Fk+Sy2+60tC/HlX8jg 34 | MyMONfOGBQx6jk8tvAphS/LAqrrNepnagIyLUGKU+L8cB2g1PGGp2biBFWqZbudZ 35 | oyRBet/0yH/zirBdQJw1ABEBAAEAB/4lN3gXOI4OuoOcsvHak4pebx61Mt0YP9cT 36 | qZASIBqxok5x8E28pFh/tYfkYdqRCtdNYZOnxcEoUWh5j6nfwZkEnJ9P/T8GPNk7 37 | pMKnKXmExi05b5uGHD8nU1rSbf/YkvAF0vpbxd4/RDxbbtQhbUwGzusSI+pBLM0w 38 | 5TreEB+vRGBc2gOvXXOtKLNEa7M9rH2EwbAkP3jOGGwgk6adxbQdBcRxq4merqhL 39 | YrVz73bCj8TDc0fsNJyIaZZJ++ejfBFYavsF1pvx9z7FNFi8rSXoiB3SBtaWGfhr 40 | bwNaMZrDc7TRIq/fgGaL6g//bzcWrr1YaHXZ10Bgx6UymDOlYkCpBADm0Hv46sPw 41 | 07SO8+IACcaQliOto1pndOPwTimCeo58/7rf8I2a5uuJloGrnPwAX65bKDnUALp6 42 | X3lnXRNMhnB3Uewx4i00LQmjsxhJfQiGLpMv0j58tn64s7GqQzGVV1JKcQm992RV 43 | jFOydyjZ+K4LGWEOITG/bZrMEVNGCM+OnQQA/Haz8xN0NFSlq7tyfFc0pkx/TiCX 44 | xGfBqbO0wU2b5GMnZbY/06HENpidIzpa231VQaw5/nPTvfhlLKW1iGAkc148cX1q 45 | lL9w2ksXuaHR3LXud2VcfVTIdxU/7h7u1dD/85+c0+7jlGObD9cXKxlM6OjpIJz1 46 | l5/1h3C5S0TuxHkEAL/3BGihkhNfv1Xx0rWu0/732usX/nE/A9C26hGu41FUf3fp 47 | 0ilonKpKZUEwWt5hWSEFCSrznNVekiO0rxvuu3RVegvzThPNU4Pf4JZtJpRVhvUQ 48 | d9ulxJw7V9rs75uNBatTNC0kXuGoXhehw4Bn93xa67gYGd3LfrH+oT0GCDpTSHCJ 49 | ATwEGAEIACYWIQTUFzW5Ejb9uIIEjFojAWNe7/DLBQUCWuwoSQIbDAUJA8JnAAAK 50 | CRAjAWNe7/DLBf0pCACPp5hBuUWngu2Hqvg+tNiujfsiYzId3MffFxEk3CbXeHcJ 51 | 5F32NDJ9PYCnra4L8wSv+NZt9gIa8lFwoFSFQCjzH7KE86XcV3MhfdJTNb/+9CR7 52 | Jq3e/4Iy0N5ip7PNYMCyakcAsxvsNCJKrSaDuYe/OAoTXRBtgRWE2uyT315em02L 53 | kr+2Cc/Qk6H+vlNOHGRgnpI/OZZjnUuUfBUvMGHr1phW+y7aeymC9PnUGdViRdJe 54 | 23nntMSDA+0/I7ESO9JsWvJbyBmuiZpu9JjScOjYH9xpQLqRNyw4WHpZriN69F0t 55 | 9Mmd7bM1+UyPgbPEr0iWMeyctYsuOLeUyQKMscDT 56 | =hkUm 57 | -----END PGP PRIVATE KEY BLOCK----- 58 | --------------------------------------------------------------------------------