gpg4libre: [API-CHANGE] add certificate kind (X509 vs. OpenPGP)
Change-Id: I423bef41f93af9d1b78ee9795be7ec33c3c7ae0c
This commit is contained in:
parent
d6f8b03487
commit
bb06a106aa
@ -3318,6 +3318,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/security,\
|
|||||||
CertificateCharacters \
|
CertificateCharacters \
|
||||||
CertificateContainerStatus \
|
CertificateContainerStatus \
|
||||||
CertificateException \
|
CertificateException \
|
||||||
|
CertificateKind \
|
||||||
CertificateValidity \
|
CertificateValidity \
|
||||||
CryptographyException \
|
CryptographyException \
|
||||||
DocumentSignatureInformation \
|
DocumentSignatureInformation \
|
||||||
|
33
offapi/com/sun/star/security/CertificateKind.idl
Normal file
33
offapi/com/sun/star/security/CertificateKind.idl
Normal file
@ -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: */
|
@ -23,13 +23,14 @@
|
|||||||
#include <com/sun/star/uno/XInterface.idl>
|
#include <com/sun/star/uno/XInterface.idl>
|
||||||
#include <com/sun/star/util/DateTime.idl>
|
#include <com/sun/star/util/DateTime.idl>
|
||||||
#include <com/sun/star/security/XCertificateExtension.idl>
|
#include <com/sun/star/security/XCertificateExtension.idl>
|
||||||
|
#include <com/sun/star/security/CertificateKind.idl>
|
||||||
|
|
||||||
module com { module sun { module star { module security {
|
module com { module sun { module star { module security {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface of a PKI Certificate
|
* 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
|
interface XCertificate : com::sun::star::uno::XInterface
|
||||||
{
|
{
|
||||||
@ -108,6 +109,11 @@ interface XCertificate : com::sun::star::uno::XInterface
|
|||||||
*/
|
*/
|
||||||
[attribute, readonly] sequence< byte > MD5Thumbprint;
|
[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.
|
* Find a extension with a object identifier.
|
||||||
*/
|
*/
|
||||||
|
@ -162,6 +162,11 @@ Sequence< sal_Int8 > SAL_CALL CertificateImpl::getMD5Thumbprint()
|
|||||||
return Sequence< sal_Int8 > ();
|
return Sequence< sal_Int8 > ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CertificateKind SAL_CALL CertificateImpl::getCertificateKind()
|
||||||
|
{
|
||||||
|
return CertificateKind_OPENPGP;
|
||||||
|
}
|
||||||
|
|
||||||
sal_Int32 SAL_CALL CertificateImpl::getCertificateUsage()
|
sal_Int32 SAL_CALL CertificateImpl::getCertificateUsage()
|
||||||
{
|
{
|
||||||
return KeyUsage::DIGITAL_SIGNATURE | KeyUsage::NON_REPUDIATION | KeyUsage::KEY_ENCIPHERMENT | KeyUsage::DATA_ENCIPHERMENT;
|
return KeyUsage::DIGITAL_SIGNATURE | KeyUsage::NON_REPUDIATION | KeyUsage::KEY_ENCIPHERMENT | KeyUsage::DATA_ENCIPHERMENT;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <com/sun/star/uno/Sequence.hxx>
|
#include <com/sun/star/uno/Sequence.hxx>
|
||||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||||
#include <com/sun/star/uno/SecurityException.hpp>
|
#include <com/sun/star/uno/SecurityException.hpp>
|
||||||
|
#include <com/sun/star/security/CertificateKind.hpp>
|
||||||
#include <com/sun/star/security/XCertificate.hpp>
|
#include <com/sun/star/security/XCertificate.hpp>
|
||||||
|
|
||||||
#include <key.h>
|
#include <key.h>
|
||||||
@ -77,6 +78,7 @@ public:
|
|||||||
|
|
||||||
/// @see xmlsecurity::Certificate::getSHA256Thumbprint().
|
/// @see xmlsecurity::Certificate::getSHA256Thumbprint().
|
||||||
virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
|
virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
|
||||||
|
virtual css::security::CertificateKind getCertificateKind() override;
|
||||||
|
|
||||||
// Helper methods
|
// Helper methods
|
||||||
void setCertificate(const GpgME::Key& key);
|
void setCertificate(const GpgME::Key& key);
|
||||||
|
@ -594,6 +594,11 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getMD5Thumb
|
|||||||
return getThumbprint(m_pCertContext, CERT_MD5_HASH_PROP_ID);
|
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 SAL_CALL X509Certificate_MSCryptImpl::getCertificateUsage( )
|
||||||
{
|
{
|
||||||
sal_Int32 usage =
|
sal_Int32 usage =
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <com/sun/star/uno/Exception.hpp>
|
#include <com/sun/star/uno/Exception.hpp>
|
||||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||||
#include <com/sun/star/uno/SecurityException.hpp>
|
#include <com/sun/star/uno/SecurityException.hpp>
|
||||||
|
#include <com/sun/star/security/CertificateKind.hpp>
|
||||||
#include <com/sun/star/security/XCertificate.hpp>
|
#include <com/sun/star/security/XCertificate.hpp>
|
||||||
#include <certificate.hxx>
|
#include <certificate.hxx>
|
||||||
|
|
||||||
@ -67,6 +68,8 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper<
|
|||||||
virtual OUString SAL_CALL getSignatureAlgorithm() override;
|
virtual OUString SAL_CALL getSignatureAlgorithm() override;
|
||||||
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() override;
|
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() override;
|
||||||
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() 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;
|
virtual sal_Int32 SAL_CALL getCertificateUsage( ) override;
|
||||||
|
|
||||||
|
@ -455,6 +455,11 @@ css::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getMD5Thumbprin
|
|||||||
return getThumbprint(m_pCert, SEC_OID_MD5);
|
return getThumbprint(m_pCert, SEC_OID_MD5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CertificateKind SAL_CALL X509Certificate_NssImpl::getCertificateKind()
|
||||||
|
{
|
||||||
|
return CertificateKind_X509;
|
||||||
|
}
|
||||||
|
|
||||||
sal_Int32 SAL_CALL X509Certificate_NssImpl::getCertificateUsage( )
|
sal_Int32 SAL_CALL X509Certificate_NssImpl::getCertificateUsage( )
|
||||||
{
|
{
|
||||||
SECStatus rv;
|
SECStatus rv;
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <com/sun/star/uno/Exception.hpp>
|
#include <com/sun/star/uno/Exception.hpp>
|
||||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||||
#include <com/sun/star/uno/SecurityException.hpp>
|
#include <com/sun/star/uno/SecurityException.hpp>
|
||||||
|
#include <com/sun/star/security/CertificateKind.hpp>
|
||||||
#include <com/sun/star/security/XCertificate.hpp>
|
#include <com/sun/star/security/XCertificate.hpp>
|
||||||
|
|
||||||
#include <certificate.hxx>
|
#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 getSHA1Thumbprint() override ;
|
||||||
|
|
||||||
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() 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 ;
|
virtual sal_Int32 SAL_CALL getCertificateUsage( ) override ;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user