summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorGökçen Eraslan <gokcen.eraslan@gmail.com>2012-07-07 19:08:48 +0300
committerGökçen Eraslan <gokcen.eraslan@gmail.com>2012-07-07 19:08:48 +0300
commit786f730ea2608abaafdc656e2181d11e076b6648 (patch)
treeed3b30ce0e9ce3ec123621bf413f63417c31661b /xmlsecurity
parent64f614d93e0ff2b719e8dd360c0ed684569439bc (diff)
Add new chooseCertificate method to XDocumentDigitalSignatures UNO interface.
This method shows the certificate choosing dialog previously used in ODF signing and returns the selected certificate. For PDF signing support, we need to reuse existing CertifacateChooser class of xmlsecurity module. So the UNO api of ::com::sun::star::security::XDocumentDigitalSignatures is extended. Change-Id: I09f7d0ee180b16b588798820206780df359d133e
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx23
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.hxx1
2 files changed, 24 insertions, 0 deletions
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 3282dfede4d3..f52c1a4411d0 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -28,6 +28,7 @@
#include <documentdigitalsignatures.hxx>
#include <xmlsecurity/digitalsignaturesdialog.hxx>
+#include <xmlsecurity/certificatechooser.hxx>
#include <xmlsecurity/certificateviewer.hxx>
#include <xmlsecurity/macrosecurity.hxx>
#include <xmlsecurity/biginteger.hxx>
@@ -424,6 +425,28 @@ void DocumentDigitalSignatures::showCertificate(
return bFound;
}
+Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertificate() throw (RuntimeException)
+{
+ Reference< dcss::xml::crypto::XSecurityEnvironment > xSecEnv;
+
+ XMLSignatureHelper aSignatureHelper( mxCtx );
+ if ( aSignatureHelper.Init() )
+ xSecEnv = aSignatureHelper.GetSecurityEnvironment();
+
+ CertificateChooser aChooser( NULL, mxCtx, xSecEnv, aSignatureHelper.GetSignatureInformations());
+
+ if (aChooser.Execute() != RET_OK)
+ return Reference< css::security::XCertificate >(0);
+
+ Reference< css::security::XCertificate > xCert = aChooser.GetSelectedCertificate();
+
+ if ( !xCert.is() )
+ return Reference< css::security::XCertificate >(0);
+
+ return xCert;
+}
+
+
::sal_Bool DocumentDigitalSignatures::isLocationTrusted( const ::rtl::OUString& Location ) throw (RuntimeException)
{
sal_Bool bFound = sal_False;
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.hxx b/xmlsecurity/source/component/documentdigitalsignatures.hxx
index 3525370d10b5..a16ee9a5c6b5 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.hxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.hxx
@@ -94,6 +94,7 @@ public:
void SAL_CALL addAuthorToTrustedSources( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& Author ) throw (::com::sun::star::uno::RuntimeException);
void SAL_CALL addLocationToTrustedSources( const ::rtl::OUString& Location ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > SAL_CALL chooseCertificate( ) throw (::com::sun::star::uno::RuntimeException);
};
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL DocumentDigitalSignatures_CreateInstance(