Kaydet (Commit) 5bc49bbb authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS xmlsec08 (1.20.10); FILE MERGED

2005/02/02 13:04:22 mt 1.20.10.2: #i41276# Don't crash when security framework can't be initialized
2005/01/20 03:34:23 mmi 1.20.10.1: smartcard support
Issue number:  38448
Submitted by:
Reviewed by:
üst 379fcb7b
......@@ -2,9 +2,9 @@
*
* $RCSfile: xmlsignaturehelper.cxx,v $
*
* $Revision: 1.20 $
* $Revision: 1.21 $
*
* last change: $Author: hr $ $Date: 2004-11-27 12:59:35 $
* last change: $Author: vg $ $Date: 2005-03-10 18:08:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -111,59 +111,8 @@ bool XMLSignatureHelper::Init( const rtl::OUString& rTokenPath )
ImplCreateSEInitializer();
rtl::OUString aTokenPath = rTokenPath;
//MM : search for the default profile
/*
if( tokenPath.getLength() == 0 )
{
rtl::OUString aDefaultCryptokenFileName = rtl::OUString::createFromAscii("cryptoken.default");
SvFileStream* pStream = new SvFileStream( aDefaultCryptokenFileName, STREAM_READ );
if (pStream != NULL)
{
pStream->Seek( STREAM_SEEK_TO_END );
ULONG nBytes = pStream->Tell();
if (nBytes > 0)
{
pStream->Seek( STREAM_SEEK_TO_BEGIN );
SvLockBytesRef xLockBytes = new SvLockBytes( pStream, TRUE );
uno::Reference< io::XInputStream > xInputStream = new utl::OInputStreamHelper( xLockBytes, nBytes );
if (xInputStream.is())
{
uno::Sequence< sal_Int8 > tokenFileName( 1024 );
int numbers = xInputStream->readBytes( tokenFileName, 1024 );
const sal_Int8* readBytes = ( const sal_Int8* )tokenFileName.getArray();
sal_Char cToken[1024];
for (int i=0; i<numbers; i++)
{
cToken[i] = (sal_Char)(*(readBytes+i));
}
xInputStream->closeInput();
while (cToken[numbers-1] == 0x0a || cToken[numbers-1] == 0x0d ) numbers--;
tokenPath = rtl::OStringToOUString(rtl::OString((const sal_Char*)cToken, numbers), RTL_TEXTENCODING_UTF8);
}
}
}
}
*/
/*
#ifndef WNT
// MT: HACK for testing
if ( !aTokenPath.getLength() )
aTokenPath = rtl::OUString::createFromAscii("/tmp/nss");
#endif
*/
mxSecurityContext = mxSEInitializer->createSecurityContext( aTokenPath );
if ( mxSEInitializer.is() )
mxSecurityContext = mxSEInitializer->createSecurityContext( rTokenPath );
return mxSecurityContext.is();
}
......@@ -229,6 +178,19 @@ void XMLSignatureHelper::SetX509Certificate(
ouX509SerialNumber);
}
void XMLSignatureHelper::SetX509Certificate(
sal_Int32 nSecurityId,
const sal_Int32 nSecurityEnvironmentIndex,
const rtl::OUString& ouX509IssuerName,
const rtl::OUString& ouX509SerialNumber)
{
mpXSecController->setX509Certificate(
nSecurityId,
nSecurityEnvironmentIndex,
ouX509IssuerName,
ouX509SerialNumber);
}
void XMLSignatureHelper::SetDateTime( sal_Int32 nSecurityId, const Date& rDate, const Time& rTime )
{
/*
......@@ -458,6 +420,17 @@ uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > XMLSignatu
return (mxSecurityContext.is()?(mxSecurityContext->getSecurityEnvironment()): uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment >());
}
uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > XMLSignatureHelper::GetSecurityEnvironmentByIndex(sal_Int32 nId)
{
return (mxSecurityContext.is()?(mxSecurityContext->getSecurityEnvironmentByIndex(nId)): uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment >());
}
sal_Int32 XMLSignatureHelper::GetSecurityEnvironmentNumber()
{
return (mxSecurityContext.is()?(mxSecurityContext->getSecurityEnvironmentNumber()): 0);
}
/*
void XMLSignatureHelper::createSecurityContext( rtl::OUString tokenPath )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment