summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2013-07-25 18:00:18 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2013-09-02 13:51:54 +0200
commitf6c006397896ae8b431a0ab85c89ab677d6ab981 (patch)
tree3fa7d513f3f3b6f856a536cb50dac3b5672615a8 /ucb
parent9391e6b85e6b571c63d91ff0bf8e0472f48f7522 (diff)
Store the decision about the certificate in a container to remember it
Change-Id: I19da6c1aeb7fada97166d37c68fa5ba242bbcaba
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/cmis/certvalidation_handler.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/ucb/source/ucp/cmis/certvalidation_handler.cxx b/ucb/source/ucp/cmis/certvalidation_handler.cxx
index 7ac8cda76dc9..f13c75bc6924 100644
--- a/ucb/source/ucp/cmis/certvalidation_handler.cxx
+++ b/ucb/source/ucp/cmis/certvalidation_handler.cxx
@@ -10,7 +10,9 @@
*
*/
+#include <com/sun/star/security/CertificateContainer.hpp>
#include <com/sun/star/security/XCertificate.hpp>
+#include <com/sun/star/security/XCertificateContainer.hpp>
#include <com/sun/star/security/CertificateValidity.hpp>
#include <com/sun/star/xml/crypto/SEInitializer.hpp>
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
@@ -59,6 +61,26 @@ namespace cmis
xSecurityEnv->createCertificateFromAscii(
sCleanCert ) );
+ uno::Reference< security::XCertificateContainer > xCertificateContainer;
+ try
+ {
+ xCertificateContainer = security::CertificateContainer::create( m_xContext );
+ }
+ catch ( uno::Exception const & )
+ {
+ }
+
+ if ( xCertificateContainer.is( ) )
+ {
+ security::CertificateContainerStatus status(
+ xCertificateContainer->hasCertificate(
+ m_sHostname, xCert->getSubjectName() ) );
+
+ if ( status != security::CertificateContainerStatus_NOCERT )
+ return status == security::CertificateContainerStatus_TRUSTED;
+ }
+
+ // If we had no certificate, ask what to do
std::vector< uno::Reference< security::XCertificate > > vecCerts;
for ( ++pIt; pIt != aCertificates.end(); ++pIt )
@@ -90,6 +112,10 @@ namespace cmis
uno::Reference< task::XInteractionApprove > xApprove(
xSelection.get(), uno::UNO_QUERY );
bValidate = xApprove.is();
+
+ // Store the decision in the container
+ xCertificateContainer->addCertificate(
+ m_sHostname, xCert->getSubjectName(), bValidate );
}
}
}