1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmlsecurity.hxx"
30 #include <xmlsecurity/certificateviewer.hxx>
31 #include <com/sun/star/security/XCertificate.hpp>
33 #include <com/sun/star/security/CertificateCharacters.hpp>
34 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
35 #include <com/sun/star/security/CertificateValidity.hpp>
37 #include <unotools/localedatawrapper.hxx>
38 #include <unotools/datetime.hxx>
40 #include "dialogs.hrc"
41 #include "resourcemanager.hxx"
43 /* HACK: disable some warnings for MS-C */
45 #pragma warning (disable : 4355) // 4355: this used in initializer-list
48 using namespace ::com::sun::star
;
49 using namespace ::com::sun::star::uno
;
50 namespace css
= ::com::sun::star
;
55 void ShrinkToFit( FixedImage
& _rImage
);
56 void AdjustPosAndSize( Control
& _rCtrl
, Point
& _rStartIn_EndOut
, long _nXOffset
= 0 );
58 void ShrinkToFit( FixedImage
& _rImg
)
60 _rImg
.SetSizePixel( _rImg
.GetImage().GetSizePixel() );
63 void AdjustPosAndSize( Control
& _rCtrl
, Point
& _rStartIn_EndOut
, long _nOffs
)
65 _rCtrl
.SetPosPixel( _rStartIn_EndOut
);
66 _rStartIn_EndOut
.X() += XmlSec::ShrinkToFitWidth( _rCtrl
, _nOffs
);
70 CertificateViewer::CertificateViewer(
72 const cssu::Reference
< dcss::xml::crypto::XSecurityEnvironment
>& _rxSecurityEnvironment
,
73 const cssu::Reference
< dcss::security::XCertificate
>& _rXCert
, BOOL bCheckForPrivateKey
)
74 :TabDialog ( _pParent
, XMLSEC_RES( RID_XMLSECDLG_CERTVIEWER
) )
75 ,maTabCtrl ( this, XMLSEC_RES( 1 ) )
76 ,maOkBtn ( this, XMLSEC_RES( BTN_OK
) )
77 ,maHelpBtn ( this, XMLSEC_RES( BTN_HELP
) )
81 mbCheckForPrivateKey
= bCheckForPrivateKey
;
83 mxSecurityEnvironment
= _rxSecurityEnvironment
;
86 maTabCtrl
.SetTabPage( RID_XMLSECTP_GENERAL
, new CertificateViewerGeneralTP( &maTabCtrl
, this ) );
87 maTabCtrl
.SetTabPage( RID_XMLSECTP_DETAILS
, new CertificateViewerDetailsTP( &maTabCtrl
, this ) );
88 maTabCtrl
.SetTabPage( RID_XMLSECTP_CERTPATH
, new CertificateViewerCertPathTP( &maTabCtrl
, this ) );
89 maTabCtrl
.SetCurPageId( RID_XMLSECTP_GENERAL
);
92 CertificateViewer::~CertificateViewer()
94 delete maTabCtrl
.GetTabPage( RID_XMLSECTP_CERTPATH
);
95 delete maTabCtrl
.GetTabPage( RID_XMLSECTP_DETAILS
);
96 delete maTabCtrl
.GetTabPage( RID_XMLSECTP_GENERAL
);
99 CertificateViewerTP::CertificateViewerTP( Window
* _pParent
, const ResId
& _rResId
, CertificateViewer
* _pDlg
)
100 :TabPage ( _pParent
, _rResId
)
106 CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window
* _pParent
, CertificateViewer
* _pDlg
)
107 :CertificateViewerTP ( _pParent
, XMLSEC_RES( RID_XMLSECTP_GENERAL
), _pDlg
)
108 ,maFrameWin ( this, XMLSEC_RES( WIN_FRAME
) )
109 ,maCertImg ( this, XMLSEC_RES( IMG_CERT
) )
110 ,maCertInfoFI ( this, XMLSEC_RES( FI_CERTINFO
) )
111 ,maSep1FL ( this, XMLSEC_RES( FL_SEP1
) )
112 ,maHintNotTrustedFI ( this, XMLSEC_RES( FI_HINTNOTTRUST
) )
113 ,maSep2FL ( this, XMLSEC_RES( FL_SEP2
) )
114 ,maIssuedToLabelFI ( this, XMLSEC_RES( FI_ISSTOLABEL
) )
115 ,maIssuedToFI ( this, XMLSEC_RES( FI_ISSTO
) )
116 ,maIssuedByLabelFI ( this, XMLSEC_RES( FI_ISSBYLABEL
) )
117 ,maIssuedByFI ( this, XMLSEC_RES( FI_ISSBY
) )
118 ,maValidDateFI ( this, XMLSEC_RES( FI_VALIDDATE
) )
119 ,maKeyImg ( this, XMLSEC_RES( IMG_KEY
) )
120 ,maHintCorrespPrivKeyFI ( this, XMLSEC_RES( FI_CORRPRIVKEY
) )
122 if ( GetSettings().GetStyleSettings().GetHighContrastMode() )
123 maKeyImg
.SetImage( Image( XMLSEC_RES( IMG_KEY_HC
) ) );
125 //Verify the certificate
126 sal_Int32 certStatus
= mpDlg
->mxSecurityEnvironment
->verifyCertificate(mpDlg
->mxCert
,
127 Sequence
<Reference
<css::security::XCertificate
> >());
129 bool bCertValid
= certStatus
== css::security::CertificateValidity::VALID
? true : false;
131 bool bHC
= GetSettings().GetStyleSettings().GetHighContrastMode();
135 Image( XMLSEC_RES( bHC
? IMG_STATE_NOT_VALIDATED_HC
: IMG_STATE_NOT_VALIDATED
) ) );
136 maHintNotTrustedFI
.SetText( String( XMLSEC_RES( STR_CERTIFICATE_NOT_VALIDATED
) ) );
139 maCertImg
.SetImage( Image( XMLSEC_RES( IMG_STATE_CERIFICATED_HC
) ) );
143 Wallpaper
aBack( GetSettings().GetStyleSettings().GetWindowColor() );
144 maFrameWin
.SetBackground( aBack
);
145 maCertImg
.SetBackground( aBack
);
146 maCertInfoFI
.SetBackground( aBack
);
147 maSep1FL
.SetBackground( aBack
);
148 maHintNotTrustedFI
.SetBackground( aBack
);
149 maSep2FL
.SetBackground( aBack
);
150 maIssuedToLabelFI
.SetBackground( aBack
);
151 maIssuedToFI
.SetBackground( aBack
);
152 maIssuedByLabelFI
.SetBackground( aBack
);
153 maIssuedByFI
.SetBackground( aBack
);
154 maValidDateFI
.SetBackground( aBack
);
155 maKeyImg
.SetBackground( aBack
);
156 maHintCorrespPrivKeyFI
.SetBackground( aBack
);
159 Font
aFnt( maCertInfoFI
.GetFont() );
160 aFnt
.SetWeight( WEIGHT_BOLD
);
161 maCertInfoFI
.SetFont( aFnt
);
162 maHintNotTrustedFI
.SetFont( aFnt
);
163 maIssuedToLabelFI
.SetFont( aFnt
);
164 maIssuedByLabelFI
.SetFont( aFnt
);
165 maValidDateFI
.SetFont( aFnt
);
168 cssu::Reference
< dcss::security::XCertificate
> xCert
= mpDlg
->mxCert
;
170 maIssuedToFI
.SetText( XmlSec::GetContentPart( xCert
->getSubjectName() ) );
171 maIssuedByFI
.SetText( XmlSec::GetContentPart( xCert
->getIssuerName() ) );
173 // dynamic length because of the different languages
174 long nWidth1
= maIssuedToLabelFI
.GetTextWidth( maIssuedToLabelFI
.GetText() );
175 long nWidth2
= maIssuedByLabelFI
.GetTextWidth( maIssuedByLabelFI
.GetText() );
176 long nNewWidth
= Max( nWidth1
, nWidth2
) + 5;
177 Size aNewSize
= maIssuedToLabelFI
.GetSizePixel();
178 aNewSize
.Width() = nNewWidth
;
179 maIssuedToLabelFI
.SetSizePixel( aNewSize
);
180 maIssuedByLabelFI
.SetSizePixel( aNewSize
);
181 long nNewX
= maIssuedToLabelFI
.GetPosPixel().X() + nNewWidth
+ 1;
182 Point aNewPos
= maIssuedToFI
.GetPosPixel();
184 maIssuedToFI
.SetPosPixel( aNewPos
);
185 aNewPos
= maIssuedByFI
.GetPosPixel();
187 maIssuedByFI
.SetPosPixel( aNewPos
);
188 nNewWidth
= maValidDateFI
.GetSizePixel().Width() - nNewX
;
189 aNewSize
= maIssuedToFI
.GetSizePixel();
190 aNewSize
.Width() = nNewWidth
;
191 maIssuedToFI
.SetSizePixel( aNewSize
);
192 maIssuedByFI
.SetSizePixel( aNewSize
);
194 DateTime aDateTimeStart
;
195 DateTime aDateTimeEnd
;
196 utl::typeConvert( xCert
->getNotValidBefore(), aDateTimeStart
);
197 utl::typeConvert( xCert
->getNotValidAfter(), aDateTimeEnd
);
198 String sText
= maValidDateFI
.GetText();
199 sText
.SearchAndReplace( String::CreateFromAscii( "%SDATE%" ),
200 GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeStart
.GetDate() ) );
201 sText
.SearchAndReplace( String::CreateFromAscii( "%EDATE%" ),
202 GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeEnd
.GetDate() ) );
203 maValidDateFI
.SetText( sText
);
205 // adjust position of fixed text depending on image sizes
206 ShrinkToFit( maCertImg
);
207 ShrinkToFit( maKeyImg
);
208 XmlSec::AlignAfterImage( maCertImg
, maCertInfoFI
, 12 );
209 XmlSec::AlignAfterImage( maKeyImg
, maHintCorrespPrivKeyFI
, 12 );
211 // Check if we have the private key...
212 BOOL bHasPrivateKey
= FALSE
;
213 // #i41270# Check only if we have that certificate in our security environment
214 if ( _pDlg
->mbCheckForPrivateKey
)
216 long nCertificateCharacters
= _pDlg
->mxSecurityEnvironment
->getCertificateCharacters( xCert
);
217 bHasPrivateKey
= ( nCertificateCharacters
& security::CertificateCharacters::HAS_PRIVATE_KEY
) ? TRUE
: FALSE
;
219 if ( !bHasPrivateKey
)
222 maHintCorrespPrivKeyFI
.Hide();
226 void CertificateViewerGeneralTP::ActivatePage()
232 struct Details_UserDatat
235 bool mbFixedWidthFont
;
237 inline Details_UserDatat( const String
& _rTxt
, bool _bFixedWidthFont
);
240 inline Details_UserDatat::Details_UserDatat( const String
& _rTxt
, bool _bFixedWidthFont
)
242 ,mbFixedWidthFont ( _bFixedWidthFont
)
247 void CertificateViewerDetailsTP::Clear( void )
249 maElementML
.SetText( String() );
251 SvLBoxEntry
* pEntry
= maElementsLB
.GetEntry( i
);
254 delete ( Details_UserDatat
* ) pEntry
->GetUserData();
256 pEntry
= maElementsLB
.GetEntry( i
);
259 maElementsLB
.Clear();
262 void CertificateViewerDetailsTP::InsertElement( const String
& _rField
, const String
& _rValue
,
263 const String
& _rDetails
, bool _bFixedWidthFont
)
265 SvLBoxEntry
* pEntry
= maElementsLB
.InsertEntry( _rField
);
266 maElementsLB
.SetEntryText( _rValue
, pEntry
, 1 );
267 pEntry
->SetUserData( ( void* ) new Details_UserDatat( _rDetails
, _bFixedWidthFont
) );
270 CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window
* _pParent
, CertificateViewer
* _pDlg
)
271 :CertificateViewerTP ( _pParent
, XMLSEC_RES( RID_XMLSECTP_DETAILS
), _pDlg
)
272 ,maElementsLB ( this, XMLSEC_RES( LB_ELEMENTS
) )
273 ,maElementML ( this, XMLSEC_RES( ML_ELEMENT
) )
274 ,maStdFont ( maElementML
.GetControlFont() )
275 ,maFixedWidthFont ( OutputDevice::GetDefaultFont( DEFAULTFONT_UI_FIXED
, LANGUAGE_DONTKNOW
, DEFAULTFONT_FLAGS_ONLYONE
, this ) )
277 WinBits nStyle
= maElementsLB
.GetStyle();
278 nStyle
&= ~WB_HSCROLL
;
279 maElementsLB
.SetStyle( nStyle
);
281 maFixedWidthFont
.SetHeight( maStdFont
.GetHeight() );
283 static long nTabs
[] = { 2, 0, 30*CS_LB_WIDTH
/100 };
284 maElementsLB
.SetTabs( &nTabs
[ 0 ] );
285 maElementsLB
.InsertHeaderEntry( String( XMLSEC_RES( STR_HEADERBAR
) ) );
288 Reference
< security::XCertificate
> xCert
= mpDlg
->mxCert
;
289 UINT16 nLineBreak
= 16;
290 const char* pHexSep
= " ";
293 // --> PB 2004-10-11 #i35107# - 0 == "V1", 1 == "V2", ..., n = "V(n+1)"
294 aLBEntry
= String::CreateFromAscii( "V" );
295 aLBEntry
+= String::CreateFromInt32( xCert
->getVersion() + 1 );
297 InsertElement( String( XMLSEC_RES( STR_VERSION
) ), aLBEntry
, aLBEntry
);
298 Sequence
< sal_Int8
> aSeq
= xCert
->getSerialNumber();
299 aLBEntry
= XmlSec::GetHexString( aSeq
, pHexSep
);
300 aDetails
= XmlSec::GetHexString( aSeq
, pHexSep
, nLineBreak
);
301 InsertElement( String( XMLSEC_RES( STR_SERIALNUM
) ), aLBEntry
, aDetails
, true );
303 std::pair
< ::rtl::OUString
, ::rtl::OUString
> pairIssuer
=
304 XmlSec::GetDNForCertDetailsView(xCert
->getIssuerName());
305 aLBEntry
= pairIssuer
.first
;
306 aDetails
= pairIssuer
.second
;
307 InsertElement( String( XMLSEC_RES( STR_ISSUER
) ), aLBEntry
, aDetails
);
309 aSeq = xCert->getIssuerUniqueID();
310 aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
311 aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
312 InsertElement( String( XMLSEC_RES( STR_ISSUER_ID ) ), aLBEntry, aDetails, true );
316 utl::typeConvert( xCert
->getNotValidBefore(), aDateTime
);
317 aLBEntry
= GetSettings().GetUILocaleDataWrapper().getDate( aDateTime
.GetDate() );
318 aLBEntry
+= String::CreateFromAscii( " " );
319 aLBEntry
+= GetSettings().GetUILocaleDataWrapper().getTime( aDateTime
.GetTime() );
320 InsertElement( String( XMLSEC_RES( STR_VALIDFROM
) ), aLBEntry
, aLBEntry
);
321 utl::typeConvert( xCert
->getNotValidAfter(), aDateTime
);
322 aLBEntry
= GetSettings().GetUILocaleDataWrapper().getDate( aDateTime
.GetDate() );
323 aLBEntry
+= String::CreateFromAscii( " " );
324 aLBEntry
+= GetSettings().GetUILocaleDataWrapper().getTime( aDateTime
.GetTime() );
325 InsertElement( String( XMLSEC_RES( STR_VALIDTO
) ), aLBEntry
, aLBEntry
);
327 std::pair
< ::rtl::OUString
, ::rtl::OUString
> pairSubject
=
328 XmlSec::GetDNForCertDetailsView(xCert
->getSubjectName());
329 aLBEntry
= pairSubject
.first
;
330 aDetails
= pairSubject
.second
;
331 InsertElement( String( XMLSEC_RES( STR_SUBJECT
) ), aLBEntry
, aDetails
);
333 aSeq = xCert->getSubjectUniqueID();
334 aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
335 aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
336 InsertElement( String( XMLSEC_RES( STR_SUBJECT_ID ) ), aLBEntry, aDetails, true );
338 aLBEntry
= aDetails
= xCert
->getSubjectPublicKeyAlgorithm();
339 InsertElement( String( XMLSEC_RES( STR_SUBJECT_PUBKEY_ALGO
) ), aLBEntry
, aDetails
);
340 aSeq
= xCert
->getSubjectPublicKeyValue();
341 aLBEntry
= XmlSec::GetHexString( aSeq
, pHexSep
);
342 aDetails
= XmlSec::GetHexString( aSeq
, pHexSep
, nLineBreak
);
343 InsertElement( String( XMLSEC_RES( STR_SUBJECT_PUBKEY_VAL
) ), aLBEntry
, aDetails
, true );
345 aLBEntry
= aDetails
= xCert
->getSignatureAlgorithm();
346 InsertElement( String( XMLSEC_RES( STR_SIGNATURE_ALGO
) ), aLBEntry
, aDetails
);
348 aSeq
= xCert
->getSHA1Thumbprint();
349 aLBEntry
= XmlSec::GetHexString( aSeq
, pHexSep
);
350 aDetails
= XmlSec::GetHexString( aSeq
, pHexSep
, nLineBreak
);
351 InsertElement( String( XMLSEC_RES( STR_THUMBPRINT_SHA1
) ), aLBEntry
, aDetails
, true );
353 aSeq
= xCert
->getMD5Thumbprint();
354 aLBEntry
= XmlSec::GetHexString( aSeq
, pHexSep
);
355 aDetails
= XmlSec::GetHexString( aSeq
, pHexSep
, nLineBreak
);
356 InsertElement( String( XMLSEC_RES( STR_THUMBPRINT_MD5
) ), aLBEntry
, aDetails
, true );
360 maElementsLB
.SetSelectHdl( LINK( this, CertificateViewerDetailsTP
, ElementSelectHdl
) );
363 CertificateViewerDetailsTP::~CertificateViewerDetailsTP()
368 void CertificateViewerDetailsTP::ActivatePage()
372 IMPL_LINK( CertificateViewerDetailsTP
, ElementSelectHdl
, void*, EMPTYARG
)
374 SvLBoxEntry
* pEntry
= maElementsLB
.FirstSelected();
376 bool bFixedWidthFont
;
379 const Details_UserDatat
* p
= ( Details_UserDatat
* ) pEntry
->GetUserData();
380 aElementText
= p
->maTxt
;
381 bFixedWidthFont
= p
->mbFixedWidthFont
;
384 bFixedWidthFont
= false;
386 maElementML
.SetFont( bFixedWidthFont
? maFixedWidthFont
: maStdFont
);
387 maElementML
.SetControlFont( bFixedWidthFont
? maFixedWidthFont
: maStdFont
);
388 maElementML
.SetText( aElementText
);
393 struct CertPath_UserData
395 cssu::Reference
< dcss::security::XCertificate
> mxCert
;
399 CertPath_UserData( cssu::Reference
< dcss::security::XCertificate
> xCert
, bool bValid
):
407 CertificateViewerCertPathTP::CertificateViewerCertPathTP( Window
* _pParent
, CertificateViewer
* _pDlg
)
408 :CertificateViewerTP ( _pParent
, XMLSEC_RES( RID_XMLSECTP_CERTPATH
), _pDlg
)
409 ,maCertPathFT ( this, XMLSEC_RES( FT_CERTPATH
) )
410 ,maCertPathLB ( this, XMLSEC_RES( LB_SIGNATURES
) )
411 ,maViewCertPB ( this, XMLSEC_RES( BTN_VIEWCERT
) )
412 ,maCertStatusFT ( this, XMLSEC_RES( FT_CERTSTATUS
) )
413 ,maCertStatusML ( this, XMLSEC_RES( ML_CERTSTATUS
) )
415 ,mbFirstActivateDone ( false )
416 ,maCertImage ( XMLSEC_RES( IMG_CERT_SMALL
) )
417 ,maCertNotValidatedImage( XMLSEC_RES( IMG_CERT_NOTVALIDATED_SMALL
) )
418 ,msCertOK ( XMLSEC_RES( STR_PATH_CERT_OK
) )
419 ,msCertNotValidated ( XMLSEC_RES( STR_PATH_CERT_NOT_VALIDATED
) )
422 if ( GetSettings().GetStyleSettings().GetHighContrastMode() )
424 maCertImage
= Image( XMLSEC_RES( IMG_CERT_SMALL_HC
) );
425 maCertNotValidatedImage
= Image( XMLSEC_RES( IMG_CERT_NOTVALIDATED_SMALL_HC
) );
430 maCertPathLB
.SetNodeDefaultImages();
431 maCertPathLB
.SetSublistOpenWithLeftRight();
432 maCertPathLB
.SetSelectHdl( LINK( this, CertificateViewerCertPathTP
, CertSelectHdl
) );
433 maViewCertPB
.SetClickHdl( LINK( this, CertificateViewerCertPathTP
, ViewCertHdl
) );
435 // check if buttontext is to wide
436 const long nOffset
= 10;
437 String sText
= maViewCertPB
.GetText();
438 long nTxtW
= maViewCertPB
.GetTextWidth( sText
);
439 if ( sText
.Search( '~' ) == STRING_NOTFOUND
)
441 long nBtnW
= maViewCertPB
.GetSizePixel().Width();
444 // broaden the button
445 long nDelta
= nTxtW
- nBtnW
;
446 Size aNewSize
= maViewCertPB
.GetSizePixel();
447 aNewSize
.Width() += nDelta
;
448 maViewCertPB
.SetSizePixel( aNewSize
);
449 // and give it a new position
450 Point aNewPos
= maViewCertPB
.GetPosPixel();
451 aNewPos
.X() -= nDelta
;
452 maViewCertPB
.SetPosPixel( aNewPos
);
456 CertificateViewerCertPathTP::~CertificateViewerCertPathTP()
461 void CertificateViewerCertPathTP::ActivatePage()
463 if ( !mbFirstActivateDone
)
465 mbFirstActivateDone
= true;
466 Sequence
< Reference
< security::XCertificate
> > aCertPath
=
467 mpParent
->mxSecurityEnvironment
->buildCertificatePath( mpParent
->mxCert
);
468 const Reference
< security::XCertificate
>* pCertPath
= aCertPath
.getConstArray();
471 sal_Int32 i
, nCnt
= aCertPath
.getLength();
472 SvLBoxEntry
* pParent
= NULL
;
475 const Reference
< security::XCertificate
> rCert
= pCertPath
[ --i
];
476 String sName
= XmlSec::GetContentPart( rCert
->getSubjectName() );
477 //Verify the certificate
478 sal_Int32 certStatus
= mpDlg
->mxSecurityEnvironment
->verifyCertificate(rCert
,
479 Sequence
<Reference
<css::security::XCertificate
> >());
480 bool bCertValid
= certStatus
== css::security::CertificateValidity::VALID
? true : false;
481 pParent
= InsertCert( pParent
, sName
, rCert
, bCertValid
);
484 maCertPathLB
.Select( pParent
);
485 maViewCertPB
.Disable(); // Own certificate selected
489 maCertPathLB
.Expand( pParent
);
490 pParent
= maCertPathLB
.GetParent( pParent
);
493 CertSelectHdl( NULL
);
497 IMPL_LINK( CertificateViewerCertPathTP
, ViewCertHdl
, void*, EMPTYARG
)
499 SvLBoxEntry
* pEntry
= maCertPathLB
.FirstSelected();
502 CertificateViewer
aViewer( this, mpDlg
->mxSecurityEnvironment
, ((CertPath_UserData
*)pEntry
->GetUserData())->mxCert
, FALSE
);
509 IMPL_LINK( CertificateViewerCertPathTP
, CertSelectHdl
, void*, EMPTYARG
)
512 SvLBoxEntry
* pEntry
= maCertPathLB
.FirstSelected();
515 CertPath_UserData
* pData
= (CertPath_UserData
*) pEntry
->GetUserData();
517 sStatus
= pData
->mbValid
? msCertOK
: msCertNotValidated
;
520 maCertStatusML
.SetText( sStatus
);
521 maViewCertPB
.Enable( pEntry
&& ( pEntry
!= maCertPathLB
.Last() ) );
525 void CertificateViewerCertPathTP::Clear( void )
527 maCertStatusML
.SetText( String() );
529 SvLBoxEntry
* pEntry
= maCertPathLB
.GetEntry( i
);
532 delete ( CertPath_UserData
* ) pEntry
->GetUserData();
534 pEntry
= maCertPathLB
.GetEntry( i
);
537 maCertPathLB
.Clear();
540 SvLBoxEntry
* CertificateViewerCertPathTP::InsertCert(
541 SvLBoxEntry
* _pParent
, const String
& _rName
, cssu::Reference
< dcss::security::XCertificate
> rxCert
,
544 Image aImage
= bValid
? maCertImage
: maCertNotValidatedImage
;
545 SvLBoxEntry
* pEntry
= maCertPathLB
.InsertEntry( _rName
, aImage
, aImage
, _pParent
);
546 pEntry
->SetUserData( ( void* ) new CertPath_UserData( rxCert
, bValid
) );