Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "documentdigitalsignatures.hxx"
21 : #include <xmlsecurity/digitalsignaturesdialog.hxx>
22 : #include <xmlsecurity/certificatechooser.hxx>
23 : #include <xmlsecurity/certificateviewer.hxx>
24 : #include <xmlsecurity/macrosecurity.hxx>
25 : #include <xmlsecurity/biginteger.hxx>
26 : #include <xmlsecurity/global.hrc>
27 :
28 : #include <sax/tools/converter.hxx>
29 :
30 : #include <../dialogs/resourcemanager.hxx>
31 : #include <com/sun/star/embed/XStorage.hpp>
32 : #include <com/sun/star/embed/XTransactedObject.hpp>
33 : #include <com/sun/star/embed/ElementModes.hpp>
34 : #include <com/sun/star/ucb/XContent.hpp>
35 : #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
36 : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
37 : #include <com/sun/star/ucb/XCommandProcessor.hpp>
38 : #include <com/sun/star/ucb/Command.hpp>
39 : #include <vcl/layout.hxx>
40 : #include <unotools/securityoptions.hxx>
41 : #include <com/sun/star/security/CertificateValidity.hpp>
42 : #include <com/sun/star/security/SerialNumberAdapter.hpp>
43 : #include <comphelper/documentconstants.hxx>
44 :
45 : #include <com/sun/star/lang/IllegalArgumentException.hpp>
46 :
47 : #include <stdio.h>
48 :
49 :
50 : using namespace css;
51 : using namespace css::uno;
52 :
53 216 : DocumentDigitalSignatures::DocumentDigitalSignatures( const Reference< XComponentContext >& rxCtx ):
54 : mxCtx(rxCtx),
55 : m_sODFVersion(ODFVER_012_TEXT),
56 : m_nArgumentsCount(0),
57 216 : m_bHasDocumentSignature(false)
58 : {
59 216 : }
60 :
61 216 : void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments)
62 : throw (css::uno::Exception, css::uno::RuntimeException, std::exception)
63 : {
64 216 : if (aArguments.getLength() > 2)
65 : throw css::lang::IllegalArgumentException(
66 : "DocumentDigitalSignatures::initialize requires zero, one, or two arguments",
67 0 : static_cast<XInitialization*>(this), 0);
68 :
69 216 : m_nArgumentsCount = aArguments.getLength();
70 :
71 216 : if (aArguments.getLength() > 0)
72 : {
73 214 : if (!(aArguments[0] >>= m_sODFVersion))
74 : throw css::lang::IllegalArgumentException(
75 : "DocumentDigitalSignatures::initialize: the first arguments must be a string",
76 0 : static_cast<XInitialization*>(this), 0);
77 :
78 428 : if (aArguments.getLength() == 2
79 214 : && !(aArguments[1] >>= m_bHasDocumentSignature))
80 : throw css::lang::IllegalArgumentException(
81 : "DocumentDigitalSignatures::initialize: the second arguments must be a bool",
82 0 : static_cast<XInitialization*>(this), 1);
83 :
84 : //the Version is supported as of ODF1.2, so for and 1.1 document or older we will receive the
85 : //an empty string. In this case we set it to ODFVER_010_TEXT. Then we can later check easily
86 : //if initialize was called. Only then m_sODFVersion.getLength() is greater than 0
87 214 : if (m_sODFVersion.isEmpty())
88 14 : m_sODFVersion = ODFVER_010_TEXT;
89 : }
90 216 : }
91 :
92 0 : sal_Bool DocumentDigitalSignatures::signDocumentContent(
93 : const Reference< css::embed::XStorage >& rxStorage,
94 : const Reference< css::io::XStream >& xSignStream)
95 : throw (RuntimeException, std::exception)
96 : {
97 : OSL_ENSURE(!m_sODFVersion.isEmpty(), "DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
98 0 : return ImplViewSignatures( rxStorage, xSignStream, SignatureModeDocumentContent, false );
99 : }
100 :
101 : Sequence< css::security::DocumentSignatureInformation >
102 214 : DocumentDigitalSignatures::verifyDocumentContentSignatures(
103 : const Reference< css::embed::XStorage >& rxStorage,
104 : const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException, std::exception)
105 : {
106 : OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
107 214 : return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModeDocumentContent );
108 : }
109 :
110 0 : void DocumentDigitalSignatures::showDocumentContentSignatures(
111 : const Reference< css::embed::XStorage >& rxStorage,
112 : const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException, std::exception)
113 : {
114 : OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
115 0 : ImplViewSignatures( rxStorage, xSignInStream, SignatureModeDocumentContent, true );
116 0 : }
117 :
118 0 : OUString DocumentDigitalSignatures::getDocumentContentSignatureDefaultStreamName()
119 : throw (css::uno::RuntimeException, std::exception)
120 : {
121 0 : return DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName();
122 : }
123 :
124 0 : sal_Bool DocumentDigitalSignatures::signScriptingContent(
125 : const Reference< css::embed::XStorage >& rxStorage,
126 : const Reference< css::io::XStream >& xSignStream ) throw (RuntimeException, std::exception)
127 : {
128 : OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
129 : OSL_ENSURE(m_nArgumentsCount == 2, "DocumentDigitalSignatures: Service was not initialized properly");
130 0 : return ImplViewSignatures( rxStorage, xSignStream, SignatureModeMacros, false );
131 : }
132 :
133 : Sequence< css::security::DocumentSignatureInformation >
134 0 : DocumentDigitalSignatures::verifyScriptingContentSignatures(
135 : const Reference< css::embed::XStorage >& rxStorage,
136 : const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException, std::exception)
137 : {
138 : OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
139 0 : return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModeMacros );
140 : }
141 :
142 0 : void DocumentDigitalSignatures::showScriptingContentSignatures(
143 : const Reference< css::embed::XStorage >& rxStorage,
144 : const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException, std::exception)
145 : {
146 : OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
147 0 : ImplViewSignatures( rxStorage, xSignInStream, SignatureModeMacros, true );
148 0 : }
149 :
150 0 : OUString DocumentDigitalSignatures::getScriptingContentSignatureDefaultStreamName()
151 : throw (css::uno::RuntimeException, std::exception)
152 : {
153 0 : return DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName();
154 : }
155 :
156 :
157 0 : sal_Bool DocumentDigitalSignatures::signPackage(
158 : const Reference< css::embed::XStorage >& rxStorage,
159 : const Reference< css::io::XStream >& xSignStream ) throw (RuntimeException, std::exception)
160 : {
161 : OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
162 0 : return ImplViewSignatures( rxStorage, xSignStream, SignatureModePackage, false );
163 : }
164 :
165 : Sequence< css::security::DocumentSignatureInformation >
166 0 : DocumentDigitalSignatures::verifyPackageSignatures(
167 : const Reference< css::embed::XStorage >& rxStorage,
168 : const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException, std::exception)
169 : {
170 : OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
171 0 : return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModePackage );
172 : }
173 :
174 0 : void DocumentDigitalSignatures::showPackageSignatures(
175 : const Reference< css::embed::XStorage >& rxStorage,
176 : const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException, std::exception)
177 : {
178 : OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
179 0 : ImplViewSignatures( rxStorage, xSignInStream, SignatureModePackage, true );
180 0 : }
181 :
182 0 : OUString DocumentDigitalSignatures::getPackageSignatureDefaultStreamName( )
183 : throw (::com::sun::star::uno::RuntimeException, std::exception)
184 : {
185 0 : return DocumentSignatureHelper::GetPackageSignatureDefaultStreamName();
186 : }
187 :
188 :
189 0 : bool DocumentDigitalSignatures::ImplViewSignatures(
190 : const Reference< css::embed::XStorage >& rxStorage,
191 : const Reference< css::io::XInputStream >& xSignStream,
192 : DocumentSignatureMode eMode, bool bReadOnly ) throw (RuntimeException, std::exception)
193 : {
194 0 : Reference< io::XStream > xStream;
195 0 : if ( xSignStream.is() )
196 0 : xStream = Reference< io::XStream >( xSignStream, UNO_QUERY );
197 0 : return ImplViewSignatures( rxStorage, xStream, eMode, bReadOnly );
198 : }
199 :
200 0 : bool DocumentDigitalSignatures::ImplViewSignatures(
201 : const Reference< css::embed::XStorage >& rxStorage, const Reference< css::io::XStream >& xSignStream,
202 : DocumentSignatureMode eMode, bool bReadOnly ) throw (RuntimeException, std::exception)
203 : {
204 0 : bool bChanges = false;
205 : DigitalSignaturesDialog aSignaturesDialog(
206 0 : NULL, mxCtx, eMode, bReadOnly, m_sODFVersion, m_bHasDocumentSignature);
207 0 : bool bInit = aSignaturesDialog.Init();
208 : DBG_ASSERT( bInit, "Error initializing security context!" );
209 0 : if ( bInit )
210 : {
211 0 : aSignaturesDialog.SetStorage( rxStorage );
212 0 : aSignaturesDialog.SetSignatureStream( xSignStream );
213 0 : if ( aSignaturesDialog.Execute() )
214 : {
215 0 : if ( aSignaturesDialog.SignaturesChanged() )
216 : {
217 0 : bChanges = true;
218 : // If we have a storage and no stream, we are responsible for commit
219 0 : if ( rxStorage.is() && !xSignStream.is() )
220 : {
221 0 : uno::Reference< embed::XTransactedObject > xTrans( rxStorage, uno::UNO_QUERY );
222 0 : xTrans->commit();
223 : }
224 : }
225 : }
226 : }
227 : else
228 : {
229 0 : MessageDialog aBox(NULL, XMLSEC_RES(RID_XMLSECWB_NO_MOZILLA_PROFILE), VCL_MESSAGE_WARNING);
230 0 : aBox.Execute();
231 : }
232 :
233 0 : return bChanges;
234 : }
235 :
236 : Sequence< css::security::DocumentSignatureInformation >
237 214 : DocumentDigitalSignatures::ImplVerifySignatures(
238 : const Reference< css::embed::XStorage >& rxStorage,
239 : const Reference< css::io::XInputStream >& xSignStream, DocumentSignatureMode eMode ) throw (RuntimeException)
240 : {
241 214 : if (!rxStorage.is())
242 : {
243 : DBG_ASSERT(false, "Error, no XStorage provided");
244 0 : return Sequence<css::security::DocumentSignatureInformation>();
245 : }
246 : // First check for the InputStream, to avoid unnecessary initialization of the security environemnt...
247 214 : SignatureStreamHelper aStreamHelper;
248 428 : Reference< io::XInputStream > xInputStream = xSignStream;
249 :
250 214 : if ( !xInputStream.is() )
251 : {
252 214 : aStreamHelper = DocumentSignatureHelper::OpenSignatureStream( rxStorage, embed::ElementModes::READ, eMode );
253 214 : if ( aStreamHelper.xSignatureStream.is() )
254 0 : xInputStream = Reference< io::XInputStream >( aStreamHelper.xSignatureStream, UNO_QUERY );
255 : }
256 :
257 214 : if ( !xInputStream.is() )
258 214 : return Sequence< ::com::sun::star::security::DocumentSignatureInformation >(0);
259 :
260 :
261 0 : XMLSignatureHelper aSignatureHelper( mxCtx );
262 :
263 0 : bool bInit = aSignatureHelper.Init();
264 :
265 : DBG_ASSERT( bInit, "Error initializing security context!" );
266 :
267 0 : if ( !bInit )
268 0 : return Sequence< ::com::sun::star::security::DocumentSignatureInformation >(0);
269 :
270 0 : aSignatureHelper.SetStorage(rxStorage, m_sODFVersion);
271 :
272 0 : aSignatureHelper.StartMission();
273 :
274 0 : aSignatureHelper.ReadAndVerifySignature( xInputStream );
275 :
276 0 : aSignatureHelper.EndMission();
277 :
278 0 : Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > xSecEnv = aSignatureHelper.GetSecurityEnvironment();
279 :
280 0 : SignatureInformations aSignInfos = aSignatureHelper.GetSignatureInformations();
281 0 : int nInfos = aSignInfos.size();
282 0 : Sequence< css::security::DocumentSignatureInformation > aInfos(nInfos);
283 0 : css::security::DocumentSignatureInformation* arInfos = aInfos.getArray();
284 :
285 0 : if ( nInfos )
286 : {
287 : Reference<security::XSerialNumberAdapter> xSerialNumberAdapter =
288 0 : ::com::sun::star::security::SerialNumberAdapter::create(mxCtx);
289 :
290 0 : for( int n = 0; n < nInfos; ++n )
291 : {
292 : DocumentSignatureAlgorithm mode = DocumentSignatureHelper::getDocumentAlgorithm(
293 0 : m_sODFVersion, aSignInfos[n]);
294 : const std::vector< OUString > aElementsToBeVerified =
295 : DocumentSignatureHelper::CreateElementList(
296 0 : rxStorage, eMode, mode);
297 :
298 0 : const SignatureInformation& rInfo = aSignInfos[n];
299 0 : css::security::DocumentSignatureInformation& rSigInfo = arInfos[n];
300 :
301 0 : if (!rInfo.ouX509Certificate.isEmpty())
302 0 : rSigInfo.Signer = xSecEnv->createCertificateFromAscii( rInfo.ouX509Certificate ) ;
303 0 : if (!rSigInfo.Signer.is())
304 0 : rSigInfo.Signer = xSecEnv->getCertificate( rInfo.ouX509IssuerName, xSerialNumberAdapter->toSequence( rInfo.ouX509SerialNumber ) );
305 :
306 : // Time support again (#i38744#)
307 0 : Date aDate( rInfo.stDateTime.Day, rInfo.stDateTime.Month, rInfo.stDateTime.Year );
308 : tools::Time aTime( rInfo.stDateTime.Hours, rInfo.stDateTime.Minutes,
309 0 : rInfo.stDateTime.Seconds, rInfo.stDateTime.NanoSeconds );
310 0 : rSigInfo.SignatureDate = aDate.GetDate();
311 0 : rSigInfo.SignatureTime = aTime.GetTime();
312 :
313 : // Verify certificate
314 : //We have patched our version of libxmlsec, so that it does not verify the certificates. This has two
315 : //reasons. First we want two separate status for signature and certificate. Second libxmlsec calls
316 : //CERT_VerifyCertificate (Solaris, Linux) falsely, so that it always regards the certificate as valid.
317 : //On Windows the checking of the certificate path is buggy. It does name matching (issuer, subject name)
318 : //to find the parent certificate. It does not take into account that there can be several certificates
319 : //with the same subject name.
320 0 : if (rSigInfo.Signer.is())
321 : {
322 : try {
323 0 : rSigInfo.CertificateStatus = xSecEnv->verifyCertificate(rSigInfo.Signer,
324 0 : Sequence<Reference<css::security::XCertificate> >());
325 0 : } catch (SecurityException& ) {
326 : OSL_FAIL("Verification of certificate failed");
327 0 : rSigInfo.CertificateStatus = css::security::CertificateValidity::INVALID;
328 : }
329 : }
330 : else
331 : {
332 : //We should always be able to get the certificates because it is contained in the document,
333 : //unless the document is damaged so that signature xml file could not be parsed.
334 0 : rSigInfo.CertificateStatus = css::security::CertificateValidity::INVALID;
335 : }
336 :
337 0 : rSigInfo.SignatureIsValid = ( rInfo.nStatus == ::com::sun::star::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED );
338 :
339 :
340 0 : if ( rSigInfo.SignatureIsValid )
341 : {
342 : rSigInfo.SignatureIsValid =
343 : DocumentSignatureHelper::checkIfAllFilesAreSigned(
344 0 : aElementsToBeVerified, rInfo, mode);
345 : }
346 0 : if (eMode == SignatureModeDocumentContent)
347 : rSigInfo.PartialDocumentSignature =
348 0 : ! DocumentSignatureHelper::isOOo3_2_Signature(aSignInfos[n]);
349 :
350 0 : }
351 : }
352 214 : return aInfos;
353 :
354 : }
355 :
356 0 : void DocumentDigitalSignatures::manageTrustedSources( ) throw (RuntimeException, std::exception)
357 : {
358 : // MT: i45295
359 : // SecEnv is only needed to display certificate information from trusted sources.
360 : // Macro Security also has some options where no security environment is needed, so raise dialog anyway.
361 : // Later I should change the code so the Dialog creates the SecEnv on demand...
362 :
363 0 : Reference< css::xml::crypto::XSecurityEnvironment > xSecEnv;
364 :
365 0 : XMLSignatureHelper aSignatureHelper( mxCtx );
366 0 : if ( aSignatureHelper.Init() )
367 0 : xSecEnv = aSignatureHelper.GetSecurityEnvironment();
368 :
369 0 : MacroSecurity aDlg( NULL, mxCtx, xSecEnv );
370 0 : aDlg.Execute();
371 0 : }
372 :
373 0 : void DocumentDigitalSignatures::showCertificate(
374 : const Reference< css::security::XCertificate >& _Certificate ) throw (RuntimeException, std::exception)
375 : {
376 0 : XMLSignatureHelper aSignatureHelper( mxCtx );
377 :
378 0 : bool bInit = aSignatureHelper.Init();
379 :
380 : DBG_ASSERT( bInit, "Error initializing security context!" );
381 :
382 0 : if ( bInit )
383 : {
384 0 : CertificateViewer aViewer( NULL, aSignatureHelper.GetSecurityEnvironment(), _Certificate, false );
385 0 : aViewer.Execute();
386 0 : }
387 :
388 0 : }
389 :
390 0 : sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
391 : const Reference< css::security::XCertificate >& Author ) throw (RuntimeException, std::exception)
392 : {
393 0 : bool bFound = false;
394 :
395 : Reference<security::XSerialNumberAdapter> xSerialNumberAdapter =
396 0 : ::com::sun::star::security::SerialNumberAdapter::create(mxCtx);
397 :
398 0 : OUString sSerialNum = xSerialNumberAdapter->toString( Author->getSerialNumber() );
399 :
400 0 : Sequence< SvtSecurityOptions::Certificate > aTrustedAuthors = SvtSecurityOptions().GetTrustedAuthors();
401 0 : const SvtSecurityOptions::Certificate* pAuthors = aTrustedAuthors.getConstArray();
402 0 : const SvtSecurityOptions::Certificate* pAuthorsEnd = pAuthors + aTrustedAuthors.getLength();
403 0 : for ( ; pAuthors != pAuthorsEnd; ++pAuthors )
404 : {
405 0 : SvtSecurityOptions::Certificate aAuthor = *pAuthors;
406 0 : if ( ( aAuthor[0] == Author->getIssuerName() ) && ( aAuthor[1] == sSerialNum ) )
407 : {
408 0 : bFound = true;
409 0 : break;
410 : }
411 0 : }
412 :
413 0 : return bFound;
414 : }
415 :
416 0 : Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertificate() throw (RuntimeException, std::exception)
417 : {
418 0 : Reference< css::xml::crypto::XSecurityEnvironment > xSecEnv;
419 :
420 0 : XMLSignatureHelper aSignatureHelper( mxCtx );
421 0 : if ( aSignatureHelper.Init() )
422 0 : xSecEnv = aSignatureHelper.GetSecurityEnvironment();
423 :
424 0 : CertificateChooser aChooser( NULL, mxCtx, xSecEnv, aSignatureHelper.GetSignatureInformations());
425 :
426 0 : if (aChooser.Execute() != RET_OK)
427 0 : return Reference< css::security::XCertificate >(0);
428 :
429 0 : Reference< css::security::XCertificate > xCert = aChooser.GetSelectedCertificate();
430 :
431 0 : if ( !xCert.is() )
432 0 : return Reference< css::security::XCertificate >(0);
433 :
434 0 : return xCert;
435 : }
436 :
437 :
438 0 : sal_Bool DocumentDigitalSignatures::isLocationTrusted( const OUString& Location ) throw (RuntimeException, std::exception)
439 : {
440 0 : return SvtSecurityOptions().isTrustedLocationUri(Location);
441 : }
442 :
443 0 : void DocumentDigitalSignatures::addAuthorToTrustedSources(
444 : const Reference< css::security::XCertificate >& Author ) throw (RuntimeException, std::exception)
445 : {
446 0 : SvtSecurityOptions aSecOpts;
447 :
448 : Reference<security::XSerialNumberAdapter> xSerialNumberAdapter =
449 0 : ::com::sun::star::security::SerialNumberAdapter::create(mxCtx);
450 :
451 0 : SvtSecurityOptions::Certificate aNewCert( 3 );
452 0 : aNewCert[ 0 ] = Author->getIssuerName();
453 0 : aNewCert[ 1 ] = xSerialNumberAdapter->toString( Author->getSerialNumber() );
454 :
455 0 : OUStringBuffer aStrBuffer;
456 0 : ::sax::Converter::encodeBase64(aStrBuffer, Author->getEncoded());
457 0 : aNewCert[ 2 ] = aStrBuffer.makeStringAndClear();
458 :
459 :
460 0 : Sequence< SvtSecurityOptions::Certificate > aTrustedAuthors = aSecOpts.GetTrustedAuthors();
461 0 : sal_Int32 nCnt = aTrustedAuthors.getLength();
462 0 : aTrustedAuthors.realloc( nCnt + 1 );
463 0 : aTrustedAuthors[ nCnt ] = aNewCert;
464 :
465 0 : aSecOpts.SetTrustedAuthors( aTrustedAuthors );
466 0 : }
467 :
468 0 : void DocumentDigitalSignatures::addLocationToTrustedSources( const OUString& Location ) throw (RuntimeException, std::exception)
469 : {
470 0 : SvtSecurityOptions aSecOpt;
471 :
472 0 : Sequence< OUString > aSecURLs = aSecOpt.GetSecureURLs();
473 0 : sal_Int32 nCnt = aSecURLs.getLength();
474 0 : aSecURLs.realloc( nCnt + 1 );
475 0 : aSecURLs[ nCnt ] = Location;
476 :
477 0 : aSecOpt.SetSecureURLs( aSecURLs );
478 0 : }
479 :
480 30 : OUString DocumentDigitalSignatures::GetImplementationName() throw (RuntimeException)
481 : {
482 30 : return OUString( "com.sun.star.security.DocumentDigitalSignatures" );
483 : }
484 :
485 28 : Sequence< OUString > DocumentDigitalSignatures::GetSupportedServiceNames() throw (css::uno::RuntimeException)
486 : {
487 28 : Sequence < OUString > aRet(1);
488 28 : OUString* pArray = aRet.getArray();
489 28 : pArray[0] = "com.sun.star.security.DocumentDigitalSignatures";
490 28 : return aRet;
491 : }
492 :
493 :
494 216 : Reference< XInterface > DocumentDigitalSignatures_CreateInstance(
495 : const Reference< XComponentContext >& rCtx) throw ( Exception )
496 : {
497 216 : return (cppu::OWeakObject*) new DocumentDigitalSignatures( rCtx );
498 162 : }
499 :
500 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|