summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2017-06-19 23:36:12 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-06-21 20:58:37 +0200
commit355d9cc22fadcda04edf149ff3ab5e43b14a6e9e (patch)
tree2790eb1a52ccb73e4ea65ad54888f1ab9a81c243
parent6cc4b129629ae6e202ff909946a4bc83cb0e57c5 (diff)
API Change or what: add certificate kind (X509 vs. OpenPGP)
Change-Id: I423bef41f93af9d1b78ee9795be7ec33c3c7ae0c
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/security/CertificateKind.idl33
-rw-r--r--offapi/com/sun/star/security/XCertificate.idl8
-rw-r--r--xmlsecurity/source/gpg/CertificateImpl.cxx5
-rw-r--r--xmlsecurity/source/gpg/CertificateImpl.hxx2
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx5
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx3
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx5
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx2
9 files changed, 63 insertions, 1 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 0e0a6cad8962..f0e03f2808e1 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -3316,6 +3316,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/security,\
CertificateCharacters \
CertificateContainerStatus \
CertificateException \
+ CertificateKind \
CertificateValidity \
CryptographyException \
DocumentSignatureInformation \
diff --git a/offapi/com/sun/star/security/CertificateKind.idl b/offapi/com/sun/star/security/CertificateKind.idl
new file mode 100644
index 000000000000..b1ae35e87ded
--- /dev/null
+++ b/offapi/com/sun/star/security/CertificateKind.idl
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_security_CertificateKind_idl_
+#define __com_sun_star_security_CertificateKind_idl_
+
+module com { module sun { module star { module security {
+
+/**
+ * Enum definition of a certificate kind ( X509, OpenPGP )
+ */
+enum CertificateKind
+{
+ /** X.509 format of a certificate
+ */
+ X509,
+
+ /** OpenPGP format of a certificate
+ */
+ OPENPGP
+};
+
+} ; } ; } ; } ;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/security/XCertificate.idl b/offapi/com/sun/star/security/XCertificate.idl
index 22f7c6a4a1be..6feaa409ccf2 100644
--- a/offapi/com/sun/star/security/XCertificate.idl
+++ b/offapi/com/sun/star/security/XCertificate.idl
@@ -23,13 +23,14 @@
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/util/DateTime.idl>
#include <com/sun/star/security/XCertificateExtension.idl>
+#include <com/sun/star/security/CertificateKind.idl>
module com { module sun { module star { module security {
/**
* Interface of a PKI Certificate
*
- * <p>This interface represents a x509 certificate.</p>
+ * <p>This interface represents a certificate (X.509 or OpenPGP) .</p>
*/
interface XCertificate : com::sun::star::uno::XInterface
{
@@ -109,6 +110,11 @@ interface XCertificate : com::sun::star::uno::XInterface
[attribute, readonly] sequence< byte > MD5Thumbprint;
/**
+ * the kind of certificate, X.509 or OpenPGP
+ */
+ [attribute, readonly] com::sun::star::security::CertificateKind CertificateKind;
+
+ /**
* Find a extension with a object identifier.
*/
XCertificateExtension findCertificateExtension( [in]sequence< byte > oid ) ;
diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx
index a00b0336fee1..9dd988d05d9f 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.cxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.cxx
@@ -162,6 +162,11 @@ Sequence< sal_Int8 > SAL_CALL CertificateImpl::getMD5Thumbprint()
return Sequence< sal_Int8 > ();
}
+CertificateKind SAL_CALL CertificateImpl::getCertificateKind()
+{
+ return CertificateKind_OPENPGP;
+}
+
sal_Int32 SAL_CALL CertificateImpl::getCertificateUsage()
{
return KeyUsage::DIGITAL_SIGNATURE | KeyUsage::NON_REPUDIATION | KeyUsage::KEY_ENCIPHERMENT | KeyUsage::DATA_ENCIPHERMENT;
diff --git a/xmlsecurity/source/gpg/CertificateImpl.hxx b/xmlsecurity/source/gpg/CertificateImpl.hxx
index cf9ab06c181f..b750993639a7 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.hxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/SecurityException.hpp>
+#include <com/sun/star/security/CertificateKind.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <key.h>
@@ -77,6 +78,7 @@ public:
/// @see xmlsecurity::Certificate::getSHA256Thumbprint().
virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
+ virtual css::security::CertificateKind getCertificateKind() override;
// Helper methods
void setCertificate(GpgME::Key key);
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 8ae78b105403..35b3835a2afe 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -594,6 +594,11 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getMD5Thumb
return getThumbprint(m_pCertContext, CERT_MD5_HASH_PROP_ID);
}
+CertificateKind SAL_CALL X509Certificate_MSCryptImpl::getCertificateKind()
+{
+ return CertificateKind_X509;
+}
+
sal_Int32 SAL_CALL X509Certificate_MSCryptImpl::getCertificateUsage( )
{
sal_Int32 usage =
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
index f7ba8a21a3fc..ce63a8acc170 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/SecurityException.hpp>
+#include <com/sun/star/security/CertificateKind.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <certificate.hxx>
@@ -67,6 +68,8 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper<
virtual OUString SAL_CALL getSignatureAlgorithm() override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() override;
+ virtual css::security::CertificateKind SAL_CALL getCertificateKind() override;
+
virtual sal_Int32 SAL_CALL getCertificateUsage( ) override;
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index cc93f1be46b7..079be582e02b 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -455,6 +455,11 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getMD5Thumbprin
return getThumbprint(m_pCert, SEC_OID_MD5);
}
+CertificateKind SAL_CALL X509Certificate_NssImpl::getCertificateKind()
+{
+ return CertificateKind_X509;
+}
+
sal_Int32 SAL_CALL X509Certificate_NssImpl::getCertificateUsage( )
{
SECStatus rv;
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
index 08e9cf1185e7..58759673935b 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/SecurityException.hpp>
+#include <com/sun/star/security/CertificateKind.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <certificate.hxx>
@@ -72,6 +73,7 @@ class X509Certificate_NssImpl : public ::cppu::WeakImplHelper<
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() override ;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() override ;
+ virtual css::security::CertificateKind SAL_CALL getCertificateKind() override;
virtual sal_Int32 SAL_CALL getCertificateUsage( ) override ;