Files
libreoffice/xmlsecurity/source/dialogs/certificateviewer.cxx

508 lines
19 KiB
C++
Raw Normal View History

/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
2004-07-12 12:15:31 +00:00
#include <xmlsecurity/certificateviewer.hxx>
#include <com/sun/star/security/XCertificate.hpp>
2004-07-22 14:37:38 +00:00
#include <com/sun/star/security/CertificateCharacters.hpp>
2004-07-26 06:30:29 +00:00
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
#include <com/sun/star/security/CertificateValidity.hpp>
2004-07-22 14:37:38 +00:00
2004-07-15 08:28:33 +00:00
#include <unotools/localedatawrapper.hxx>
#include <unotools/datetime.hxx>
#include "svtools/treelistentry.hxx"
2004-07-15 08:28:33 +00:00
2004-07-12 12:15:31 +00:00
#include "dialogs.hrc"
#include "resourcemanager.hxx"
/* HACK: disable some warnings for MS-C */
#ifdef _MSC_VER
#pragma warning (disable : 4355) // 4355: this used in initializer-list
#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
namespace
{
2004-07-14 10:38:07 +00:00
void ShrinkToFit( FixedImage& _rImg )
{
_rImg.SetSizePixel( _rImg.GetImage().GetSizePixel() );
}
}
2004-07-12 12:15:31 +00:00
CertificateViewer::CertificateViewer(
Window* _pParent,
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& _rxSecurityEnvironment,
const css::uno::Reference< css::security::XCertificate >& _rXCert, bool bCheckForPrivateKey )
2004-07-12 12:15:31 +00:00
:TabDialog ( _pParent, XMLSEC_RES( RID_XMLSECDLG_CERTVIEWER ) )
,maTabCtrl ( this, XMLSEC_RES( 1 ) )
,maOkBtn ( this, XMLSEC_RES( BTN_OK ) )
,maHelpBtn ( this, XMLSEC_RES( BTN_HELP ) )
2004-07-12 12:15:31 +00:00
{
FreeResource();
mbCheckForPrivateKey = bCheckForPrivateKey;
2004-07-12 12:15:31 +00:00
mxSecurityEnvironment = _rxSecurityEnvironment;
mxCert = _rXCert;
maTabCtrl.SetTabPage( RID_XMLSECTP_GENERAL, new CertificateViewerGeneralTP( &maTabCtrl, this ) );
maTabCtrl.SetTabPage( RID_XMLSECTP_DETAILS, new CertificateViewerDetailsTP( &maTabCtrl, this ) );
maTabCtrl.SetTabPage( RID_XMLSECTP_CERTPATH, new CertificateViewerCertPathTP( &maTabCtrl, this ) );
maTabCtrl.SetCurPageId( RID_XMLSECTP_GENERAL );
}
CertificateViewer::~CertificateViewer()
{
delete maTabCtrl.GetTabPage( RID_XMLSECTP_CERTPATH );
delete maTabCtrl.GetTabPage( RID_XMLSECTP_DETAILS );
delete maTabCtrl.GetTabPage( RID_XMLSECTP_GENERAL );
}
CertificateViewerTP::CertificateViewerTP( Window* _pParent, const ResId& _rResId, CertificateViewer* _pDlg )
:TabPage ( _pParent, _rResId )
,mpDlg ( _pDlg )
{
}
CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, CertificateViewer* _pDlg )
:CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_GENERAL ), _pDlg )
,maFrameWin ( this, XMLSEC_RES( WIN_FRAME ) )
,maCertImg ( this, XMLSEC_RES( IMG_CERT ) )
,maCertInfoFI ( this, XMLSEC_RES( FI_CERTINFO ) )
,maSep1FL ( this, XMLSEC_RES( FL_SEP1 ) )
,maHintNotTrustedFI ( this, XMLSEC_RES( FI_HINTNOTTRUST ) )
,maSep2FL ( this, XMLSEC_RES( FL_SEP2 ) )
,maIssuedToLabelFI ( this, XMLSEC_RES( FI_ISSTOLABEL ) )
,maIssuedToFI ( this, XMLSEC_RES( FI_ISSTO ) )
,maIssuedByLabelFI ( this, XMLSEC_RES( FI_ISSBYLABEL ) )
,maIssuedByFI ( this, XMLSEC_RES( FI_ISSBY ) )
,maValidDateFI ( this, XMLSEC_RES( FI_VALIDDATE ) )
,maKeyImg ( this, XMLSEC_RES( IMG_KEY ) )
,maHintCorrespPrivKeyFI ( this, XMLSEC_RES( FI_CORRPRIVKEY ) )
2004-07-12 12:15:31 +00:00
{
//Verify the certificate
CWS-TOOLING: integrate CWS jl127 2009-07-30 10:12:10 +0200 jl r274470 : #i100873# switch on checking for symbol definitions. It works with the current xpcom lib. 2009-07-29 09:48:29 +0200 jl r274443 : #i100873# 2009-07-29 09:47:36 +0200 jl r274442 : #i100873# changes after resync with DEV300m53 which contains the seamonkey update 2009-07-28 10:00:03 +0200 jl r274389 : #100873# Patches from tono 2009-07-27 16:59:39 +0200 jl r274372 : CWS-TOOLING: rebase CWS jl127 to trunk@274203 (milestone: DEV300:m53) 2009-07-07 09:08:53 +0200 jl r273768 : #100873# 2009-07-06 17:16:10 +0200 jl r273754 : #100873# 2009-07-01 13:58:09 +0200 jl r273576 : #100873# added to readme 2009-07-01 13:15:02 +0200 jl r273573 : #100873# deliver lib files when building with MS compiler 2009-06-30 11:22:06 +0200 jl r273498 : #i100873# accidentally commented out patch_files 2009-06-30 09:01:10 +0200 jl r273489 : #100873# make rc.exe work in ooo windows build 2009-06-29 09:47:56 +0200 jl r273451 : #i100873# applied mingw patch from tono 2009-06-24 12:52:14 +0200 jl r273332 : #100873# reapplying the configure.in patch on version 273150 2009-06-24 12:51:12 +0200 jl r273331 : #100873# reapplying the patch on version 273150 2009-06-23 17:17:36 +0200 jl r273299 : #100873# manually modified patch from tono 2009-06-22 17:05:41 +0200 jl r273243 : #100873# applying mingw patch from tono 2009-06-22 17:02:30 +0200 jl r273242 : #100873# applying mingw patch from tono 2009-06-22 12:49:57 +0200 jl r273216 : #100873# dependency to stlport 2009-06-19 11:56:16 +0200 jl r273155 : #100873# undoing a previous change, instset_native complained about missing libjpipe.jnilib (jurt) 2009-06-19 10:13:03 +0200 jl r273150 : #100873# ooo builds shall also use the new nss by default 2009-06-18 14:32:07 +0200 jl r273117 : #110873# more debug output when verifying a certificate 2009-06-16 11:23:50 +0200 jl r273012 : #i10873# 2009-06-16 10:57:41 +0200 jl r273011 : #100873# wrong parameter definition in nsscrypto_initialize 2009-06-16 10:56:45 +0200 jl r273010 : #100873# wrong parameter definition in nsscrypto_initialize 2009-06-15 16:20:42 +0200 jl r272996 : #100873# initialization of NSS is now threadsafe 2009-06-10 12:50:46 +0200 jl r272804 : #100873# rename in foreach fails in 4nt 2009-06-09 13:43:00 +0200 jl r272768 : #i100873# deliver only .h from inc/nss otherwise we get a warning when nss/nssck.api is delivered 2009-06-08 16:15:44 +0200 jl r272739 : #i100873# 2009-06-08 16:04:54 +0200 jl r272738 : #i100873# 2009-06-08 15:45:52 +0200 jl r272736 : #i100873# 2009-06-08 15:44:15 +0200 jl r272735 : #i100873# unzipping of nss.tar.z not working with 4nt 2009-06-08 09:45:46 +0200 jl r272720 : #i100873# 2009-06-03 13:53:52 +0200 jl r272562 : #i100873# MOZILLABUILD not correct 2009-06-03 13:17:54 +0200 jl r272557 : #i100873# readme and makefile changes from cws jl125, support of new nss module 2009-06-03 09:57:40 +0200 jl r272544 : #i100873# added readme 2009-06-02 16:47:47 +0200 jl r272512 : #i100873# removed no longer needed stuff regarding jnilibs 2009-06-02 15:54:42 +0200 jl r272510 : #i100873# added NSS to BUILD_TYPE 2009-06-02 15:20:18 +0200 jl r272508 : #i100873# DEREFERENCE option for copy command 2009-06-02 13:00:12 +0200 jl r272496 : #i100873# PATCH_FILE_NAMES is now PATCH_FILES 2009-06-02 12:23:39 +0200 jl r272494 : #i100873# build dependency to nss 2009-05-29 16:21:40 +0200 jl r272470 : #i100873# seting ENABLE_NSS_MODULE==YES and includeing mozilla-build-1.3 folder in environment 2009-05-29 16:03:23 +0200 jl r272468 : #i100873# use intermediate certificates when validating a certificate 2009-05-29 15:57:16 +0200 jl r272466 : #i100873# use intermediate certificates when validating a certificate 2009-05-29 15:49:58 +0200 jl r272464 : #i100873# using ENABLE_NSS_MODULE 2009-05-29 15:33:14 +0200 jl r272463 : #i100873# using ENABLE_NSS_MODULE 2009-05-29 15:28:39 +0200 jl r272461 : #i100873# build dependency to nss module 2009-05-29 15:24:57 +0200 jl r272460 : #i100873# pass additional certificates into verifyCertificate function 2009-05-29 14:49:40 +0200 jl r272458 : #i100873# new NSS module 2009-05-29 14:43:44 +0200 jl r272457 : #i100873# new NSS module
2009-08-26 08:22:01 +00:00
sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(mpDlg->mxCert,
Sequence<Reference<css::security::XCertificate> >());
bool bCertValid = certStatus == css::security::CertificateValidity::VALID ? true : false;
if ( !bCertValid )
{
maCertImg.SetImage(
2010-11-16 16:57:17 +00:00
Image( XMLSEC_RES( IMG_STATE_NOT_VALIDATED ) ) );
maHintNotTrustedFI.SetText( XMLSEC_RES( STR_CERTIFICATE_NOT_VALIDATED ) );
}
2004-07-12 12:15:31 +00:00
FreeResource();
2004-07-12 12:15:31 +00:00
Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() );
2004-07-12 12:15:31 +00:00
maFrameWin.SetBackground( aBack );
2004-07-15 06:13:23 +00:00
maCertImg.SetBackground( aBack );
2004-07-12 12:15:31 +00:00
maCertInfoFI.SetBackground( aBack );
maSep1FL.SetBackground( aBack );
maHintNotTrustedFI.SetBackground( aBack );
maSep2FL.SetBackground( aBack );
maIssuedToLabelFI.SetBackground( aBack );
maIssuedToFI.SetBackground( aBack );
maIssuedByLabelFI.SetBackground( aBack );
maIssuedByFI.SetBackground( aBack );
maValidDateFI.SetBackground( aBack );
2004-07-12 12:15:31 +00:00
maKeyImg.SetBackground( aBack );
maHintCorrespPrivKeyFI.SetBackground( aBack );
// make some bold
Font aFnt( maCertInfoFI.GetFont() );
aFnt.SetWeight( WEIGHT_BOLD );
maCertInfoFI.SetFont( aFnt );
maHintNotTrustedFI.SetFont( aFnt );
maIssuedToLabelFI.SetFont( aFnt );
maIssuedByLabelFI.SetFont( aFnt );
maValidDateFI.SetFont( aFnt );
2004-07-12 12:15:31 +00:00
// insert data
css::uno::Reference< css::security::XCertificate > xCert = mpDlg->mxCert;
2004-07-12 12:15:31 +00:00
maIssuedToFI.SetText( XmlSec::GetContentPart( xCert->getSubjectName() ) );
maIssuedByFI.SetText( XmlSec::GetContentPart( xCert->getIssuerName() ) );
2004-07-15 08:28:33 +00:00
// dynamic length because of the different languages
long nWidth1 = maIssuedToLabelFI.GetTextWidth( maIssuedToLabelFI.GetText() );
long nWidth2 = maIssuedByLabelFI.GetTextWidth( maIssuedByLabelFI.GetText() );
long nNewWidth = std::max( nWidth1, nWidth2 ) + 5;
Size aNewSize = maIssuedToLabelFI.GetSizePixel();
aNewSize.Width() = nNewWidth;
maIssuedToLabelFI.SetSizePixel( aNewSize );
maIssuedByLabelFI.SetSizePixel( aNewSize );
long nNewX = maIssuedToLabelFI.GetPosPixel().X() + nNewWidth + 1;
Point aNewPos = maIssuedToFI.GetPosPixel();
aNewPos.X() = nNewX;
maIssuedToFI.SetPosPixel( aNewPos );
aNewPos = maIssuedByFI.GetPosPixel();
aNewPos.X() = nNewX;
maIssuedByFI.SetPosPixel( aNewPos );
nNewWidth = maValidDateFI.GetSizePixel().Width() - nNewX;
aNewSize = maIssuedToFI.GetSizePixel();
aNewSize.Width() = nNewWidth;
maIssuedToFI.SetSizePixel( aNewSize );
maIssuedByFI.SetSizePixel( aNewSize );
DateTime aDateTimeStart( DateTime::EMPTY );
DateTime aDateTimeEnd( DateTime::EMPTY );
utl::typeConvert( xCert->getNotValidBefore(), aDateTimeStart );
utl::typeConvert( xCert->getNotValidAfter(), aDateTimeEnd );
OUString sText = maValidDateFI.GetText();
sText = sText.replaceFirst( "%SDATE%",
GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeStart.GetDate() ) );
sText = sText.replaceFirst( "%EDATE%",
GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeEnd.GetDate() ) );
maValidDateFI.SetText( sText );
2004-07-12 12:15:31 +00:00
// adjust position of fixed text depending on image sizes
2004-07-14 10:38:07 +00:00
ShrinkToFit( maCertImg );
ShrinkToFit( maKeyImg );
XmlSec::AlignAfterImage( maCertImg, maCertInfoFI, 12 );
XmlSec::AlignAfterImage( maKeyImg, maHintCorrespPrivKeyFI, 12 );
2004-07-22 14:37:38 +00:00
// Check if we have the private key...
sal_Bool bHasPrivateKey = sal_False;
// #i41270# Check only if we have that certificate in our security environment
if ( _pDlg->mbCheckForPrivateKey )
{
long nCertificateCharacters = _pDlg->mxSecurityEnvironment->getCertificateCharacters( xCert );
bHasPrivateKey = ( nCertificateCharacters & security::CertificateCharacters::HAS_PRIVATE_KEY ) ? sal_True : sal_False;
}
if ( !bHasPrivateKey )
2004-07-22 14:37:38 +00:00
{
maKeyImg.Hide();
maHintCorrespPrivKeyFI.Hide();
}
2004-07-12 12:15:31 +00:00
}
void CertificateViewerGeneralTP::ActivatePage()
{
2004-07-12 12:15:31 +00:00
}
2004-07-14 10:38:07 +00:00
struct Details_UserDatat
{
OUString maTxt;
2004-07-14 10:38:07 +00:00
bool mbFixedWidthFont;
inline Details_UserDatat( const OUString& _rTxt, bool _bFixedWidthFont );
2004-07-14 10:38:07 +00:00
};
inline Details_UserDatat::Details_UserDatat( const OUString& _rTxt, bool _bFixedWidthFont )
2004-07-14 10:38:07 +00:00
:maTxt ( _rTxt )
,mbFixedWidthFont ( _bFixedWidthFont )
{
}
2004-07-12 12:15:31 +00:00
void CertificateViewerDetailsTP::Clear( void )
{
maElementML.SetText( OUString() );
sal_uLong i = 0;
SvTreeListEntry* pEntry = maElementsLB.GetEntry( i );
2004-07-12 12:15:31 +00:00
while( pEntry )
{
2004-07-14 10:38:07 +00:00
delete ( Details_UserDatat* ) pEntry->GetUserData();
2004-07-12 12:15:31 +00:00
++i;
pEntry = maElementsLB.GetEntry( i );
}
maElementsLB.Clear();
}
void CertificateViewerDetailsTP::InsertElement( const OUString& _rField, const OUString& _rValue,
const OUString& _rDetails, bool _bFixedWidthFont )
2004-07-12 12:15:31 +00:00
{
SvTreeListEntry* pEntry = maElementsLB.InsertEntry( _rField );
2004-07-12 12:15:31 +00:00
maElementsLB.SetEntryText( _rValue, pEntry, 1 );
2004-07-14 10:38:07 +00:00
pEntry->SetUserData( ( void* ) new Details_UserDatat( _rDetails, _bFixedWidthFont ) );
2004-07-12 12:15:31 +00:00
}
CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, CertificateViewer* _pDlg )
:CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_DETAILS ), _pDlg )
,m_aElementsLBContainer(this, XMLSEC_RES(LB_ELEMENTS))
,maElementsLB(m_aElementsLBContainer)
,maElementML ( this, XMLSEC_RES( ML_ELEMENT ) )
2004-07-15 08:28:33 +00:00
,maStdFont ( maElementML.GetControlFont() )
2004-07-15 06:11:20 +00:00
,maFixedWidthFont ( OutputDevice::GetDefaultFont( DEFAULTFONT_UI_FIXED, LANGUAGE_DONTKNOW, DEFAULTFONT_FLAGS_ONLYONE, this ) )
2004-07-12 12:15:31 +00:00
{
2004-07-15 08:28:33 +00:00
WinBits nStyle = maElementsLB.GetStyle();
nStyle &= ~WB_HSCROLL;
maElementsLB.SetStyle( nStyle );
maFixedWidthFont.SetHeight( maStdFont.GetHeight() );
2004-07-15 06:11:20 +00:00
2004-07-15 08:28:33 +00:00
static long nTabs[] = { 2, 0, 30*CS_LB_WIDTH/100 };
2004-07-12 12:15:31 +00:00
maElementsLB.SetTabs( &nTabs[ 0 ] );
maElementsLB.InsertHeaderEntry( XMLSEC_RES( STR_HEADERBAR ) );
2004-07-12 12:15:31 +00:00
// fill list box
Reference< security::XCertificate > xCert = mpDlg->mxCert;
sal_uInt16 nLineBreak = 16;
2004-07-15 05:20:09 +00:00
const char* pHexSep = " ";
OUString aLBEntry;
OUString aDetails;
// Certificate Versions are reported wrong (#i35107#) - 0 == "V1", 1 == "V2", ..., n = "V(n+1)"
aLBEntry = OUString( "V" );
aLBEntry += OUString::number( xCert->getVersion() + 1 );
InsertElement( XMLSEC_RES( STR_VERSION ), aLBEntry, aLBEntry );
2004-07-15 05:20:09 +00:00
Sequence< sal_Int8 > aSeq = xCert->getSerialNumber();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( XMLSEC_RES( STR_SERIALNUM ), aLBEntry, aDetails, true );
2004-07-15 05:20:09 +00:00
std::pair< OUString, OUString> pairIssuer =
CWS-TOOLING: integrate CWS encsig09 2009-09-14 15:11:29 +0200 oc r276125 : #i105049# MacroSignatur needs Macro 2009-09-09 17:09:46 +0200 jl r276005 : #i103989# could not signe encrypted doc containing a formular object 2009-09-09 13:11:24 +0200 jl r275985 : #i103989# could not signe encrypted doc containing a formular object 2009-09-08 15:54:02 +0200 mav r275934 : #i103906# fix the automation test scenario ( tempfile should be writable for the user ) 2009-09-07 14:01:39 +0200 mav r275895 : #i103906# fix the problem with reload 2009-09-07 09:34:48 +0200 mav r275871 : #i104786# do the ODF version check only for ODF documents 2009-09-07 08:19:06 +0200 mav r275870 : #i104389# fix text 2009-09-06 22:24:21 +0200 mav r275867 : #i104786# check the consistency of ODF version 2009-09-06 22:23:24 +0200 mav r275866 : #i104786# check the consistency of ODF version 2009-09-06 22:23:00 +0200 mav r275865 : #i104786# check the consistency of ODF version 2009-09-06 22:22:36 +0200 mav r275864 : #i104786# check the consistency of ODF version 2009-09-06 22:22:03 +0200 mav r275863 : #i104786# check the consistency of ODF version 2009-09-02 17:09:30 +0200 mav r275722 : #i104715# let repairing mechanics use the streams correctly 2009-09-01 16:52:49 +0200 mav r275670 : #i104389# notify user not to trust the corrupted document 2009-09-01 16:31:37 +0200 mav r275668 : #i104389# use vnd.sun.star.zip: protocol to access zip files 2009-09-01 16:30:32 +0200 mav r275667 : #i104389# use vnd.sun.star.zip: protocol to access zip files 2009-09-01 16:22:13 +0200 jl r275666 : #i104339# small content change 2009-09-01 14:20:42 +0200 jl r275660 : #i103519# remove some debug output 2009-09-01 13:51:52 +0200 jl r275659 : #i103519# NSS uses '\' for escaping in distinguished names 2009-09-01 12:49:47 +0200 mav r275655 : #i104389# use zip-mode to read from jar files 2009-09-01 12:40:22 +0200 mav r275653 : #i104389# use zip-mode to read from jar files 2009-09-01 12:32:29 +0200 mav r275652 : #i104389# use constants 2009-08-31 21:58:00 +0200 mav r275637 : #i10000# fix warning 2009-08-31 21:11:17 +0200 mav r275636 : #i104227# adding of scripting signature removes the document signature 2009-08-31 20:55:05 +0200 mav r275635 : #i103905# ZipStorage supports Compressed property 2009-08-31 20:53:55 +0200 mav r275634 : #i103905# adjust macro signature transfer to usage of ZipStorage 2009-08-31 15:30:49 +0200 jl r275609 : #i103989# warning is shown as long the user does not click 'OK' 2009-08-31 14:36:10 +0200 jl r275608 : #i103989# changed warning text when signing macro and there is a document signature. This warning is only displayed once 2009-08-31 13:34:41 +0200 mav r275603 : #i104452# disable macros in repaired documents 2009-08-31 13:33:42 +0200 mav r275602 : #i104452# disable macros in repaired documents 2009-08-31 13:03:56 +0200 jl r275600 : #i45212# signature dialog could not be started when using read-only documents 2009-08-31 09:26:13 +0200 mav r275583 : #i104578# store the additional entry as the last one to workaround parsing problem in OOo3.1 and later 2009-08-30 20:54:25 +0200 mav r275562 : #i10000# adopt for unix 2009-08-30 10:56:00 +0200 mav r275561 : CWS-TOOLING: rebase CWS encsig09 to trunk@275331 (milestone: DEV300:m56) 2009-08-28 16:34:00 +0200 mav r275539 : #i104578# write necessary info in manifest.xml for ODF1.2 encrypted document 2009-08-28 14:04:22 +0200 mav r275533 : #104587# fix handling of readonly streams 2009-08-28 13:58:10 +0200 mav r275531 : #i104389# fix the broken document handling 2009-08-28 11:40:39 +0200 mav r275522 : #i104389# fix the signature streams check 2009-08-27 21:48:12 +0200 mav r275509 : #i103927# show the warning 2009-08-27 21:47:48 +0200 mav r275508 : #i103927# show the warning 2009-08-27 16:45:59 +0200 jl r275495 : #i45212# remove unused variable 2009-08-27 16:34:00 +0200 jl r275494 : #i103989# 2009-08-27 13:54:28 +0200 jl r275482 : #i103519# fixed replacement of 'S' by 'ST' 2009-08-27 12:32:21 +0200 mav r275472 : #i10000# fix warning 2009-08-27 11:58:11 +0200 mav r275467 : #i104389# handle the entry path correctly 2009-08-26 17:18:35 +0200 jl r275438 : #i103519# subject and issuer distinguished names were not properly displayed. The strings were obtained by system functions (Windows, NSS), which use quotes to escape the values, when they contain special characters 2009-08-26 11:00:20 +0200 mav r275403 : #i10000# fix warnings 2009-08-26 08:25:45 +0200 mav r275392 : #i10000# fix warning 2009-08-26 08:02:22 +0200 mav r275391 : #i10000# adopt for linux 2009-08-26 07:40:30 +0200 mav r275390 : #i10000# fix warning 2009-08-26 07:35:28 +0200 mav r275389 : #i10000# use correct include file name 2009-08-25 15:01:41 +0200 jl r275356 : #i103989# better check for mimetype of streams 2009-08-25 09:07:09 +0200 mav r275335 : CWS-TOOLING: rebase CWS encsig09 to trunk@274622 (milestone: DEV300:m54) 2009-08-24 18:17:02 +0200 mav r275329 : #i103927# check the nonencrypted streams 2009-08-24 18:14:14 +0200 mav r275328 : #i103927# check the nonencrypted streams 2009-08-24 17:59:34 +0200 mav r275327 : #i103927#,#i104389# check the package consistency and nonencrypted streams 2009-08-24 16:18:28 +0200 jl r275323 : #i103989# added comment 2009-08-24 13:08:47 +0200 jl r275305 : #i45212# #i66276# only write the X509Certificate element once and allow to add remove several certificates at a time 2009-08-21 12:57:28 +0200 ufi r275239 : 104339 2009-08-21 08:39:05 +0200 jl r275213 : #i10398# comparing URIs of signed files with the 'element list' 2009-08-20 13:39:47 +0200 jl r275178 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:35:39 +0200 jl r275177 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:29:06 +0200 jl r275176 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:26:21 +0200 jl r275175 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 12:05:09 +0200 ufi r275170 : i104339 2009-08-19 12:24:54 +0200 jl r275146 : #i10398# displaying 'old signature' icon and status in signature dialog 2009-08-18 15:18:48 +0200 jl r275111 : #i103989# document signatures containing manifest.xml are now validated according to the final ODF1.2 spec 2009-08-18 11:41:06 +0200 mav r275087 : #i103927# detect if encrypted ODF1.2 document contains nonencrypted streams 2009-08-18 11:35:13 +0200 mav r275085 : #i103927# detect if encrypted ODF1.2 document contains nonencrypted streams 2009-08-14 17:32:41 +0200 jl r274999 : #i103989# using c14n tranformation for XML streams 2009-08-14 15:27:43 +0200 jl r274987 : #i103989# remove special handling for encrypted document streams in UriBindingHelper::OpenInputStream, since we use zip storage this is not necessary anymore 2009-08-14 15:08:10 +0200 jl r274983 : #i103989# Showing a message when adding or removing a macro signature, that the document signature will be removed 2009-08-14 14:57:27 +0200 jl r274982 : #i103989# accesing Sequence at invalid index 2009-08-11 08:55:02 +0200 mav r274846 : #i103905# let signing service know if there is already a valid document signature 2009-08-10 11:33:37 +0200 jl r274799 : #i103905# do not truncate the stream 2009-08-10 10:43:47 +0200 mav r274797 : #i103905# provide the storage version 2009-08-07 16:58:46 +0200 jl r274780 : #i103989# 2009-08-07 16:56:19 +0200 jl r274779 : #i103989# using odf version string etc. 2009-08-07 15:20:53 +0200 mav r274771 : #i103905# provide the storage version 2009-08-07 15:19:12 +0200 mav r274770 : #i103905# provide the storage version 2009-08-07 12:41:45 +0200 mav r274758 : #103930# do not store thumbnail in case of encrypted document 2009-08-07 12:36:52 +0200 mav r274757 : #i103905# provide the storage version 2009-08-07 12:15:54 +0200 mav r274754 : #i103760# the signed state is not lost on saving 2009-08-07 12:06:19 +0200 mav r274753 : #i103760# avoid warning regarding signature removal on export 2009-08-07 12:06:01 +0200 mav r274752 : #i103760# avoid warning regarding signature removal on export 2009-08-06 08:47:34 +0200 mav r274703 : #i103905# allow to transport ODF version to the signing component 2009-08-05 21:34:42 +0200 mav r274701 : #i103905# allow to transport ODF version to the signing component 2009-08-05 15:48:17 +0200 mav r274683 : #i103905# allow to transport ODF version to the signing component 2009-08-05 14:58:12 +0200 jl r274673 : #i103989# documentsignature now signes all streams except documentsignatures.xml, all streams are processed as binary files 2009-08-05 12:00:32 +0200 mav r274648 : #i103905# allow to transport ODF version to the signing component 2009-08-04 10:57:04 +0200 jl r274612 : #i103989# added XInitialization 2009-07-31 10:32:27 +0200 mav r274516 : #i103905# use zip storage to sign documents 2009-07-30 14:01:33 +0200 mav r274489 : #i103906# optimize the usage of temporary medium 2009-07-30 14:00:28 +0200 mav r274488 : #i103906# optimize the usage of temporary medium 2009-07-30 13:59:09 +0200 mav r274487 : #i103906# optimize the usage of temporary medium 2009-07-30 13:50:44 +0200 mav r274485 : #i103906# optimize the usage of temporary medium 2009-07-30 13:49:53 +0200 mav r274484 : #i103906# optimize the usage of temporary medium 2009-07-30 13:49:13 +0200 mav r274483 : #i103906# optimize the usage of temporary medium 2009-07-30 13:47:09 +0200 mav r274482 : #i103905#,#i103906# let the signing process use zip-storage; optimize the usage of temporary medium 2009-07-21 09:10:31 +0200 mav r274159 : CWS-TOOLING: rebase CWS encsig09 to trunk@273468 (milestone: DEV300:m51) 2009-05-05 08:39:01 +0200 mav r271496 : #i100832# allow to sign macros only when there are any
2009-09-17 13:53:54 +00:00
XmlSec::GetDNForCertDetailsView(xCert->getIssuerName());
aLBEntry = pairIssuer.first;
aDetails = pairIssuer.second;
InsertElement( XMLSEC_RES( STR_ISSUER ), aLBEntry, aDetails );
2004-07-15 08:28:33 +00:00
DateTime aDateTime( DateTime::EMPTY );
utl::typeConvert( xCert->getNotValidBefore(), aDateTime );
2004-07-15 08:28:33 +00:00
aLBEntry = GetSettings().GetUILocaleDataWrapper().getDate( aDateTime.GetDate() );
aLBEntry += OUString( " " );
2004-07-15 08:28:33 +00:00
aLBEntry += GetSettings().GetUILocaleDataWrapper().getTime( aDateTime.GetTime() );
InsertElement( XMLSEC_RES( STR_VALIDFROM ), aLBEntry, aLBEntry );
utl::typeConvert( xCert->getNotValidAfter(), aDateTime );
2004-07-15 08:28:33 +00:00
aLBEntry = GetSettings().GetUILocaleDataWrapper().getDate( aDateTime.GetDate() );
aLBEntry += OUString( " " );
2004-07-15 08:28:33 +00:00
aLBEntry += GetSettings().GetUILocaleDataWrapper().getTime( aDateTime.GetTime() );
InsertElement( XMLSEC_RES( STR_VALIDTO ), aLBEntry, aLBEntry );
2004-07-15 05:20:09 +00:00
std::pair< OUString, OUString > pairSubject =
CWS-TOOLING: integrate CWS encsig09 2009-09-14 15:11:29 +0200 oc r276125 : #i105049# MacroSignatur needs Macro 2009-09-09 17:09:46 +0200 jl r276005 : #i103989# could not signe encrypted doc containing a formular object 2009-09-09 13:11:24 +0200 jl r275985 : #i103989# could not signe encrypted doc containing a formular object 2009-09-08 15:54:02 +0200 mav r275934 : #i103906# fix the automation test scenario ( tempfile should be writable for the user ) 2009-09-07 14:01:39 +0200 mav r275895 : #i103906# fix the problem with reload 2009-09-07 09:34:48 +0200 mav r275871 : #i104786# do the ODF version check only for ODF documents 2009-09-07 08:19:06 +0200 mav r275870 : #i104389# fix text 2009-09-06 22:24:21 +0200 mav r275867 : #i104786# check the consistency of ODF version 2009-09-06 22:23:24 +0200 mav r275866 : #i104786# check the consistency of ODF version 2009-09-06 22:23:00 +0200 mav r275865 : #i104786# check the consistency of ODF version 2009-09-06 22:22:36 +0200 mav r275864 : #i104786# check the consistency of ODF version 2009-09-06 22:22:03 +0200 mav r275863 : #i104786# check the consistency of ODF version 2009-09-02 17:09:30 +0200 mav r275722 : #i104715# let repairing mechanics use the streams correctly 2009-09-01 16:52:49 +0200 mav r275670 : #i104389# notify user not to trust the corrupted document 2009-09-01 16:31:37 +0200 mav r275668 : #i104389# use vnd.sun.star.zip: protocol to access zip files 2009-09-01 16:30:32 +0200 mav r275667 : #i104389# use vnd.sun.star.zip: protocol to access zip files 2009-09-01 16:22:13 +0200 jl r275666 : #i104339# small content change 2009-09-01 14:20:42 +0200 jl r275660 : #i103519# remove some debug output 2009-09-01 13:51:52 +0200 jl r275659 : #i103519# NSS uses '\' for escaping in distinguished names 2009-09-01 12:49:47 +0200 mav r275655 : #i104389# use zip-mode to read from jar files 2009-09-01 12:40:22 +0200 mav r275653 : #i104389# use zip-mode to read from jar files 2009-09-01 12:32:29 +0200 mav r275652 : #i104389# use constants 2009-08-31 21:58:00 +0200 mav r275637 : #i10000# fix warning 2009-08-31 21:11:17 +0200 mav r275636 : #i104227# adding of scripting signature removes the document signature 2009-08-31 20:55:05 +0200 mav r275635 : #i103905# ZipStorage supports Compressed property 2009-08-31 20:53:55 +0200 mav r275634 : #i103905# adjust macro signature transfer to usage of ZipStorage 2009-08-31 15:30:49 +0200 jl r275609 : #i103989# warning is shown as long the user does not click 'OK' 2009-08-31 14:36:10 +0200 jl r275608 : #i103989# changed warning text when signing macro and there is a document signature. This warning is only displayed once 2009-08-31 13:34:41 +0200 mav r275603 : #i104452# disable macros in repaired documents 2009-08-31 13:33:42 +0200 mav r275602 : #i104452# disable macros in repaired documents 2009-08-31 13:03:56 +0200 jl r275600 : #i45212# signature dialog could not be started when using read-only documents 2009-08-31 09:26:13 +0200 mav r275583 : #i104578# store the additional entry as the last one to workaround parsing problem in OOo3.1 and later 2009-08-30 20:54:25 +0200 mav r275562 : #i10000# adopt for unix 2009-08-30 10:56:00 +0200 mav r275561 : CWS-TOOLING: rebase CWS encsig09 to trunk@275331 (milestone: DEV300:m56) 2009-08-28 16:34:00 +0200 mav r275539 : #i104578# write necessary info in manifest.xml for ODF1.2 encrypted document 2009-08-28 14:04:22 +0200 mav r275533 : #104587# fix handling of readonly streams 2009-08-28 13:58:10 +0200 mav r275531 : #i104389# fix the broken document handling 2009-08-28 11:40:39 +0200 mav r275522 : #i104389# fix the signature streams check 2009-08-27 21:48:12 +0200 mav r275509 : #i103927# show the warning 2009-08-27 21:47:48 +0200 mav r275508 : #i103927# show the warning 2009-08-27 16:45:59 +0200 jl r275495 : #i45212# remove unused variable 2009-08-27 16:34:00 +0200 jl r275494 : #i103989# 2009-08-27 13:54:28 +0200 jl r275482 : #i103519# fixed replacement of 'S' by 'ST' 2009-08-27 12:32:21 +0200 mav r275472 : #i10000# fix warning 2009-08-27 11:58:11 +0200 mav r275467 : #i104389# handle the entry path correctly 2009-08-26 17:18:35 +0200 jl r275438 : #i103519# subject and issuer distinguished names were not properly displayed. The strings were obtained by system functions (Windows, NSS), which use quotes to escape the values, when they contain special characters 2009-08-26 11:00:20 +0200 mav r275403 : #i10000# fix warnings 2009-08-26 08:25:45 +0200 mav r275392 : #i10000# fix warning 2009-08-26 08:02:22 +0200 mav r275391 : #i10000# adopt for linux 2009-08-26 07:40:30 +0200 mav r275390 : #i10000# fix warning 2009-08-26 07:35:28 +0200 mav r275389 : #i10000# use correct include file name 2009-08-25 15:01:41 +0200 jl r275356 : #i103989# better check for mimetype of streams 2009-08-25 09:07:09 +0200 mav r275335 : CWS-TOOLING: rebase CWS encsig09 to trunk@274622 (milestone: DEV300:m54) 2009-08-24 18:17:02 +0200 mav r275329 : #i103927# check the nonencrypted streams 2009-08-24 18:14:14 +0200 mav r275328 : #i103927# check the nonencrypted streams 2009-08-24 17:59:34 +0200 mav r275327 : #i103927#,#i104389# check the package consistency and nonencrypted streams 2009-08-24 16:18:28 +0200 jl r275323 : #i103989# added comment 2009-08-24 13:08:47 +0200 jl r275305 : #i45212# #i66276# only write the X509Certificate element once and allow to add remove several certificates at a time 2009-08-21 12:57:28 +0200 ufi r275239 : 104339 2009-08-21 08:39:05 +0200 jl r275213 : #i10398# comparing URIs of signed files with the 'element list' 2009-08-20 13:39:47 +0200 jl r275178 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:35:39 +0200 jl r275177 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:29:06 +0200 jl r275176 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:26:21 +0200 jl r275175 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 12:05:09 +0200 ufi r275170 : i104339 2009-08-19 12:24:54 +0200 jl r275146 : #i10398# displaying 'old signature' icon and status in signature dialog 2009-08-18 15:18:48 +0200 jl r275111 : #i103989# document signatures containing manifest.xml are now validated according to the final ODF1.2 spec 2009-08-18 11:41:06 +0200 mav r275087 : #i103927# detect if encrypted ODF1.2 document contains nonencrypted streams 2009-08-18 11:35:13 +0200 mav r275085 : #i103927# detect if encrypted ODF1.2 document contains nonencrypted streams 2009-08-14 17:32:41 +0200 jl r274999 : #i103989# using c14n tranformation for XML streams 2009-08-14 15:27:43 +0200 jl r274987 : #i103989# remove special handling for encrypted document streams in UriBindingHelper::OpenInputStream, since we use zip storage this is not necessary anymore 2009-08-14 15:08:10 +0200 jl r274983 : #i103989# Showing a message when adding or removing a macro signature, that the document signature will be removed 2009-08-14 14:57:27 +0200 jl r274982 : #i103989# accesing Sequence at invalid index 2009-08-11 08:55:02 +0200 mav r274846 : #i103905# let signing service know if there is already a valid document signature 2009-08-10 11:33:37 +0200 jl r274799 : #i103905# do not truncate the stream 2009-08-10 10:43:47 +0200 mav r274797 : #i103905# provide the storage version 2009-08-07 16:58:46 +0200 jl r274780 : #i103989# 2009-08-07 16:56:19 +0200 jl r274779 : #i103989# using odf version string etc. 2009-08-07 15:20:53 +0200 mav r274771 : #i103905# provide the storage version 2009-08-07 15:19:12 +0200 mav r274770 : #i103905# provide the storage version 2009-08-07 12:41:45 +0200 mav r274758 : #103930# do not store thumbnail in case of encrypted document 2009-08-07 12:36:52 +0200 mav r274757 : #i103905# provide the storage version 2009-08-07 12:15:54 +0200 mav r274754 : #i103760# the signed state is not lost on saving 2009-08-07 12:06:19 +0200 mav r274753 : #i103760# avoid warning regarding signature removal on export 2009-08-07 12:06:01 +0200 mav r274752 : #i103760# avoid warning regarding signature removal on export 2009-08-06 08:47:34 +0200 mav r274703 : #i103905# allow to transport ODF version to the signing component 2009-08-05 21:34:42 +0200 mav r274701 : #i103905# allow to transport ODF version to the signing component 2009-08-05 15:48:17 +0200 mav r274683 : #i103905# allow to transport ODF version to the signing component 2009-08-05 14:58:12 +0200 jl r274673 : #i103989# documentsignature now signes all streams except documentsignatures.xml, all streams are processed as binary files 2009-08-05 12:00:32 +0200 mav r274648 : #i103905# allow to transport ODF version to the signing component 2009-08-04 10:57:04 +0200 jl r274612 : #i103989# added XInitialization 2009-07-31 10:32:27 +0200 mav r274516 : #i103905# use zip storage to sign documents 2009-07-30 14:01:33 +0200 mav r274489 : #i103906# optimize the usage of temporary medium 2009-07-30 14:00:28 +0200 mav r274488 : #i103906# optimize the usage of temporary medium 2009-07-30 13:59:09 +0200 mav r274487 : #i103906# optimize the usage of temporary medium 2009-07-30 13:50:44 +0200 mav r274485 : #i103906# optimize the usage of temporary medium 2009-07-30 13:49:53 +0200 mav r274484 : #i103906# optimize the usage of temporary medium 2009-07-30 13:49:13 +0200 mav r274483 : #i103906# optimize the usage of temporary medium 2009-07-30 13:47:09 +0200 mav r274482 : #i103905#,#i103906# let the signing process use zip-storage; optimize the usage of temporary medium 2009-07-21 09:10:31 +0200 mav r274159 : CWS-TOOLING: rebase CWS encsig09 to trunk@273468 (milestone: DEV300:m51) 2009-05-05 08:39:01 +0200 mav r271496 : #i100832# allow to sign macros only when there are any
2009-09-17 13:53:54 +00:00
XmlSec::GetDNForCertDetailsView(xCert->getSubjectName());
aLBEntry = pairSubject.first;
aDetails = pairSubject.second;
InsertElement( XMLSEC_RES( STR_SUBJECT ), aLBEntry, aDetails );
2011-05-26 10:37:34 -04:00
2004-07-15 05:20:09 +00:00
aLBEntry = aDetails = xCert->getSubjectPublicKeyAlgorithm();
InsertElement( XMLSEC_RES( STR_SUBJECT_PUBKEY_ALGO ), aLBEntry, aDetails );
2004-07-15 05:20:09 +00:00
aSeq = xCert->getSubjectPublicKeyValue();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( XMLSEC_RES( STR_SUBJECT_PUBKEY_VAL ), aLBEntry, aDetails, true );
2004-07-15 05:20:09 +00:00
aLBEntry = aDetails = xCert->getSignatureAlgorithm();
InsertElement( XMLSEC_RES( STR_SIGNATURE_ALGO ), aLBEntry, aDetails );
2004-07-15 05:20:09 +00:00
2004-07-15 08:28:33 +00:00
aSeq = xCert->getSHA1Thumbprint();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( XMLSEC_RES( STR_THUMBPRINT_SHA1 ), aLBEntry, aDetails, true );
2004-07-15 08:28:33 +00:00
aSeq = xCert->getMD5Thumbprint();
2004-07-15 05:20:09 +00:00
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( XMLSEC_RES( STR_THUMBPRINT_MD5 ), aLBEntry, aDetails, true );
2004-07-12 12:15:31 +00:00
FreeResource();
maElementsLB.SetSelectHdl( LINK( this, CertificateViewerDetailsTP, ElementSelectHdl ) );
}
CertificateViewerDetailsTP::~CertificateViewerDetailsTP()
{
Clear();
}
void CertificateViewerDetailsTP::ActivatePage()
{
}
IMPL_LINK_NOARG(CertificateViewerDetailsTP, ElementSelectHdl)
2004-07-12 12:15:31 +00:00
{
SvTreeListEntry* pEntry = maElementsLB.FirstSelected();
OUString aElementText;
2004-07-14 10:38:07 +00:00
bool bFixedWidthFont;
2004-07-12 12:15:31 +00:00
if( pEntry )
{
2004-07-14 10:38:07 +00:00
const Details_UserDatat* p = ( Details_UserDatat* ) pEntry->GetUserData();
aElementText = p->maTxt;
bFixedWidthFont = p->mbFixedWidthFont;
2004-07-12 12:15:31 +00:00
}
2004-07-14 10:38:07 +00:00
else
bFixedWidthFont = false;
2004-07-12 12:15:31 +00:00
2004-07-14 10:38:07 +00:00
maElementML.SetFont( bFixedWidthFont? maFixedWidthFont : maStdFont );
2004-07-15 06:11:20 +00:00
maElementML.SetControlFont( bFixedWidthFont? maFixedWidthFont : maStdFont );
2004-07-12 12:15:31 +00:00
maElementML.SetText( aElementText );
return 0;
}
2004-07-21 12:57:52 +00:00
struct CertPath_UserData
{
css::uno::Reference< css::security::XCertificate > mxCert;
OUString maStatus;
bool mbValid;
2004-07-21 12:57:52 +00:00
CertPath_UserData( css::uno::Reference< css::security::XCertificate > xCert, bool bValid):
mxCert(xCert),
mbValid(bValid)
{
}
2004-07-21 12:57:52 +00:00
};
2004-07-12 12:15:31 +00:00
CertificateViewerCertPathTP::CertificateViewerCertPathTP( Window* _pParent, CertificateViewer* _pDlg )
:CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_CERTPATH ), _pDlg )
,maCertPathFT ( this, XMLSEC_RES( FT_CERTPATH ) )
,maCertPathLB ( this, XMLSEC_RES( LB_SIGNATURES ) )
,maViewCertPB ( this, XMLSEC_RES( BTN_VIEWCERT ) )
,maCertStatusFT ( this, XMLSEC_RES( FT_CERTSTATUS ) )
,maCertStatusML ( this, XMLSEC_RES( ML_CERTSTATUS ) )
,mpParent ( _pDlg )
,mbFirstActivateDone ( false )
,maCertImage ( XMLSEC_RES( IMG_CERT_SMALL ) )
,maCertNotValidatedImage( XMLSEC_RES( IMG_CERT_NOTVALIDATED_SMALL ) )
,msCertOK ( XMLSEC_RES( STR_PATH_CERT_OK ) )
,msCertNotValidated ( XMLSEC_RES( STR_PATH_CERT_NOT_VALIDATED ) )
2004-07-12 12:15:31 +00:00
{
FreeResource();
maCertPathLB.SetNodeDefaultImages();
maCertPathLB.SetSublistOpenWithLeftRight();
2004-07-12 12:15:31 +00:00
maCertPathLB.SetSelectHdl( LINK( this, CertificateViewerCertPathTP, CertSelectHdl ) );
maViewCertPB.SetClickHdl( LINK( this, CertificateViewerCertPathTP, ViewCertHdl ) );
2004-07-15 08:28:33 +00:00
// check if buttontext is to wide
const long nOffset = 10;
OUString sText = maViewCertPB.GetText();
long nTxtW = maViewCertPB.GetTextWidth( sText );
if ( sText.indexOf( '~' ) == -1 )
nTxtW += nOffset;
long nBtnW = maViewCertPB.GetSizePixel().Width();
if ( nTxtW > nBtnW )
{
// broaden the button
long nDelta = nTxtW - nBtnW;
Size aNewSize = maViewCertPB.GetSizePixel();
aNewSize.Width() += nDelta;
maViewCertPB.SetSizePixel( aNewSize );
// and give it a new position
Point aNewPos = maViewCertPB.GetPosPixel();
aNewPos.X() -= nDelta;
maViewCertPB.SetPosPixel( aNewPos );
}
2004-07-12 12:15:31 +00:00
}
CertificateViewerCertPathTP::~CertificateViewerCertPathTP()
{
Clear();
}
void CertificateViewerCertPathTP::ActivatePage()
{
if ( !mbFirstActivateDone )
{
mbFirstActivateDone = true;
Sequence< Reference< security::XCertificate > > aCertPath =
mpParent->mxSecurityEnvironment->buildCertificatePath( mpParent->mxCert );
const Reference< security::XCertificate >* pCertPath = aCertPath.getConstArray();
sal_Int32 i, nCnt = aCertPath.getLength();
SvTreeListEntry* pParent = NULL;
for( i = nCnt; i; )
{
const Reference< security::XCertificate > rCert = pCertPath[ --i ];
OUString sName = XmlSec::GetContentPart( rCert->getSubjectName() );
//Verify the certificate
CWS-TOOLING: integrate CWS jl127 2009-07-30 10:12:10 +0200 jl r274470 : #i100873# switch on checking for symbol definitions. It works with the current xpcom lib. 2009-07-29 09:48:29 +0200 jl r274443 : #i100873# 2009-07-29 09:47:36 +0200 jl r274442 : #i100873# changes after resync with DEV300m53 which contains the seamonkey update 2009-07-28 10:00:03 +0200 jl r274389 : #100873# Patches from tono 2009-07-27 16:59:39 +0200 jl r274372 : CWS-TOOLING: rebase CWS jl127 to trunk@274203 (milestone: DEV300:m53) 2009-07-07 09:08:53 +0200 jl r273768 : #100873# 2009-07-06 17:16:10 +0200 jl r273754 : #100873# 2009-07-01 13:58:09 +0200 jl r273576 : #100873# added to readme 2009-07-01 13:15:02 +0200 jl r273573 : #100873# deliver lib files when building with MS compiler 2009-06-30 11:22:06 +0200 jl r273498 : #i100873# accidentally commented out patch_files 2009-06-30 09:01:10 +0200 jl r273489 : #100873# make rc.exe work in ooo windows build 2009-06-29 09:47:56 +0200 jl r273451 : #i100873# applied mingw patch from tono 2009-06-24 12:52:14 +0200 jl r273332 : #100873# reapplying the configure.in patch on version 273150 2009-06-24 12:51:12 +0200 jl r273331 : #100873# reapplying the patch on version 273150 2009-06-23 17:17:36 +0200 jl r273299 : #100873# manually modified patch from tono 2009-06-22 17:05:41 +0200 jl r273243 : #100873# applying mingw patch from tono 2009-06-22 17:02:30 +0200 jl r273242 : #100873# applying mingw patch from tono 2009-06-22 12:49:57 +0200 jl r273216 : #100873# dependency to stlport 2009-06-19 11:56:16 +0200 jl r273155 : #100873# undoing a previous change, instset_native complained about missing libjpipe.jnilib (jurt) 2009-06-19 10:13:03 +0200 jl r273150 : #100873# ooo builds shall also use the new nss by default 2009-06-18 14:32:07 +0200 jl r273117 : #110873# more debug output when verifying a certificate 2009-06-16 11:23:50 +0200 jl r273012 : #i10873# 2009-06-16 10:57:41 +0200 jl r273011 : #100873# wrong parameter definition in nsscrypto_initialize 2009-06-16 10:56:45 +0200 jl r273010 : #100873# wrong parameter definition in nsscrypto_initialize 2009-06-15 16:20:42 +0200 jl r272996 : #100873# initialization of NSS is now threadsafe 2009-06-10 12:50:46 +0200 jl r272804 : #100873# rename in foreach fails in 4nt 2009-06-09 13:43:00 +0200 jl r272768 : #i100873# deliver only .h from inc/nss otherwise we get a warning when nss/nssck.api is delivered 2009-06-08 16:15:44 +0200 jl r272739 : #i100873# 2009-06-08 16:04:54 +0200 jl r272738 : #i100873# 2009-06-08 15:45:52 +0200 jl r272736 : #i100873# 2009-06-08 15:44:15 +0200 jl r272735 : #i100873# unzipping of nss.tar.z not working with 4nt 2009-06-08 09:45:46 +0200 jl r272720 : #i100873# 2009-06-03 13:53:52 +0200 jl r272562 : #i100873# MOZILLABUILD not correct 2009-06-03 13:17:54 +0200 jl r272557 : #i100873# readme and makefile changes from cws jl125, support of new nss module 2009-06-03 09:57:40 +0200 jl r272544 : #i100873# added readme 2009-06-02 16:47:47 +0200 jl r272512 : #i100873# removed no longer needed stuff regarding jnilibs 2009-06-02 15:54:42 +0200 jl r272510 : #i100873# added NSS to BUILD_TYPE 2009-06-02 15:20:18 +0200 jl r272508 : #i100873# DEREFERENCE option for copy command 2009-06-02 13:00:12 +0200 jl r272496 : #i100873# PATCH_FILE_NAMES is now PATCH_FILES 2009-06-02 12:23:39 +0200 jl r272494 : #i100873# build dependency to nss 2009-05-29 16:21:40 +0200 jl r272470 : #i100873# seting ENABLE_NSS_MODULE==YES and includeing mozilla-build-1.3 folder in environment 2009-05-29 16:03:23 +0200 jl r272468 : #i100873# use intermediate certificates when validating a certificate 2009-05-29 15:57:16 +0200 jl r272466 : #i100873# use intermediate certificates when validating a certificate 2009-05-29 15:49:58 +0200 jl r272464 : #i100873# using ENABLE_NSS_MODULE 2009-05-29 15:33:14 +0200 jl r272463 : #i100873# using ENABLE_NSS_MODULE 2009-05-29 15:28:39 +0200 jl r272461 : #i100873# build dependency to nss module 2009-05-29 15:24:57 +0200 jl r272460 : #i100873# pass additional certificates into verifyCertificate function 2009-05-29 14:49:40 +0200 jl r272458 : #i100873# new NSS module 2009-05-29 14:43:44 +0200 jl r272457 : #i100873# new NSS module
2009-08-26 08:22:01 +00:00
sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert,
Sequence<Reference<css::security::XCertificate> >());
bool bCertValid = certStatus == css::security::CertificateValidity::VALID ? true : false;
pParent = InsertCert( pParent, sName, rCert, bCertValid);
}
maCertPathLB.Select( pParent );
maViewCertPB.Disable(); // Own certificate selected
while( pParent )
{
maCertPathLB.Expand( pParent );
pParent = maCertPathLB.GetParent( pParent );
}
CertSelectHdl( NULL );
}
2004-07-12 12:15:31 +00:00
}
IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl)
2004-07-21 12:57:52 +00:00
{
SvTreeListEntry* pEntry = maCertPathLB.FirstSelected();
2004-07-21 12:57:52 +00:00
if( pEntry )
{
CertificateViewer aViewer( this, mpDlg->mxSecurityEnvironment, ((CertPath_UserData*)pEntry->GetUserData())->mxCert, false );
2004-07-21 12:57:52 +00:00
aViewer.Execute();
}
return 0;
}
IMPL_LINK_NOARG(CertificateViewerCertPathTP, CertSelectHdl)
2004-07-12 12:15:31 +00:00
{
OUString sStatus;
SvTreeListEntry* pEntry = maCertPathLB.FirstSelected();
2004-07-12 12:15:31 +00:00
if( pEntry )
2004-07-21 12:57:52 +00:00
{
CertPath_UserData* pData = (CertPath_UserData*) pEntry->GetUserData();
if ( pData )
sStatus = pData->mbValid ? msCertOK : msCertNotValidated;
2004-07-21 12:57:52 +00:00
}
2004-07-12 12:15:31 +00:00
maCertStatusML.SetText( sStatus );
2004-07-21 12:57:52 +00:00
maViewCertPB.Enable( pEntry && ( pEntry != maCertPathLB.Last() ) );
2004-07-12 12:15:31 +00:00
return 0;
}
void CertificateViewerCertPathTP::Clear( void )
{
maCertStatusML.SetText( OUString() );
sal_uLong i = 0;
SvTreeListEntry* pEntry = maCertPathLB.GetEntry( i );
2004-07-12 12:15:31 +00:00
while( pEntry )
{
2004-07-21 12:57:52 +00:00
delete ( CertPath_UserData* ) pEntry->GetUserData();
2004-07-12 12:15:31 +00:00
++i;
pEntry = maCertPathLB.GetEntry( i );
}
maCertPathLB.Clear();
}
SvTreeListEntry* CertificateViewerCertPathTP::InsertCert(
SvTreeListEntry* _pParent, const OUString& _rName, css::uno::Reference< css::security::XCertificate > rxCert,
bool bValid)
2004-07-12 12:15:31 +00:00
{
Image aImage = bValid ? maCertImage : maCertNotValidatedImage;
SvTreeListEntry* pEntry = maCertPathLB.InsertEntry( _rName, aImage, aImage, _pParent );
pEntry->SetUserData( ( void* ) new CertPath_UserData( rxCert, bValid ) );
2004-07-15 05:20:09 +00:00
return pEntry;
2004-07-12 12:15:31 +00:00
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */