summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2005-04-08 15:20:04 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2005-04-08 15:20:04 +0000
commit11f595567334519f6eefb13a785193866e97c5e4 (patch)
tree3f065242900e4b58216ea89c71222354cd396553 /xmlsecurity
parentfec0cdadefe460288d4eebde991c88a1c5eed66e (diff)
INTEGRATION: CWS xmlsec11 (1.18.2); FILE MERGED
2005/04/06 06:35:38 mt 1.18.2.4: #i46696# KEY_NOT_FOUND can also happen if certificate is not attached... 2005/04/06 05:13:26 mt 1.18.2.3: #i46696# Handle KEY_NOT_FOUND as valid signature... 2005/04/04 18:01:55 mt 1.18.2.2: i46611# Don't keep invalid entries in list box... 2005/04/04 13:06:00 mt 1.18.2.1: #i46611# Don't catch exception too early...
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx32
1 files changed, 19 insertions, 13 deletions
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 4d173e5388bc..2f65146c14e7 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: digitalsignaturesdialog.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: rt $ $Date: 2005-03-29 13:19:21 $
+ * last change: $Author: hr $ $Date: 2005-04-08 16:20:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -348,6 +348,9 @@ IMPL_LINK( DigitalSignaturesDialog, AddButtonHdl, Button*, EMPTYARG )
catch ( uno::Exception& )
{
DBG_ERROR( "Exception while adding a signature!" );
+ // Don't keep invalid entries...
+ ImplGetSignatureInformations();
+ ImplFillSignaturesBox();
}
return 0;
@@ -380,6 +383,9 @@ IMPL_LINK( DigitalSignaturesDialog, RemoveButtonHdl, Button*, EMPTYARG )
catch ( uno::Exception& )
{
DBG_ERROR( "Exception while removing a signature!" );
+ // Don't keep invalid entries...
+ ImplGetSignatureInformations();
+ ImplFillSignaturesBox();
}
}
@@ -411,7 +417,8 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
xCert = xSecEnv->getCertificate( rInfo.ouX509IssuerName, numericStringToBigInteger( rInfo.ouX509SerialNumber ) );
// If we don't get it, create it from signature data:
- if ( !xCert.is() )
+ // MT: Maybe after 2.0: Why not always use the attached certificate?
+ if ( !xCert.is() && rInfo.ouX509Certificate.getLength() )
xCert = xSecEnv->createCertificateFromAscii( rInfo.ouX509Certificate ) ;
DBG_ASSERT( xCert.is(), "Certificate not found and can't be created!" );
@@ -428,8 +435,14 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
}
// New signatures are not verified, must be valid. Status is INIT.
+ // HACK for #i46696#
+ // KEY_NOT_FOUND only happen because of author or issuer certificates are missing in keystore.
+ // We always have the key from authors certificate, because it's attached.
+ // This is a question of trust, not of a *broken* signature.
bool bValid = ( rInfo.nStatus == ::com::sun::star::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED )
- || ( rInfo.nStatus == ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN );
+ || ( rInfo.nStatus == ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN )
+ || ( ( rInfo.nStatus == ::com::sun::star::xml::crypto::SecurityOperationStatus_KEY_NOT_FOUND) && rInfo.ouX509Certificate.getLength());
+
if ( bValid )
{
// Can only be valid if ALL streams are signed, which means real stream count == signed stream count
@@ -494,7 +507,7 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails()
const SignatureInformation& rInfo = maCurrentSignatureInformations[ nSelected ];
// Use Certificate from doc, not from key store
- uno::Reference< dcss::security::XCertificate > xCert = maSignatureHelper.GetSecurityEnvironment()->createCertificateFromAscii( rInfo.ouX509Certificate ) ;
+ uno::Reference< dcss::security::XCertificate > xCert = rInfo.ouX509Certificate.getLength() ? maSignatureHelper.GetSecurityEnvironment()->createCertificateFromAscii( rInfo.ouX509Certificate ) : NULL;
DBG_ASSERT( xCert.is(), "Error getting cCertificate!" );
if ( xCert.is() )
{
@@ -518,14 +531,7 @@ SignatureStreamHelper DigitalSignaturesDialog::ImplOpenSignatureStream( sal_Int3
{
css::uno::Reference < css::io::XTruncate > xTruncate( mxSignatureStream, uno::UNO_QUERY );
DBG_ASSERT( xTruncate.is(), "ImplOpenSignatureStream - Stream does not support xTruncate!" );
- try
- {
- xTruncate->truncate();
- }
- catch ( uno::RuntimeException& )
- {
- DBG_ERROR( "ImplOpenSignatureStream - Error while calling truncate!" );
- }
+ xTruncate->truncate();
}
else
{