summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx')
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx88
1 files changed, 44 insertions, 44 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 71ff13fb3f82..eb9162e8bcb9 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -57,7 +57,7 @@
//CP : added by CP
#include <rtl/locale.h>
-#include <osl/nlsupport.h>
+#include <osl/nlsupport.h>
#include <osl/process.h>
//CP : end
@@ -172,7 +172,7 @@ SecurityEnvironment_MSCryptImpl :: ~SecurityEnvironment_MSCryptImpl() {
for( priKeyIt = m_tPriKeyList.begin() ; priKeyIt != m_tPriKeyList.end() ; priKeyIt ++ )
CryptDestroyKey( *priKeyIt ) ;
}
-
+
}
/* XInitialization */
@@ -223,10 +223,10 @@ Reference< XSingleServiceFactory > SecurityEnvironment_MSCryptImpl :: impl_creat
}
/* XUnoTunnel */
-sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier )
+sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier )
throw( RuntimeException )
{
- if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
+ if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
return ( sal_Int64 )this ;
}
return 0 ;
@@ -318,7 +318,7 @@ void SecurityEnvironment_MSCryptImpl :: setCertDb( HCERTSTORE aCertDb ) throw( E
}
void SecurityEnvironment_MSCryptImpl :: adoptSymKey( HCRYPTKEY aSymKey ) throw( Exception , RuntimeException ) {
- HCRYPTKEY symkey ;
+ HCRYPTKEY symkey ;
std::list< HCRYPTKEY >::iterator keyIt ;
if( aSymKey != NULL ) {
@@ -374,7 +374,7 @@ HCRYPTKEY SecurityEnvironment_MSCryptImpl :: getSymKey( unsigned int position )
}
void SecurityEnvironment_MSCryptImpl :: adoptPubKey( HCRYPTKEY aPubKey ) throw( Exception , RuntimeException ) {
- HCRYPTKEY pubkey ;
+ HCRYPTKEY pubkey ;
std::list< HCRYPTKEY >::iterator keyIt ;
if( aPubKey != NULL ) {
@@ -430,7 +430,7 @@ HCRYPTKEY SecurityEnvironment_MSCryptImpl :: getPubKey( unsigned int position )
}
void SecurityEnvironment_MSCryptImpl :: adoptPriKey( HCRYPTKEY aPriKey ) throw( Exception , RuntimeException ) {
- HCRYPTKEY prikey ;
+ HCRYPTKEY prikey ;
std::list< HCRYPTKEY >::iterator keyIt ;
if( aPriKey != NULL ) {
@@ -456,7 +456,7 @@ void SecurityEnvironment_MSCryptImpl :: adoptPriKey( HCRYPTKEY aPriKey ) throw(
}
void SecurityEnvironment_MSCryptImpl :: rejectPriKey( HCRYPTKEY aPriKey ) throw( Exception , RuntimeException ) {
- HCRYPTKEY prikey ;
+ HCRYPTKEY prikey ;
std::list< HCRYPTKEY >::iterator keyIt ;
if( aPriKey != NULL ) {
@@ -486,7 +486,7 @@ HCRYPTKEY SecurityEnvironment_MSCryptImpl :: getPriKey( unsigned int position )
}
//Methods from XSecurityEnvironment
-Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl :: getPersonalCertificates() throw( SecurityException , RuntimeException )
+Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl :: getPersonalCertificates() throw( SecurityException , RuntimeException )
{
sal_Int32 length ;
X509Certificate_MSCryptImpl* xcert ;
@@ -574,8 +574,8 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl :: getPer
Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( const OUString& issuerName, const Sequence< sal_Int8 >& serialNumber ) throw( SecurityException , RuntimeException ) {
unsigned int i ;
-// sal_Int8 found = 0 ;
- LPSTR pszName ;
+// sal_Int8 found = 0 ;
+ LPSTR pszName ;
X509Certificate_MSCryptImpl *xcert = NULL ;
PCCERT_CONTEXT pCertContext = NULL ;
HCERTSTORE hCertStore = NULL ;
@@ -622,8 +622,8 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( con
//Get the SerialNumber
cryptSerialNumber.cbData = serialNumber.getLength() ;
- cryptSerialNumber.pbData = ( BYTE* )malloc( cryptSerialNumber.cbData);
- if (!cryptSerialNumber.pbData)
+ cryptSerialNumber.pbData = ( BYTE* )malloc( cryptSerialNumber.cbData);
+ if (!cryptSerialNumber.pbData)
{
free( certInfo.Issuer.pbData ) ;
throw RuntimeException() ;
@@ -633,7 +633,7 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( con
certInfo.SerialNumber.cbData = cryptSerialNumber.cbData ;
certInfo.SerialNumber.pbData = cryptSerialNumber.pbData ;
-
+
// Get the Cert from all store.
for( i = 0 ; i < 6 ; i ++ )
{
@@ -668,11 +668,11 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( con
continue;
}
-/*******************************************************************************
- * This code reserved for remind us there are another way to find one cert by
- * IssuerName&serialnumber. You can use the code to replaced the function
+/*******************************************************************************
+ * This code reserved for remind us there are another way to find one cert by
+ * IssuerName&serialnumber. You can use the code to replaced the function
* CertFindCertificateInStore IF and ONLY IF you must find one special cert in
- * certStore but can not be found by CertFindCertificateInStore , then , you
+ * certStore but can not be found by CertFindCertificateInStore , then , you
* should also change the same part in libxmlsec/.../src/mscrypto/x509vfy.c#875.
* By Chandler Peng(chandler.peng@sun.com)
*****/
@@ -680,7 +680,7 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( con
pCertContext = NULL ;
found = 0;
do{
- // 1. enum the certs has same string in the issuer string.
+ // 1. enum the certs has same string in the issuer string.
pCertContext = CertEnumCertificatesInStore( hCertStore , pCertContext ) ;
if( pCertContext != NULL )
{
@@ -694,7 +694,7 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( con
CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG ,
NULL, 0
) ;
-
+
if( cbIssuer == 0 ) continue ; // discard this cert;
issuer = (char *)malloc( cbIssuer ) ;
@@ -720,7 +720,7 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( con
continue ;// discard this cert;
}
- if(strncmp(pszName , issuer , cbIssuer) != 0)
+ if(strncmp(pszName , issuer , cbIssuer) != 0)
{
free( issuer ) ;
continue ;// discard this cert;
@@ -739,7 +739,7 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( con
}
}while(pCertContext);
-
+
if(i != 0 && i != 1) CertCloseStore( hCertStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
if( found != 0 ) break; // Found the certificate.
********************************************************************************/
@@ -752,7 +752,7 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( con
&certInfo,
NULL
) ;
-
+
if(i != 0 && i != 1) CertCloseStore( hCertStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
if( pCertContext != NULL ) break ; // Found the certificate.
@@ -781,9 +781,9 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl :: buildC
PCCERT_CONTEXT pCertContext ;
const X509Certificate_MSCryptImpl* xcert ;
- CERT_ENHKEY_USAGE enhKeyUsage ;
- CERT_USAGE_MATCH certUsage ;
- CERT_CHAIN_PARA chainPara ;
+ CERT_ENHKEY_USAGE enhKeyUsage ;
+ CERT_USAGE_MATCH certUsage ;
+ CERT_CHAIN_PARA chainPara ;
enhKeyUsage.cUsageIdentifier = 0 ;
enhKeyUsage.rgpszUsageIdentifier = NULL ;
@@ -858,7 +858,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl :: buildC
&pChainContext);
if (!bChain)
pChainContext = NULL;
-
+
//Close the additional store
CertCloseStore(hCollectionStore, CERT_CLOSE_STORE_CHECK_FLAG);
}
@@ -965,16 +965,16 @@ HCERTSTORE getCertStoreForIntermediatCerts(
//explicitly that all validation steps are carried out even if one or several
//errors occur. See also
//http://wiki.services.openoffice.org/wiki/Certificate_Path_Validation#Validation_status
-sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate(
+sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate(
const Reference< ::com::sun::star::security::XCertificate >& aCert,
- const Sequence< Reference< ::com::sun::star::security::XCertificate > >& seqCerts)
- throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException )
+ const Sequence< Reference< ::com::sun::star::security::XCertificate > >& seqCerts)
+ throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException )
{
sal_Int32 validity = 0;
PCCERT_CHAIN_CONTEXT pChainContext = NULL;
PCCERT_CONTEXT pCertContext = NULL;
const X509Certificate_MSCryptImpl* xcert = NULL;
-
+
Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY ) ;
if( !xCertTunnel.is() ) {
throw RuntimeException() ;
@@ -988,14 +988,14 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate(
if( xcert == NULL ) {
throw RuntimeException() ;
}
-
+
pCertContext = xcert->getMswcryCert() ;
- CERT_ENHKEY_USAGE enhKeyUsage ;
- CERT_USAGE_MATCH certUsage ;
- CERT_CHAIN_PARA chainPara ;
+ CERT_ENHKEY_USAGE enhKeyUsage ;
+ CERT_USAGE_MATCH certUsage ;
+ CERT_CHAIN_PARA chainPara ;
rtl_zeroMemory(&chainPara, sizeof(CERT_CHAIN_PARA));
-
+
//Prepare parameter for CertGetCertificateChain
enhKeyUsage.cUsageIdentifier = 0 ;
enhKeyUsage.rgpszUsageIdentifier = NULL ;
@@ -1013,7 +1013,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate(
hIntermediateCertsStore =
getCertStoreForIntermediatCerts(seqCerts);
- //Merge m_hCertStore and m_hKeyStore and the store of the intermediate
+ //Merge m_hCertStore and m_hKeyStore and the store of the intermediate
//certificates into one store.
hCollectionStore = CertOpenStore(
CERT_STORE_PROV_COLLECTION ,
@@ -1039,9 +1039,9 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate(
hIntermediateCertsStore,
CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG,
0);
-
+
}
-
+
//CertGetCertificateChain searches by default in MY, CA, ROOT and TRUST
//We do not check revocation of the root. In most cases there are none.
//Then we would get CERT_TRUST_REVOCATION_STATUS_UNKNOWN
@@ -1052,7 +1052,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate(
NULL , //use current system time
hCollectionStore,
&chainPara ,
- CERT_CHAIN_REVOCATION_CHECK_CHAIN | CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT,
+ CERT_CHAIN_REVOCATION_CHECK_CHAIN | CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT,
NULL ,
&pChainContext);
@@ -1167,9 +1167,9 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: getCertificateCharacters( const ::c
//Secondly, make sentence whether or not the cert has a private key.
{
- BOOL fCallerFreeProv ;
- DWORD dwKeySpec ;
- HCRYPTPROV hProv ;
+ BOOL fCallerFreeProv ;
+ DWORD dwKeySpec ;
+ HCRYPTPROV hProv ;
if( CryptAcquireCertificatePrivateKey( pCertContext ,
0 ,
NULL ,