From 03f660c0b01f9f2f032b3c63255e2768a39b5f24 Mon Sep 17 00:00:00 2001 From: ubbo Date: Tue, 27 Dec 2011 18:32:54 +0000 Subject: add methods getKexByFpr / byId to gpgcontext git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@705 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgcontext.cpp | 27 +++++++++++++++++++++++++++ gpgcontext.h | 3 +++ 2 files changed, 30 insertions(+) diff --git a/gpgcontext.cpp b/gpgcontext.cpp index a388199..55902d7 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -718,6 +718,33 @@ QString GpgContext::beautifyFingerprint(QString fingerprint) return fingerprint; } +/** + * note: privkey status is not returned + */ +GpgKey GpgContext::getKeyByFpr(QString fpr) { + + GpgKeyList list = this->listKeys(); + foreach (GpgKey key, list) { + if(key.fpr == fpr) { + return key; + } + } +} + + +/** + * note: privkey status is not returned + */ +GpgKey GpgContext::getKeyById(QString id) { + + GpgKeyList list = this->listKeys(); + foreach (GpgKey key, list) { + if(key.id == id) { + return key; + } + } +} + } diff --git a/gpgcontext.h b/gpgcontext.h index 92e0613..ed605cf 100644 --- a/gpgcontext.h +++ b/gpgcontext.h @@ -130,6 +130,9 @@ public: */ void preventNoDataErr(QByteArray *in); + GpgKey getKeyByFpr(QString fpr); + GpgKey getKeyById(QString id); + /** * @brief * -- cgit v1.2.3