INTEGRATION: CWS xmlsec06 (1.2.2); FILE MERGED

2004/10/12 08:30:53 mmi 1.2.2.1: add error detail information
Issue number:
Submitted by:
Reviewed by:
This commit is contained in:
Rüdiger Timm
2004-11-26 13:58:35 +00:00
parent 0c716fecb0
commit f25279c8ce

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlsignature_mscryptimpl.cxx,v $ * $RCSfile: xmlsignature_mscryptimpl.cxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: mmi $ $Date: 2004-07-23 03:12:26 $ * last change: $Author: rt $ $Date: 2004-11-26 14:58:35 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -87,6 +87,10 @@
#include "xmlstreamio.hxx" #include "xmlstreamio.hxx"
#endif #endif
#ifndef _ERRORCALLBACK_XMLSECIMPL_HXX_
#include "errorcallback.hxx"
#endif
#include "xmlsec/xmlsec.h" #include "xmlsec/xmlsec.h"
#include "xmlsec/xmldsig.h" #include "xmlsec/xmldsig.h"
#include "xmlsec/crypto.h" #include "xmlsec/crypto.h"
@@ -168,10 +172,16 @@ SAL_CALL XMLSignature_MSCryptImpl :: generate(
pMngr = pSecCtxt->keysManager() ; pMngr = pSecCtxt->keysManager() ;
setErrorRecorder( aTemplate );
//Create Signature context //Create Signature context
pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ; pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ;
if( pDsigCtx == NULL ) if( pDsigCtx == NULL )
throw XMLSignatureException() ; {
//throw XMLSignatureException() ;
clearErrorRecorder();
return aTemplate;
}
//Sign the template //Sign the template
if( xmlSecDSigCtxSign( pDsigCtx , pNode ) < 0 ) { if( xmlSecDSigCtxSign( pDsigCtx , pNode ) < 0 ) {
@@ -181,7 +191,9 @@ SAL_CALL XMLSignature_MSCryptImpl :: generate(
if( xUriBinding.is() ) if( xUriBinding.is() )
xmlUnregisterStreamInputCallbacks() ; xmlUnregisterStreamInputCallbacks() ;
throw XMLSignatureException() ; //throw XMLSignatureException() ;
clearErrorRecorder();
return aTemplate;
} }
xmlSecDSigCtxDestroy( pDsigCtx ) ; xmlSecDSigCtxDestroy( pDsigCtx ) ;
@@ -190,12 +202,13 @@ SAL_CALL XMLSignature_MSCryptImpl :: generate(
if( xUriBinding.is() ) if( xUriBinding.is() )
xmlUnregisterStreamInputCallbacks() ; xmlUnregisterStreamInputCallbacks() ;
clearErrorRecorder();
return aTemplate ; return aTemplate ;
} }
/* XXMLSignature */ /* XXMLSignature */
sal_Bool SAL_CALL Reference< XXMLSignatureTemplate >
XMLSignature_MSCryptImpl :: validate( SAL_CALL XMLSignature_MSCryptImpl :: validate(
const Reference< XXMLSignatureTemplate >& aTemplate , const Reference< XXMLSignatureTemplate >& aTemplate ,
const Reference< XXMLSecurityContext >& aSecurityCtx const Reference< XXMLSecurityContext >& aSecurityCtx
) throw( com::sun::star::uno::RuntimeException, ) throw( com::sun::star::uno::RuntimeException,
@@ -204,7 +217,7 @@ XMLSignature_MSCryptImpl :: validate(
xmlSecKeysMngrPtr pMngr = NULL ; xmlSecKeysMngrPtr pMngr = NULL ;
xmlSecDSigCtxPtr pDsigCtx = NULL ; xmlSecDSigCtxPtr pDsigCtx = NULL ;
xmlNodePtr pNode = NULL ; xmlNodePtr pNode = NULL ;
sal_Bool valid ; //sal_Bool valid ;
if( !aTemplate.is() ) if( !aTemplate.is() )
throw RuntimeException() ; throw RuntimeException() ;
@@ -257,11 +270,16 @@ XMLSignature_MSCryptImpl :: validate(
pMngr = pSecCtxt->keysManager() ; pMngr = pSecCtxt->keysManager() ;
setErrorRecorder( aTemplate );
//Create Signature context //Create Signature context
pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ; pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ;
if( pDsigCtx == NULL ) if( pDsigCtx == NULL )
throw XMLSignatureException() ; {
//throw XMLSignatureException() ;
clearErrorRecorder();
return aTemplate;
}
//Verify signature //Verify signature
if( xmlSecDSigCtxVerify( pDsigCtx , pNode ) < 0 ) { if( xmlSecDSigCtxVerify( pDsigCtx , pNode ) < 0 ) {
@@ -271,10 +289,12 @@ XMLSignature_MSCryptImpl :: validate(
if( xUriBinding.is() ) if( xUriBinding.is() )
xmlUnregisterStreamInputCallbacks() ; xmlUnregisterStreamInputCallbacks() ;
throw XMLSignatureException() ; //throw XMLSignatureException() ;
clearErrorRecorder();
return aTemplate;
} }
valid = ( pDsigCtx->status == xmlSecDSigStatusSucceeded ) ; //valid = ( pDsigCtx->status == xmlSecDSigStatusSucceeded ) ;
xmlSecDSigCtxDestroy( pDsigCtx ) ; xmlSecDSigCtxDestroy( pDsigCtx ) ;
@@ -282,7 +302,8 @@ XMLSignature_MSCryptImpl :: validate(
if( xUriBinding.is() ) if( xUriBinding.is() )
xmlUnregisterStreamInputCallbacks() ; xmlUnregisterStreamInputCallbacks() ;
return valid ; clearErrorRecorder();
return aTemplate ;
} }
/* XInitialization */ /* XInitialization */