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:⭐:security::XDocumentDigitalSignatures is
extended.
Change-Id: I09f7d0ee180b16b588798820206780df359d133e
This commit is contained in:
parent
64f614d93e
commit
786f730ea2
3 changed files with 27 additions and 1 deletions
|
@ -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();
|
||||
|
||||
} ;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue