diff options
author | Noel Grandin <noel@peralex.com> | 2012-09-04 11:42:03 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-04 16:41:37 +0200 |
commit | 197a79e57131c976a489882479a679ba2ab61b82 (patch) | |
tree | a97c4d81a9a2549b9463ad9a06ba5ebf10cf02bc /xmlsecurity | |
parent | ba425a1788421b63caa84ac364341bac2f88f103 (diff) |
fdo#46808, Adapt DocumentDigitalSignatures UNO service to new style
Rename service from "Decryptor" to "DocumentDigitalSignatures" to be consistent
with the other UNO services, and with it's own header file name.
Add service constructor for passing in arguments.
Change-Id: Iaca0c40bb2f1a1af2ef9ca29361bfd023ade2678
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/workben/signaturetest.cxx | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/xmlsecurity/workben/signaturetest.cxx b/xmlsecurity/workben/signaturetest.cxx index 2fbce795bf65..e5e3ac52ff31 100644 --- a/xmlsecurity/workben/signaturetest.cxx +++ b/xmlsecurity/workben/signaturetest.cxx @@ -51,7 +51,7 @@ #include <xmlsecurity/certificatechooser.hxx> #include <xmlsecurity/biginteger.hxx> -#include <com/sun/star/security/XDocumentDigitalSignatures.hpp> +#include <com/sun/star/security/DocumentDigitalSignatures.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star; @@ -304,9 +304,8 @@ IMPL_LINK_NOARG(MyWin, DigitalSignaturesWithServiceHdl) aDocFileName, embed::ElementModes::READWRITE, comphelper::getProcessServiceFactory() ); uno::Reference< security::XDocumentDigitalSignatures > xD( - comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), uno::UNO_QUERY ); - if ( xD.is() ) - xD->signDocumentContent( xStore, NULL ); + security::DocumentDigitalSignatures::create(comphelper::getProcessComponentContext() ); + xD->signDocumentContent( xStore, NULL ); return 0; @@ -319,26 +318,21 @@ IMPL_LINK_NOARG(MyWin, VerifyDigitalSignaturesHdl) aDocFileName, embed::ElementModes::READWRITE, comphelper::getProcessServiceFactory() ); uno::Reference< security::XDocumentDigitalSignatures > xD( - comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), uno::UNO_QUERY ); - if ( xD.is() ) + security::DocumentDigitalSignatures::create(comphelper::getProcessComponentContext()) ); + uno::Sequence< security::DocumentSignatureInformation > aInfos = xD->verifyDocumentContentSignatures( xStore, NULL ); + int nInfos = aInfos.getLength(); + for ( int n = 0; n < nInfos; n++ ) { - uno::Sequence< security::DocumentSignatureInformation > aInfos = xD->verifyDocumentContentSignatures( xStore, NULL ); - int nInfos = aInfos.getLength(); - for ( int n = 0; n < nInfos; n++ ) - { - security::DocumentSignatureInformation& rInf = aInfos[n]; - String aText( RTL_CONSTASCII_USTRINGPARAM( "The document is signed by\n\n " ) ); - aText += String( rInf.Signer->getSubjectName() ); - aText += String( RTL_CONSTASCII_USTRINGPARAM( "\n\n The signature is " ) ); - if ( !rInf.SignatureIsValid ) - aText += String( RTL_CONSTASCII_USTRINGPARAM( "NOT " ) ); - aText += String( RTL_CONSTASCII_USTRINGPARAM( "valid" ) ); - InfoBox( this, aText ).Execute(); - } - + security::DocumentSignatureInformation& rInf = aInfos[n]; + String aText( RTL_CONSTASCII_USTRINGPARAM( "The document is signed by\n\n " ) ); + aText += String( rInf.Signer->getSubjectName() ); + aText += String( RTL_CONSTASCII_USTRINGPARAM( "\n\n The signature is " ) ); + if ( !rInf.SignatureIsValid ) + aText += String( RTL_CONSTASCII_USTRINGPARAM( "NOT " ) ); + aText += String( RTL_CONSTASCII_USTRINGPARAM( "valid" ) ); + InfoBox( this, aText ).Execute(); } - return 0; } |