diff options
author | Michael Mi <mmi@openoffice.org> | 2004-07-23 07:46:47 +0000 |
---|---|---|
committer | Michael Mi <mmi@openoffice.org> | 2004-07-23 07:46:47 +0000 |
commit | 4f4e9ada797f248a8e84ffffef743fe316073358 (patch) | |
tree | 2d4d087c59cf53c17ce0d811d36778e5169c496e | |
parent | 4bcf58803bc7c10254da90cd44ad89eccbf8bd16 (diff) |
Issue number:
Submitted by: Andrew Fan
Reviewed by:
-rw-r--r-- | xmlsecurity/tools/standalone/csfit/certmngr.cxx | 16 | ||||
-rw-r--r-- | xmlsecurity/tools/standalone/csfit/signer.cxx | 27 |
2 files changed, 33 insertions, 10 deletions
diff --git a/xmlsecurity/tools/standalone/csfit/certmngr.cxx b/xmlsecurity/tools/standalone/csfit/certmngr.cxx index d4623c9c9c96..5232b71a4a8d 100644 --- a/xmlsecurity/tools/standalone/csfit/certmngr.cxx +++ b/xmlsecurity/tools/standalone/csfit/certmngr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: certmngr.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mmi $ $Date: 2004-07-19 11:37:11 $ + * last change: $Author: mmi $ $Date: 2004-07-23 08:46:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -101,7 +101,7 @@ extern OUString bigIntegerToNumericString( Sequence< sal_Int8 > serial ) ; int SAL_CALL main( int argc, char **argv ) { CERTCertDBHandle* certHandle ; - PK11SlotInfo* slot = NULL ; + PK11SlotInfo* slot ; if( argc != 3 ) { fprintf( stderr, "Usage: %s < CertDir > <rdb file>\n\n" , argv[0] ) ; @@ -109,6 +109,7 @@ int SAL_CALL main( int argc, char **argv ) } for( ; getchar() != 'q' ; ) { + slot = NULL ; //Initialize NSPR and NSS PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1 ) ; @@ -121,6 +122,15 @@ int SAL_CALL main( int argc, char **argv ) certHandle = CERT_GetDefaultCertDB() ; slot = PK11_GetInternalKeySlot() ; + if( PK11_NeedLogin( slot ) ) { + SECStatus nRet = PK11_Authenticate( slot, PR_TRUE, NULL ); + if( nRet != SECSuccess ) { + fprintf( stderr , "### cannot authehticate the crypto token!\n" ) ; + goto done ; + } + } + + try { Reference< XMultiComponentFactory > xManager = NULL ; Reference< XComponentContext > xContext = NULL ; diff --git a/xmlsecurity/tools/standalone/csfit/signer.cxx b/xmlsecurity/tools/standalone/csfit/signer.cxx index e0273efe2f33..4eb5e3c628d4 100644 --- a/xmlsecurity/tools/standalone/csfit/signer.cxx +++ b/xmlsecurity/tools/standalone/csfit/signer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: signer.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mmi $ $Date: 2004-07-15 08:22:31 $ + * last change: $Author: mmi $ $Date: 2004-07-23 08:46:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,24 +108,29 @@ using namespace ::com::sun::star::xml::crypto ; int SAL_CALL main( int argc, char **argv ) { CERTCertDBHandle* certHandle ; - PK11SlotInfo* slot = NULL ; - xmlDocPtr doc = NULL ; + PK11SlotInfo* slot ; + xmlDocPtr doc ; xmlNodePtr tplNode ; xmlNodePtr tarNode ; xmlAttrPtr idAttr ; xmlChar* idValue ; xmlAttrPtr uriAttr ; xmlChar* uriValue ; - OUString* uri = NULL ; + OUString* uri ; Reference< XUriBinding > xUriBinding ; - FILE* dstFile = NULL ; + FILE* dstFile ; if( argc != 5 ) { fprintf( stderr, "Usage: %s < CertDir > <file_url of template> <file_url of result> <rdb file>\n\n" , argv[0] ) ; return 1 ; } - for( int hhh = 0 ; hhh < 2 ; hhh ++ ) { + for( int hhh = 0 ; hhh < 10 ; hhh ++ ) { + slot = NULL ; + doc = NULL ; + uri = NULL ; + dstFile = NULL ; + //Init libxml and libxslt libraries xmlInitParser(); @@ -149,6 +154,14 @@ int SAL_CALL main( int argc, char **argv ) certHandle = CERT_GetDefaultCertDB() ; slot = PK11_GetInternalKeySlot() ; + if( PK11_NeedLogin( slot ) ) { + SECStatus nRet = PK11_Authenticate( slot, PR_TRUE, NULL ); + if( nRet != SECSuccess ) { + fprintf( stderr , "### cannot authehticate the crypto token!\n" ) ; + goto done ; + } + } + //Load XML document doc = xmlParseFile( argv[2] ) ; if( doc == NULL || xmlDocGetRootElement( doc ) == NULL ) { |