diff options
author | Gökçen Eraslan <gokcen.eraslan@gmail.com> | 2012-07-09 10:16:17 +0300 |
---|---|---|
committer | Gökçen Eraslan <gokcen.eraslan@gmail.com> | 2012-07-09 10:16:17 +0300 |
commit | 9c8dc01d3a40ec905c9d816c733ceb5d621e0426 (patch) | |
tree | ed4182827ad2645a621fcde32887f6d0c5248740 /xmlsecurity | |
parent | f8f2296a510612381fc86273d0380133d5929bf0 (diff) | |
parent | 9ba7fda79cd36a20732fee663f52bdb4946cb2cf (diff) |
Merge branch 'feature/pdf-signing'
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/component/documentdigitalsignatures.cxx | 23 | ||||
-rw-r--r-- | xmlsecurity/source/component/documentdigitalsignatures.hxx | 1 |
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 03bf1b926d75..141bc911ca1d 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.hxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.hxx @@ -85,6 +85,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( |