You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by mi...@apache.org on 2005/02/18 11:04:16 UTC

cvs commit: xml-security/c/src/enc/WinCAPI WinCAPICryptoProvider.cpp WinCAPICryptoProvider.hpp

milan       2005/02/18 02:04:16

  Modified:    c/src/enc/WinCAPI WinCAPICryptoProvider.cpp
                        WinCAPICryptoProvider.hpp
  Log:
  XSEC doesn't work if user doesn't have admin rights fix.
  
  Revision  Changes    Path
  1.16      +8 -7      xml-security/c/src/enc/WinCAPI/WinCAPICryptoProvider.cpp
  
  Index: WinCAPICryptoProvider.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/enc/WinCAPI/WinCAPICryptoProvider.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WinCAPICryptoProvider.cpp	3 Feb 2005 13:20:37 -0000	1.15
  +++ WinCAPICryptoProvider.cpp	18 Feb 2005 10:04:16 -0000	1.16
  @@ -46,14 +46,15 @@
   static char s_xsecKeyStoreName[] = "ApacheXML-SecurityKeyStore";
   
   WinCAPICryptoProvider::WinCAPICryptoProvider(
  -						LPCSTR provDSSName, 
  -						LPCSTR provRSAName) {
  +						LPCSTR provDSSName,
  +						LPCSTR provRSAName,
  +            DWORD dwFlags) {
   
   	if (!CryptAcquireContext(&m_provDSS,
   		NULL,
   		provDSSName,
   		PROV_DSS,
  -		CRYPT_VERIFYCONTEXT)) 
  +		CRYPT_VERIFYCONTEXT))
   	{
   		throw XSECException(XSECException::InternalError,
   			"WinCAPICryptoProvider() - Error obtaining default PROV_DSS");
  @@ -105,15 +106,15 @@
   		s_xsecKeyStoreName,
   		provRSAName,
   		m_provRSAType,
  -		CRYPT_MACHINE_KEYSET)) 
  +		dwFlags)) 
   	{
   
   		// Try to create
   		if (!CryptAcquireContext(&m_provApacheKeyStore,
   			s_xsecKeyStoreName,
   			provRSAName,
  -			PROV_RSA_FULL,
  -			CRYPT_MACHINE_KEYSET | CRYPT_NEWKEYSET)) {
  +			m_provRSAType,
  +			dwFlags | CRYPT_NEWKEYSET)) {
   
   			throw XSECException(XSECException::InternalError,
   				"WinCAPICryptoProvider() - Error obtaining generating internal key store for PROV_RSA_FULL");
  
  
  
  1.16      +17 -15    xml-security/c/src/enc/WinCAPI/WinCAPICryptoProvider.hpp
  
  Index: WinCAPICryptoProvider.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/enc/WinCAPI/WinCAPICryptoProvider.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WinCAPICryptoProvider.hpp	3 Feb 2005 13:20:37 -0000	1.15
  +++ WinCAPICryptoProvider.hpp	18 Feb 2005 10:04:16 -0000	1.16
  @@ -41,20 +41,20 @@
   // For older versions of wincrypt.h
   
   #if !defined (PROV_RSA_AES)
  -#	define PROV_RSA_AES				24
  -#	define ALG_SID_AES_128			14
  -#	define ALG_SID_AES_192			15
  -#	define ALG_SID_AES_256          16
  -#	define ALG_SID_AES              17
  -#	define CALG_AES_128				(ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_128)
  -#	define CALG_AES_192				(ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_192)
  -#	define CALG_AES_256				(ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_256)
  +#	define PROV_RSA_AES      24
  +#	define ALG_SID_AES_128   14
  +#	define ALG_SID_AES_192   15
  +#	define ALG_SID_AES_256   16
  +#	define ALG_SID_AES       17
  +#	define CALG_AES_128      (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_128)
  +#	define CALG_AES_192      (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_192)
  +#	define CALG_AES_256      (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_256)
   #endif
   
  -#define WINCAPI_BLOBHEADERLEN	0x08
  -#define WINCAPI_DSSPUBKEYLEN	0x08
  -#define WINCAPI_DSSSEEDLEN		0x18
  -#define WINCAPI_RSAPUBKEYLEN	0x0C
  +#define WINCAPI_BLOBHEADERLEN   0x08
  +#define WINCAPI_DSSPUBKEYLEN    0x08
  +#define WINCAPI_DSSSEEDLEN      0x18
  +#define WINCAPI_RSAPUBKEYLEN    0x0C
   
   /**
    * @defgroup wincapicrypto Windows Crypto API Interface
  @@ -98,9 +98,11 @@
   	 * Will use the default Windows DSS provider if nothing passed in.
   	 * @param provRSAName RSA provider - must be of type PROV_RSA_FULL.
   	 * Will use the default RSA_FULL provider if nothing passed in
  +         * @param dwFlags If you are running XSEC as service you should specify
  +         * CRYPT_MACHINE_KEYSET here
   	 */
  -	
  -	WinCAPICryptoProvider(LPCSTR provDSSName = NULL, LPCSTR provRSAName = NULL);
  +
  +	WinCAPICryptoProvider(LPCSTR provDSSName = NULL, LPCSTR provRSAName = NULL, DWORD dwFlags = 0);
   
   	virtual ~WinCAPICryptoProvider();