'encoding UTF-8 Do not remove or change this line! '************************************************************** ' ' Licensed to the Apache Software Foundation (ASF) under one ' or more contributor license agreements. See the NOTICE file ' distributed with this work for additional information ' regarding copyright ownership. The ASF licenses this file ' to you under the Apache License, Version 2.0 (the ' "License"); you may not use this file except in compliance ' with the License. You may obtain a copy of the License at ' ' http://www.apache.org/licenses/LICENSE-2.0 ' ' Unless required by applicable law or agreed to in writing, ' software distributed under the License is distributed on an ' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ' KIND, either express or implied. See the License for the ' specific language governing permissions and limitations ' under the License. ' '************************************************************** '* '* short description : Tools to ease testing of security related funtionality '* '\****************************************************************************** function hSetPasswordRecommendation( bEnable as boolean ) as boolean '///

Toggle Tools/Options/OOo/Security: Password recommendation

'///Input: '///
    '///+
  1. Mode (boolean)
  2. '/// '///
'///Returns: '///
    '///+
  1. Prior state (boolean)
  2. '/// '///
'///Description: '/// end function '****************************************************************************** function hOpenDigitalSignaturesDialog() as boolean '///

Open the Digital Signatures Dialog via File-Menu

'///Input: '///
    '///+
  1. Nothing
  2. '///
'///Returns: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
'///Description: '/// end function '******************************************************************************* function hAllowMacroExecution() as boolean '///

Allow macro execution on Macro Security Warning dialog

'///Input: '///
    '///+
  1. Nothing
  2. '///
'///Returns: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
'///Description: '/// end function '******************************************************************************* function hDenyMacroExecution() as boolean '///

Deny macro execution on Macro Security Warning dialog

'///Input: '///
    '///+
  1. Nothing
  2. '///
'///Returns: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
'///Description: '/// end function '******************************************************************************* function hSwitchMacroSecurityTab( cTab as string ) '///

Switch between Security Level and Trusted Paths

'///Input: '///
    '///+
  1. The Tabpage to be activated (string). Valid options are:
  2. '/// '///
'///Returns: '///
    '///+
  1. Nothing
  2. '///
'///Description: '/// end function '******************************************************************************* function hAddTrustedPath( cPath as string ) as boolean '///

Add a directory to the list of trusted paths

'///Input: '///
    '///+
  1. Fully qualified path to the directory (string)
  2. '///
'///Return: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
const CFN = "hAddTrustedPath::" dim iPathCount as integer '///Description: '/// end function '******************************************************************************* function hRemoveTrustedPath( cPath as string ) as boolean '///

Remove a directory from the list of trusted paths

'///Input: '///
    '///+
  1. Fully qualified path to the directory (string)
  2. '///
'///Return: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
const CFN = "hRemoveTrustedPath()" dim iPathCount as integer dim iCurrentPathItem as integer hRemoveTrustedPath() = false '///Description: '/// end function '******************************************************************************* function hSecurityEnterPasswordOnSave( cPassword as string ) as boolean '///

Enter password when saving a document

'///This function enters a password into the password dialog if the " '///+ Save with password" checkbox is checked. It will automatically '///+ generate a faulty password to be entered on first try (to see whether '///+ the "Invalid password confirmation" dialog pops up, on second '///+ attempt the password is confirmed correctly and thus the document should '///+ save ok. The office should return to the document, the File Save dialog '///+ should close after save.

'///Parameter(s):
'///
    '///+
  1. Password to use (String)
  2. '/// '///
'///Returns:
'///
    '///+
  1. Errorcondition (Boolean)
  2. '/// '///
const CFN = "hSecurityEnterPasswordOnSave::" if ( GVERBOSE ) then printlog( CFN & "Enter" ) '///Description: '/// if ( GVERBOSE ) then printlog( CFN & "Exit" ) end function '******************************************************************************* function hSecurityEnterPasswordOnLoad( cPassword as string, bValid as boolean ) as boolean '///

Enter a password while loading a document

'///Enters a valid or invalid password while loading a passworded file

'///Parameter(s):
'///
    '///+
  1. Password (String)
  2. '/// '///+
  3. Password validity (Boolean)
  4. '/// '///
'///Returns:
'///
    '///+
  1. Errorcondition (Boolean)
  2. '/// '///
const CFN = "hSecurityEnterPasswordOnLoad::" if ( GVERBOSE ) then printlog( CFN & "Enter with option (Password): " & cPassword ) printlog( CFN & "Enter with option (Validity): " & bValid ) endif hSecurityEnterPasswordOnLoad() = true '///Description: '/// end function '******************************************************************************* function hSelectXMLSecTab( cTab as string ) as boolean const CFN = "hSelectXMLSecTab::" hSelectXMLSecTab() = false kontext select case ( ucase( cTab ) ) case "GENERAL" : active.setpage TabXMLSecGeneral if ( TabXMLSecGeneral.exists() and TabXMLSecGeneral.isVisible() ) then printlog( CFN & "Switched to General page" ) hSelectXMLSecTab() = true exit function endif case "DETAILS" : active.setpage TabXMLSecDetails if ( TabXMLSecDetails.exists() and TabXMLSecDetails.isVisible() ) then printlog( CFN & "Switched to Details page" ) hSelectXMLSecTab() = true exit function endif case "PATH" : active.setpage TabXMLSecCertPath if ( TabXMLSecCertPath.exists() and TabXMLSecCertPath.isVisible() ) then printlog( CFN & "Switched to Certification Path page" ) hSelectXMLSecTab() = true exit function endif end select warnlog( CFN & "Failed to switch XML Security Tabpage" ) end function