Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:as_python3_module
python-gpgme
0004-add-pubkey_algo-and-hash_algo-attributes-t...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-add-pubkey_algo-and-hash_algo-attributes-to-signatur.patch of Package python-gpgme
From 2f902e29ef301ba8a23a7d7bfd0943479107206c Mon Sep 17 00:00:00 2001 From: Till Maas <opensource@till.name> Date: Wed, 20 Jul 2016 16:17:22 +0200 Subject: [PATCH 4/6] add pubkey_algo and hash_algo attributes to signatures References: https://bugs.launchpad.net/pygpgme/+bug/1002421 Signed-off-by: Igor Gnatenko <ignatenko@redhat.com> --- src/pygpgme-signature.c | 6 ++++++ src/pygpgme.h | 2 ++ tests/test_sign_verify.py | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/src/pygpgme-signature.c b/src/pygpgme-signature.c index 7f273a1..1d98dfc 100644 --- a/src/pygpgme-signature.c +++ b/src/pygpgme-signature.c @@ -101,6 +101,8 @@ pygpgme_sig_dealloc(PyGpgmeSignature *self) Py_XDECREF(self->wrong_key_usage); Py_XDECREF(self->validity); Py_XDECREF(self->validity_reason); + Py_XDECREF(self->pubkey_algo); + Py_XDECREF(self->hash_algo); PyObject_Del(self); } @@ -117,6 +119,8 @@ static PyMemberDef pygpgme_sig_members[] = { { "validity", T_OBJECT, offsetof(PyGpgmeSignature, validity), READONLY}, { "validity_reason", T_OBJECT, offsetof(PyGpgmeSignature, validity_reason), READONLY}, + { "pubkey_algo", T_OBJECT, offsetof(PyGpgmeSignature, pubkey_algo), READONLY}, + { "hash_algo", T_OBJECT, offsetof(PyGpgmeSignature, hash_algo), READONLY}, { NULL, 0, 0, 0} }; @@ -173,6 +177,8 @@ pygpgme_siglist_new(gpgme_signature_t siglist) item->wrong_key_usage = PyBool_FromLong(sig->wrong_key_usage); item->validity = PyInt_FromLong(sig->validity); item->validity_reason = pygpgme_error_object(sig->validity_reason); + item->pubkey_algo = PyInt_FromLong(sig->pubkey_algo); + item->hash_algo = PyInt_FromLong(sig->hash_algo); if (PyErr_Occurred()) { Py_DECREF(item); Py_DECREF(list); diff --git a/src/pygpgme.h b/src/pygpgme.h index 8453616..25b9328 100644 --- a/src/pygpgme.h +++ b/src/pygpgme.h @@ -76,6 +76,8 @@ typedef struct { PyObject *wrong_key_usage; PyObject *validity; PyObject *validity_reason; + PyObject *pubkey_algo; + PyObject *hash_algo; } PyGpgmeSignature; typedef struct { diff --git a/tests/test_sign_verify.py b/tests/test_sign_verify.py index 5a90f8c..fb6a27d 100644 --- a/tests/test_sign_verify.py +++ b/tests/test_sign_verify.py @@ -57,6 +57,8 @@ class SignVerifyTestCase(GpgHomeTestCase): self.assertEqual(sigs[0].wrong_key_usage, False) self.assertEqual(sigs[0].validity, gpgme.VALIDITY_UNKNOWN) self.assertEqual(sigs[0].validity_reason, None) + self.assertEqual(sigs[0].pubkey_algo, gpgme.PK_DSA) + self.assertEqual(sigs[0].hash_algo, gpgme.MD_SHA1) def test_verify_detached(self): signature = BytesIO(dedent(''' @@ -83,6 +85,8 @@ class SignVerifyTestCase(GpgHomeTestCase): self.assertEqual(sigs[0].wrong_key_usage, False) self.assertEqual(sigs[0].validity, gpgme.VALIDITY_UNKNOWN) self.assertEqual(sigs[0].validity_reason, None) + self.assertEqual(sigs[0].pubkey_algo, gpgme.PK_DSA) + self.assertEqual(sigs[0].hash_algo, gpgme.MD_SHA1) def test_verify_clearsign(self): signature = BytesIO(dedent(''' @@ -114,6 +118,8 @@ class SignVerifyTestCase(GpgHomeTestCase): self.assertEqual(sigs[0].wrong_key_usage, False) self.assertEqual(sigs[0].validity, gpgme.VALIDITY_UNKNOWN) self.assertEqual(sigs[0].validity_reason, None) + self.assertEqual(sigs[0].pubkey_algo, gpgme.PK_DSA) + self.assertEqual(sigs[0].hash_algo, gpgme.MD_SHA1) def test_verify_multiple_sigs(self): signature = BytesIO(dedent(''' @@ -156,6 +162,8 @@ class SignVerifyTestCase(GpgHomeTestCase): self.assertEqual(sigs[0].wrong_key_usage, False) self.assertEqual(sigs[0].validity, gpgme.VALIDITY_UNKNOWN) self.assertEqual(sigs[0].validity_reason, None) + self.assertEqual(sigs[0].pubkey_algo, gpgme.PK_DSA) + self.assertEqual(sigs[0].hash_algo, gpgme.MD_SHA1) self.assertEqual(sigs[1].summary, 0) self.assertEqual(sigs[1].fpr, @@ -167,6 +175,8 @@ class SignVerifyTestCase(GpgHomeTestCase): self.assertEqual(sigs[1].wrong_key_usage, False) self.assertEqual(sigs[1].validity, gpgme.VALIDITY_UNKNOWN) self.assertEqual(sigs[1].validity_reason, None) + self.assertEqual(sigs[1].pubkey_algo, gpgme.PK_RSA) + self.assertEqual(sigs[1].hash_algo, gpgme.MD_SHA1) def test_verify_no_signature(self): signature = BytesIO(dedent(''' -- 2.7.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor