//Methods from XCertificateImpl
sal_Int16 SAL_CALL CertificateImpl::getVersion()
{ return0;
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSerialNumber()
{ // TODO: perhaps map to subkey's cardSerialNumber - if you have // one to test return Sequence< sal_Int8 >();
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getEncoded()
{ if (m_aBits.hasElements()) return m_aBits;
// lazy init: extract key data, store into m_aBits
GpgME::Data data_out;
m_pContext->setArmor(false); // caller will base64-encode anyway
GpgME::Error err = m_pContext->exportPublicKeys( // "exportPublicKeys" is slow!
m_pKey.primaryFingerprint(),
data_out,
officecfg::Office::Common::Security::OpenPGP::MinimalKeyExport::get()
? GpgME::Context::ExportMinimal : 0
);
if (err) throw RuntimeException(u"The GpgME library failed to retrieve the public key"_ustr);
off_t result = data_out.seek(0,SEEK_SET);
(void) result;
assert(result == 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);
result = data_out.seek(0,SEEK_SET);
assert(result == 0); if( data_out.read(m_aBits.getArray(), len) != len ) throw RuntimeException(u"The GpgME library failed to read the key"_ustr);
// Export key to base64Empty for gpg return m_aBits;
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSHA1Thumbprint()
{ // This is mapped to the fingerprint for gpg constchar* keyId = m_pKey.primaryFingerprint();
// get hex fingerprint as byte array return comphelper::containerToSequence<sal_Int8>(svl::crypto::DecodeHexString(keyId));
}
Sequence<sal_Int8> CertificateImpl::getSHA256Thumbprint()
{ // This is mapped to the fingerprint for gpg (though that's only // SHA1 actually) constchar* keyId = m_pKey.primaryFingerprint(); return comphelper::arrayToSequence<sal_Int8>(
keyId, strlen(keyId)+1);
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getMD5Thumbprint()
{ // This is mapped to the shorter keyID for gpg constchar* keyId = m_pKey.keyID(); return comphelper::arrayToSequence<sal_Int8>(
keyId, strlen(keyId)+1);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.