summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--offapi/com/sun/star/security/XDocumentDigitalSignatures.idl4
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx23
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.hxx1
3 files changed, 27 insertions, 1 deletions
diff --git a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
index be75dc1dee3d..8e9089e75495 100644
--- a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
+++ b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
@@ -143,7 +143,9 @@ interface XDocumentDigitalSignatures : com::sun::star::uno::XInterface
void addAuthorToTrustedSources( [in] com::sun::star::security::XCertificate Author );
void addLocationToTrustedSources( [in] string Location );
-
+ /** This method shows CertificateChooser dialog, used by document and PDF signing
+ */
+ com::sun::star::security::XCertificate chooseCertificate();
} ;
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(