summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/gpg/CertificateImpl.cxx
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2017-06-21 16:54:52 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-06-21 22:16:56 +0200
commit4ddb2f716fa5501271bfb2d270a56562ddb5051d (patch)
treec59899614a26083e43cb34eb2cef1fdd304455fb /xmlsecurity/source/gpg/CertificateImpl.cxx
parentc88063e80d464af195afe88d558a44ef77d69f4a (diff)
gpg4libre: some code improvements, add metadata for OpenPGP keys
Change-Id: I1beb692b9a9a34b5f0cf743ba9e4a145ac582184
Diffstat (limited to 'xmlsecurity/source/gpg/CertificateImpl.cxx')
-rw-r--r--xmlsecurity/source/gpg/CertificateImpl.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx
index c0f48e309c7c..e40f59323a04 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.cxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.cxx
@@ -24,13 +24,12 @@ using namespace css::security;
using namespace css::util;
CertificateImpl::CertificateImpl() :
- m_pKey(nullptr)
+ m_pKey()
{
}
CertificateImpl::~CertificateImpl()
{
- // TODO: cleanup key
}
//Methods from XCertificateImpl
@@ -214,17 +213,16 @@ void CertificateImpl::setCertificate(GpgME::Context* ctx, const GpgME::Key& key)
GpgME::Data data_out;
ctx->exportPublicKeys(key.keyID(), data_out);
- // TODO: needs some error handling
- data_out.seek(0,SEEK_SET);
+ assert(data_out.seek(0,SEEK_SET) == 0);
int len=0, curr=0; char buf;
while( (curr=data_out.read(&buf, 1)) )
len += curr;
// write bits to sequence of bytes
m_aBits.realloc(len);
- data_out.seek(0,SEEK_SET);
+ assert(data_out.seek(0,SEEK_SET) == 0);
if( data_out.read(m_aBits.getArray(), len) != len )
- throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol.");
+ throw RuntimeException("The GpgME library failed to read the key");
}
const GpgME::Key* CertificateImpl::getCertificate() const