summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2005-03-29 12:34:00 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2005-03-29 12:34:00 +0000
commita947294fb5b70f4f6b3bf47974e31f1ba164f3f0 (patch)
treea4925b3e2fdba5e59a88d189aace4c4823f990b9 /xmlsecurity
parent4bc7c2cfc4e89664eccacd13d17d65c3ff74b934 (diff)
INTEGRATION: CWS xmlsec10 (1.2.38); FILE MERGED
2005/03/29 09:26:41 mmi 1.2.38.1: idl review Issue number: Submitted by: Reviewed by:
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/tools/standalone/mscsfit/signer.cxx15
-rw-r--r--xmlsecurity/tools/standalone/mscsfit/verifier.cxx18
2 files changed, 25 insertions, 8 deletions
diff --git a/xmlsecurity/tools/standalone/mscsfit/signer.cxx b/xmlsecurity/tools/standalone/mscsfit/signer.cxx
index 0945442f2551..3c871ddc9ad4 100644
--- a/xmlsecurity/tools/standalone/mscsfit/signer.cxx
+++ b/xmlsecurity/tools/standalone/mscsfit/signer.cxx
@@ -267,7 +267,7 @@ int SAL_CALL main( int argc, char **argv )
"Signer - "
"Cannot get interface of \"XXMLSecurityContext\" from service \"xsec.XMLSecurityContext\"" ) ;
- xSecCtx->setSecurityEnvironment( xSecEnv ) ;
+ xSecCtx->addSecurityEnvironment( xSecEnv ) ;
//Generate XML signature
Reference< XInterface > xmlsigner =
@@ -282,10 +282,21 @@ int SAL_CALL main( int argc, char **argv )
"Cannot get interface of \"XXMLSignature\" from service \"xsec.XMLSignature\"" ) ;
//perform signature
- xTemplate = xSigner->generate( xTemplate , xSecCtx ) ;
+ xTemplate = xSigner->generate( xTemplate , xSecEnv ) ;
OSL_ENSURE( xTemplate.is() ,
"Signer - "
"Cannot generate the xml signature" ) ;
+
+ SecurityOperationStatus m_nStatus = xTemplate->getStatus();
+
+ if (m_nStatus == SecurityOperationStatus_OPERATION_SUCCEEDED)
+ {
+ fprintf( stdout, "Operation succeeds.\n") ;
+ }
+ else
+ {
+ fprintf( stdout, "Operation fails.\n") ;
+ }
} catch( Exception& e ) {
fprintf( stderr , "Error Message: %s\n" , OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).getStr() ) ;
goto done ;
diff --git a/xmlsecurity/tools/standalone/mscsfit/verifier.cxx b/xmlsecurity/tools/standalone/mscsfit/verifier.cxx
index 7506fb03d976..3afd7cee47a2 100644
--- a/xmlsecurity/tools/standalone/mscsfit/verifier.cxx
+++ b/xmlsecurity/tools/standalone/mscsfit/verifier.cxx
@@ -267,7 +267,7 @@ int SAL_CALL main( int argc, char **argv )
"Verifier - "
"Cannot get interface of \"XXMLSecurityContext\" from service \"xsec.XMLSecurityContext\"" ) ;
- xSecCtx->setSecurityEnvironment( xSecEnv ) ;
+ xSecCtx->addSecurityEnvironment( xSecEnv ) ;
//Generate XML signature
Reference< XInterface > xmlsigner =
@@ -283,11 +283,17 @@ int SAL_CALL main( int argc, char **argv )
//perform validation
- sal_Bool valid = xSigner->validate( xTemplate , xSecCtx ) ;
- if( !valid ) {
- printf( "Signature is INVALID!\n" ) ;
- } else {
- printf( "Signature is VALID!\n" ) ;
+ xTemplate = xSigner->validate( xTemplate , xSecCtx ) ;
+
+ com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus = xTemplate->getStatus();
+
+ if (m_nStatus == SecurityOperationStatus_OPERATION_SUCCEEDED)
+ {
+ fprintf( stdout, "Operation succeeds.\n") ;
+ }
+ else
+ {
+ fprintf( stdout, "Operation fails.\n") ;
}
} catch( Exception& e ) {
fprintf( stderr , "Error Message: %s\n" , OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).getStr() ) ;