From 6558932ccb7993089b28bce5ab56093aeb1fced8 Mon Sep 17 00:00:00 2001 From: gt Date: Thu, 15 Jul 2004 05:20:09 +0000 Subject: #i20883# more Details --- xmlsecurity/source/dialogs/certificateviewer.cxx | 65 ++++++++++++++++++---- xmlsecurity/source/dialogs/certificateviewer.src | 40 +++++++++++-- xmlsecurity/source/dialogs/dialogs.hrc | 18 ++++-- .../source/dialogs/digitalsignaturesdialog.cxx | 7 ++- xmlsecurity/source/dialogs/resourcemanager.cxx | 62 +++++++++++++++++++-- xmlsecurity/source/dialogs/resourcemanager.hxx | 11 +++- 6 files changed, 168 insertions(+), 35 deletions(-) (limited to 'xmlsecurity/source/dialogs') diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 466bf213a81d..b7ec2b52198d 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: certificateviewer.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: gt $ $Date: 2004-07-14 11:36:06 $ + * last change: $Author: gt $ $Date: 2004-07-15 06:20:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -298,12 +298,14 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif // fill list box Reference< security::XCertificate > xCert = mpDlg->mxCert; + UINT16 nLineBreak = 16; + const char* pHexSep = " "; String aLBEntry; String aDetails; aLBEntry = aDetails = String::CreateFromInt32( xCert->getVersion() ); InsertElement( String( ResId( STR_VERSION ) ), aLBEntry, aDetails ); - Sequence< sal_Int8 > aSerNumSeq = xCert->getSerialNumber(); - const sal_Int8* pSerNumSeq = aSerNumSeq.getConstArray(); + Sequence< sal_Int8 > aSeq = xCert->getSerialNumber(); +/* const sal_Int8* pSerNumSeq = aSerNumSeq.getConstArray(); int nCnt = aSerNumSeq.getLength(); String aSerNumStr; const char pHexDigs[ 17 ] = "0123456789ABCEDF"; @@ -319,18 +321,48 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif // aSerNumStr.AppendAscii( " " ); aSerNumStr.AppendAscii( pBuffer ); } - InsertElement( String( ResId( STR_SERIALNUM ) ), aSerNumStr, aSerNumStr, true ); + InsertElement( String( ResId( STR_SERIALNUM ) ), aSerNumStr, aSerNumStr, true );*/ + aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); + aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); + InsertElement( String( ResId( STR_SERIALNUM ) ), aLBEntry, aDetails ); // InsertElement( String( ResId( STR_SIGALGORITHM ) ), String::CreateFromAscii( "n/a" ), String() ); + aLBEntry = XmlSec::GetPureContent( xCert->getIssuerName(), ", " ); aDetails = XmlSec::GetPureContent( xCert->getIssuerName(), "\n", true ); InsertElement( String( ResId( STR_ISSUER ) ), aLBEntry, aDetails ); + aSeq = xCert->getIssuerUniqueID(); + aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); + aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); + InsertElement( String( ResId( STR_ISSUER_ID ) ), aLBEntry, aDetails ); + aLBEntry = aDetails = XmlSec::GetDateTimeString( xCert->getNotBefore() ); InsertElement( String( ResId( STR_VALIDFROM ) ), aLBEntry, aDetails ); aLBEntry = aDetails = XmlSec::GetDateTimeString( xCert->getNotAfter() ); InsertElement( String( ResId( STR_VALIDTO ) ), aLBEntry, aDetails ); + aLBEntry = XmlSec::GetPureContent( xCert->getSubjectName(), ", " ); aDetails = XmlSec::GetPureContent( xCert->getSubjectName(), "\n", true ); InsertElement( String( ResId( STR_SUBJECT ) ), aLBEntry, aDetails ); + aSeq = xCert->getSubjectUniqueID(); + aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); + aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); + InsertElement( String( ResId( STR_SUBJECT_ID ) ), aLBEntry, aDetails ); + aLBEntry = aDetails = xCert->getSubjectPublicKeyAlgorithm(); + InsertElement( String( ResId( STR_SUBJECT_PUBKEY_ALGO ) ), aLBEntry, aDetails ); + aSeq = xCert->getSubjectPublicKeyValue(); + aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); + aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); + InsertElement( String( ResId( STR_SUBJECT_PUBKEY_VAL ) ), aLBEntry, aDetails ); + + aLBEntry = aDetails = xCert->getSignatureAlgorithm(); + InsertElement( String( ResId( STR_SIGNATURE_ALGO ) ), aLBEntry, aDetails ); + + aLBEntry = aDetails = xCert->getThumbprintAlgorithm(); + InsertElement( String( ResId( STR_THUMBPRINT_ALGO ) ), aLBEntry, aDetails ); + aSeq = xCert->getThumbprint(); + aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); + aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); + InsertElement( String( ResId( STR_THUMBPRINT ) ), aLBEntry, aDetails ); FreeResource(); @@ -377,15 +409,22 @@ CertificateViewerCertPathTP::CertificateViewerCertPathTP( Window* _pParent, Cert ,maCertStatusML ( this, ResId( ML_CERTSTATUS ) ) { // fill list box + maCertPathLB.SetNodeDefaultImages(); + maCertPathLB.SetSublistOpenWithLeftRight(); + Sequence< Reference< security::XCertificate > > - aCertPath = _pDlg->mxSecurityEnvironment->buildCertificatePath( _pDlg->mxCert ); + aCertPath = _pDlg->mxSecurityEnvironment->buildCertificatePath( _pDlg->mxCert ); const Reference< security::XCertificate >* - pCertPath = aCertPath.getConstArray(); + pCertPath = aCertPath.getConstArray(); - String aCN_Id( String::CreateFromAscii( "CN" ) ); - int nCnt = aCertPath.getLength(); + String aCN_Id( String::CreateFromAscii( "CN" ) ); + String aState; + int nCnt = aCertPath.getLength(); + SvLBoxEntry* pParent = NULL; for( int i = 0 ; i < nCnt ; ++i ) - InsertCert( i, XmlSec::GetContentPart( pCertPath[ i ]->getIssuerName(), aCN_Id ), String::CreateFromInt32( i ) ); + pParent = InsertCert( pParent, XmlSec::GetContentPart( pCertPath[ i ]->getIssuerName(), aCN_Id ), aState ); + + InsertCert( pParent, XmlSec::GetContentPart( _pDlg->mxCert->getIssuerName(), aCN_Id ), aState ); FreeResource(); @@ -428,8 +467,10 @@ void CertificateViewerCertPathTP::Clear( void ) maCertPathLB.Clear(); } -void CertificateViewerCertPathTP::InsertCert( int _nLevel, const String& _rName, const String& _rStatus ) +SvLBoxEntry* CertificateViewerCertPathTP::InsertCert( SvLBoxEntry* _pParent, const String& _rName, const String& _rStatus ) { - SvLBoxEntry* pEntry = maCertPathLB.InsertEntry( _rName ); + SvLBoxEntry* pEntry = maCertPathLB.InsertEntry( _rName, _pParent ); pEntry->SetUserData( ( void* ) new String( _rStatus ) ); + + return pEntry; } diff --git a/xmlsecurity/source/dialogs/certificateviewer.src b/xmlsecurity/source/dialogs/certificateviewer.src index 26ebcf4e0a85..d79fc1711805 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.src +++ b/xmlsecurity/source/dialogs/certificateviewer.src @@ -2,9 +2,9 @@ * * $RCSfile: certificateviewer.src,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: gt $ $Date: 2004-07-14 11:36:06 $ + * last change: $Author: gt $ $Date: 2004-07-15 06:20:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -274,6 +274,11 @@ TabPage RID_XMLSECTP_DETAILS Text = "Issuer"; Text [ en-US ] = "Issuer"; }; + String STR_ISSUER_ID + { + Text = "Issuer"; + Text [ en-US ] = "Issuer Unique ID"; + }; String STR_VALIDFROM { Text = "Valid From"; @@ -289,10 +294,35 @@ TabPage RID_XMLSECTP_DETAILS Text = "Subject"; Text [ en-US ] = "Subject"; }; - String STR_PUBKEY + String STR_SUBJECT_ID + { + Text = "Subject Unique ID"; + Text [ en-US ] = "Subject Unique ID"; + }; + String STR_SUBJECT_PUBKEY_ALGO + { + Text = "Subject Algorithm"; + Text [ en-US ] = "Subject Algorithm"; + }; + String STR_SUBJECT_PUBKEY_VAL + { + Text = "Subject Public Key"; + Text [ en-US ] = "Subject Public Key"; + }; + String STR_SIGNATURE_ALGO + { + Text = "Signature Algorithm"; + Text [ en-US ] = "Signature Algorithm"; + }; + String STR_THUMBPRINT_ALGO + { + Text = "Thumbprint Algorithm"; + Text [ en-US ] = "Thumbprint Algorithm"; + }; + String STR_THUMBPRINT { - Text = "Public Key"; - Text [ en-US ] = "Public Key"; + Text = "Thumbprint"; + Text [ en-US ] = "Thumbprint"; }; }; diff --git a/xmlsecurity/source/dialogs/dialogs.hrc b/xmlsecurity/source/dialogs/dialogs.hrc index eda9da08473a..08b341661f01 100644 --- a/xmlsecurity/source/dialogs/dialogs.hrc +++ b/xmlsecurity/source/dialogs/dialogs.hrc @@ -2,9 +2,9 @@ * * $RCSfile: dialogs.hrc,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:23 $ + * last change: $Author: gt $ $Date: 2004-07-15 06:20:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -246,10 +246,16 @@ #define STR_SERIALNUM 2 #define STR_SIGALGORITHM 3 #define STR_ISSUER 4 -#define STR_VALIDFROM 5 -#define STR_VALIDTO 6 -#define STR_SUBJECT 7 -#define STR_PUBKEY 8 +#define STR_ISSUER_ID 5 +#define STR_VALIDFROM 6 +#define STR_VALIDTO 7 +#define STR_SUBJECT 8 +#define STR_SUBJECT_ID 9 +#define STR_SUBJECT_PUBKEY_ALGO 10 +#define STR_SUBJECT_PUBKEY_VAL 11 +#define STR_SIGNATURE_ALGO 12 +#define STR_THUMBPRINT_ALGO 13 +#define STR_THUMBPRINT 14 // --------- tab page Certificate viewer - Certification Path --------- diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index c1a617c82fab..91aa5af56c3b 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -2,9 +2,9 @@ * * $RCSfile: digitalsignaturesdialog.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mt $ $Date: 2004-07-14 11:05:45 $ + * last change: $Author: gt $ $Date: 2004-07-15 06:20:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -344,7 +344,8 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() { aSubject = XmlSec::GetContentPart( xCert->getSubjectName(), aCN_Id ); aIssuer = XmlSec::GetContentPart( rInfo.ouX509IssuerName, aCN_Id ); - aDateTimeStr = XmlSec::GetDateString( xCert->getNotAfter() ); +// aDateTimeStr = XmlSec::GetDateString( xCert->getNotAfter() ); + aDateTimeStr = XmlSec::GetDateTimeString( rInfo.ouDate, rInfo.ouTime ); } else { diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx index 70f4b75a55e3..96649f4b7fae 100644 --- a/xmlsecurity/source/dialogs/resourcemanager.cxx +++ b/xmlsecurity/source/dialogs/resourcemanager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: resourcemanager.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: gt $ $Date: 2004-07-14 11:36:06 $ + * last change: $Author: gt $ $Date: 2004-07-15 06:20:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,10 +77,10 @@ namespace XmlSec ByteString aName( "xmlsec" ); aName += ByteString::CreateFromInt32( SOLARUPD ); // pResMgr = ResMgr::CreateResMgr( aName.GetBuffer(), Application::GetSettings().GetUILanguage() ); - LanguageType aLang( LANGUAGE_ENGLISH_US ); +// LanguageType aLang( LANGUAGE_ENGLISH_US ); // pResMgr = ResMgr::CreateResMgr( aName.GetBuffer(), aLang ); // MT: Change to Locale - pResMgr = ResMgr::CreateResMgr( aName.GetBuffer()); + pResMgr = ResMgr::CreateResMgr( aName.GetBuffer() ); } return pResMgr; @@ -90,8 +90,9 @@ namespace XmlSec { if( !pInternational ) { - LanguageType aLang( LANGUAGE_ENGLISH_US ); - pInternational = new International( aLang ); +// LanguageType aLang( LANGUAGE_ENGLISH_US ); +// pInternational = new International( aLang ); + pInternational = new International( Application::GetSettings().GetInternational() ); } return pInternational; } @@ -108,6 +109,24 @@ namespace XmlSec return GetInternational()->GetDate( GetDateTime( _rDT ) ); } + String GetDateTimeString( const rtl::OUString& _rDate, const rtl::OUString& _rTime ) + { + Date aDate( + USHORT( String( _rDate, 6, 2 ).ToInt32() ), + USHORT( String( _rDate, 4, 2 ).ToInt32() ), + USHORT( String( _rDate, 0, 4 ).ToInt32() ) ); + Time aTime( + USHORT( String( _rTime, 0, 2 ).ToInt32() ), + USHORT( String( _rTime, 4, 2 ).ToInt32() ), + USHORT( String( _rTime, 6, 2 ).ToInt32() ), +// USHORT( String( _rTime, 8, 2 ).ToInt32() ) ); + 0 ); + String aStr( GetInternational()->GetDate( aDate ) ); + aStr.AppendAscii( " " ); + aStr += GetInternational()->GetTime( aTime ); + return aStr; + } + String GetDateString( const ::com::sun::star::util::DateTime& _rDT ) { return GetInternational()->GetDate( GetDateTime( _rDT ) ); @@ -200,6 +219,37 @@ namespace XmlSec return s; } + + String GetHexString( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep, UINT16 _nLineBreak ) + { + const sal_Int8* pSerNumSeq = _rSeq.getConstArray(); + int nCnt = _rSeq.getLength(); + String aStr; + const char pHexDigs[ 17 ] = "0123456789ABCEDF"; + char pBuffer[ 3 ] = " "; + UINT8 nNum; + UINT16 nBreakStart = _nLineBreak? _nLineBreak : 1; + UINT16 nBreak = nBreakStart; + for( int i = 0 ; i < nCnt ; ++i ) + { + nNum = UINT8( pSerNumSeq[ i ] ); + pBuffer[ 0 ] = pHexDigs[ nNum & 0x0F ]; + nNum >>= 4; + pBuffer[ 1 ] = pHexDigs[ nNum ]; + aStr.AppendAscii( pBuffer ); + + --nBreak; + if( nBreak ) + aStr.AppendAscii( _pSep ); + else + { + nBreak = nBreakStart; + aStr.AppendAscii( "\n" ); + } + } + + return aStr; + } } diff --git a/xmlsecurity/source/dialogs/resourcemanager.hxx b/xmlsecurity/source/dialogs/resourcemanager.hxx index 3b215dfbe7bb..892f9977c81d 100644 --- a/xmlsecurity/source/dialogs/resourcemanager.hxx +++ b/xmlsecurity/source/dialogs/resourcemanager.hxx @@ -2,9 +2,9 @@ * * $RCSfile: resourcemanager.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:24 $ + * last change: $Author: gt $ $Date: 2004-07-15 06:20:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,7 +74,9 @@ #ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ #include #endif - +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include +#endif namespace XmlSec { @@ -83,12 +85,15 @@ namespace XmlSec International* GetInternational( void ); DateTime GetDateTime( const ::com::sun::star::util::DateTime& _rDT ); String GetDateTimeString( const ::com::sun::star::util::DateTime& _rDT ); + String GetDateTimeString( const rtl::OUString& _rDate, const rtl::OUString& _rTime ); String GetDateString( const ::com::sun::star::util::DateTime& _rDT ); String GetPureContent( const String& _rRawString, const char* _pCommaReplacement = ", ", bool _bPreserveId = false ); // strips "CN=" and so from string String GetContentPart( const String& _rRawString, const String& _rPartId ); + + String GetHexString( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep = ":", UINT16 _nLineBreak = 0xFFFF ); } #define XMLSEC_RES(id) ResId(id,XmlSec::GetResMgr()) -- cgit