2017-02-02 17:33:30 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
2017-03-15 12:31:22 +01:00
|
|
|
#include "gpg/SEInitializer.hxx"
|
2017-02-02 17:33:30 +01:00
|
|
|
#include "SecurityEnvironment.hxx"
|
2017-03-15 12:31:22 +01:00
|
|
|
#include "XMLSecurityContext.hxx"
|
2017-02-02 17:33:30 +01:00
|
|
|
|
2017-06-21 16:54:52 +02:00
|
|
|
#include <gpgme.h>
|
|
|
|
#include <context.h>
|
2017-02-02 17:33:30 +01:00
|
|
|
|
|
|
|
using namespace css;
|
|
|
|
using namespace css::lang;
|
|
|
|
using namespace css::uno;
|
|
|
|
using namespace css::xml::crypto;
|
|
|
|
|
|
|
|
|
2017-06-21 18:00:55 +02:00
|
|
|
SEInitializerGpg::SEInitializerGpg()
|
2017-02-02 17:33:30 +01:00
|
|
|
{
|
2017-06-21 16:54:52 +02:00
|
|
|
// Also init GpgME while we're at it
|
|
|
|
GpgME::initializeLibrary();
|
2017-02-02 17:33:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SEInitializerGpg::~SEInitializerGpg()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/* XSEInitializer */
|
|
|
|
Reference< XXMLSecurityContext > SAL_CALL SEInitializerGpg::createSecurityContext( const OUString& )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
/* Build XML Security Context */
|
2017-03-15 12:31:22 +01:00
|
|
|
Reference< XXMLSecurityContext > xSecCtx(new XMLSecurityContextGpg());
|
2017-02-02 17:33:30 +01:00
|
|
|
|
2017-03-15 12:31:22 +01:00
|
|
|
Reference< XSecurityEnvironment > xSecEnv(new SecurityEnvironmentGpg());
|
2017-02-02 17:33:30 +01:00
|
|
|
sal_Int32 n = xSecCtx->addSecurityEnvironment(xSecEnv);
|
|
|
|
//originally the SecurityEnvironment with the internal slot was set as default
|
|
|
|
xSecCtx->setDefaultSecurityEnvironmentIndex( n );
|
|
|
|
return xSecCtx;
|
|
|
|
}
|
|
|
|
catch( const uno::Exception& )
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SEInitializerGpg::freeSecurityContext( const uno::Reference< XXMLSecurityContext >& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|