//默认库 加密算法 
class crypt{
	ctor( provider/*"Microsoft Base Cryptographic Provider v1.0"*/,provType=0x1/*_PROV_RSA_FULL*/ ){ {
			var ret,hCryptProv = AcquireContext( ,/*当前用户*/, provider,provType, 0xF0000000/*_CRYPT_VERIFYCONTEXT*/ || 0x20/*_CRYPT_MACHINE_KEYSET*/);
			if (!ret) {
				ret, hCryptProv = AcquireContext( , /*当前用户*/,provider,provType, 0x8/*_CRYPT_NEWKEYSET*/ || 0x20/*_CRYPT_MACHINE_KEYSET*/);	
			}
			if (!ret) return;
			this.hCryptProv = hCryptProv;
			
			..table.add_gc(this,"release"); 
		};
		
		var m_hKey; 
	}; 
	release = function () {
		this.setKey(null);
		if( this.lastHash ){
			this.lastHash.destroy();
			this.lastHash = null;
		} 
		if (this.hCryptProv ) {
			ReleaseContext(this.hCryptProv , 0);
			this.hCryptProv = null
		} 
	}; 
	setKey = function(hNewKey){
		if( m_hKey ){
			DestroyKey(m_hKey) 
		} 
		m_hKey = hNewKey;
	};
	setPassword = function( str,algid = 0x8003/*_CALG_MD5*/){
		var h,err = this.createHash(algid,str);
		if(!h) return null,err;
		h.deriveKey();
		h.destroy();
		return this;
	};
	createHash = function( algid = 0x8003/*_CALG_MD5*/,data ){ 
		var h,err = hash(this,algid);
		if( !h ) return null,err; 
		if( data ){
			h.hashData(data)
		}
		this.lastHash = h;
		return h;
	};
	createHashByMd2 = function(data) {
		return this.createHash( 0x8001/*_CALG_MD2*/,data);
	};
	createHashByMd4 = function(data) {
		return this.createHash( 0x8002/*_CALG_MD4*/,data);
	};
	createHashByMd5 = function(data) {
		return this.createHash( 0x8003/*_CALG_MD5*/,data);
	};
	createHashBySha1 = function(data) {
		return this.createHash( 0x8004/*_CALG_SHA1*/,data);
	};
	hash = function(data,upper,b16,algId){
		var h = this.createHash( algId,data ); 
		var r = h.getHexValue(upper ); 
		h.destroy();
		if(b16){
			return ..string.sub(r,9,24);
		}
		return r;
	}; 
	hashFile = function(path,upper,algId,bufSize = 0x100000){  
		var h = this.createHash(algId);
		var f,err =  ..io.open(path, "rb");
		if(!f)
			return null,err; 
   	
		do { 
			var data = f.read(bufSize); 
			h.hashData(data);  
		} while ( data );
		f.close(); 
		
		var r = h.getHexValue(upper); 
		h.destroy();
		return r;
	}; 
	allocBuffer = function(size,blockSize=8,str){
		size = ( size - ( size % blockSize) ) + blockSize; 
		this.buffer = ..raw.malloc(size,{BYTE head[]=#str?str:{0}} )
	};
	encrypt = function(str,final=true,hHash,flags=0){
		if( (!this.buffer) || ( #str > #this.buffer) ){
			this.allocBuffer(#str+1000,8,str);
		}
		else { 
			::CopyMemory(this.buffer,str,#str);
		} 
		var ret,len = Encrypt(m_hKey,hHash,final,flags,this.buffer,#str,#this.buffer) 
		if(ret){
			return ..raw.tostring(this.buffer,1,len);
		}
		else{
			if( ::GetLastError() == 0xEA/*_ERROR_MORE_DATA*/ ){
				this.allocBuffer(len);
				return encrypt(str,final,hHash,flags);
			}
		}
	};
	decrypt = function(str,final=true,hHash,flags=0){
		if( (!this.buffer) || ( #str > #this.buffer) ){
			this.allocBuffer(#str,8,str);
		}
		else { 
			::CopyMemory(this.buffer,str,#str);
		} 
		var ret,len = Decrypt(m_hKey,hHash,final,flags,this.buffer,#str ) 
		if(ret){
			return ..raw.tostring(this.buffer,1,len);
		}
	};
};

namespace crypt{
	::Advapi32 := ..raw.loadDll("advapi32.dll");
	AcquireContext = ::Advapi32.api("CryptAcquireContextA", "int(pointer& hProv,str szContainer,str szProvider,INT provType,INT flags)");
	ReleaseContext = ::Advapi32.api("CryptReleaseContext", "int(POINTER hProv, int flags)");  
	DestroyKey = ::Advapi32.api("CryptDestroyKey", "bool(POINTER hKey)");
	Encrypt = ::Advapi32.api("CryptEncrypt", "bool(POINTER hKey,pointer hHash,bool final,INT flags,pointer pbData,INT &pdwDataLen,INT dwBufLen)");
	Decrypt = ::Advapi32.api("CryptDecrypt", "bool(POINTER hKey,pointer hHash,bool final,INT flags,pointer pbData,INT &pdwDataLen)");
  
	import crypt.hash;
	
	md5 = function(data,upper,b16) { 
		return ..crypt().hash( data,upper,b16,0x8003/*_CALG_MD5*/ );   
	}; 
	md2 = function(data,upper,b16) {
		return ..crypt().hash( data,upper,b16,0x8001/*_CALG_MD2*/ );   
	};
	md4 = function(data,upper,b16) {
		return ..crypt().hash( data,upper,b16,0x8002/*_CALG_MD4*/ );   
	};
	sha1 = function(data,upper) {
		return ..crypt().hash( data,upper,b16,0x8004/*_CALG_SHA1*/ );   
	};
}

/**intellisense()
crypt() = !crypt.
crypt(.(CSP名称,CSP类型) = 密码服务对象(CSP).\n所有参数可选,CSP类型使用 _PROV_前缀常量指定
!crypt.createHash() = !crypt_hash.
!crypt.createHashByMd2() = 创建MD2算法哈希对象\n!crypt_hash.
!crypt.createHashByMd4() = 创建MD4算法哈希对象\n!crypt_hash.
!crypt.createHashByMd5() = 创建MD5算法哈希对象\n!crypt_hash.
!crypt.createHashBySha1() = 创建Sha1算法哈希对象\n!crypt_hash.
!crypt.setKey(.(密钥句柄) = 设置新的密钥句柄\n参数为null则删除密钥
!crypt.setPassword("__/*密码*/") = 设置加解密密码\n成功返回密码服务对象(CSP),失败返回null
!crypt.hash(.(字符串,是否大写,返回16位结果,算法) = 计算哈希值,\n除第一个参数以外,其他参数可选\n默认使用MD5算法
!crypt.hashFile(.(文件路径,是否大写,算法) = 计算哈希值,\n除第一个参数以外,其他参数可选\n默认使用MD5算法
!crypt.setPassword() = !crypt.
!crypt.lastHash = 最后一次调用createHashXXX() 系列函数创建的哈希对象
!crypt.decrypt(.(字符串,是否已输入全部数据,哈希对象,选项) = 除第一个参数以外,其他参数都是可选参数\n成功返回解密文本,失败返回空,\n可使用..lasterr()函数获取错误信息
!crypt.encrypt(.(字符串,是否已输入全部数据,哈希对象,选项) = 除第一个参数以外,其他参数都是可选参数\n成功返回加密文本,失败返回空,\n可使用..lasterr()函数获取错误信息
!crypt.allocBuffer(.(大小,块大小) = 分配加解密需要用到的缓冲区\n如果不手动分配,程序将会自动按需分配缓冲区\n参数2可选
!crypt.release() = 释放密码服务对象(CSP)\n此函数可在对象析构时自动调用 
end intellisense**/

/**intellisense(crypt)
md5(.(字符串,是否大写,返回16位结果) = 计算哈希值,\n参数2可选,默认大写\n参数3可选,默认返回32位结果
md4(.(字符串,是否大写,返回16位结果) = 计算哈希值,\n参数2可选,默认大写\n参数3可选,默认返回32位结果
md2(.(字符串,是否大写,返回16位结果) = 计算哈希值,\n参数2可选,默认大写\n参数3可选,默认返回32位结果
sha1(.(字符串,是否大写) = 计算哈希值,\n参数2可选,默认大写
end intellisense**/


 /**intellisense()
_PROV_RSA_FULL=@1/*_PROV_RSA_FULL*/
_PROV_RSA_SIG=@2/*_PROV_RSA_SIG*/
_PROV_DSS=@3/*_PROV_DSS*/
_PROV_FORTEZZA=@4/*_PROV_FORTEZZA*/
_PROV_MS_EXCHANGE=@5/*_PROV_MS_EXCHANGE*/
_PROV_SSL=@6/*_PROV_SSL*/
_PROV_RSA_SCHANNEL=@0xC/*_PROV_RSA_SCHANNEL*/
_PROV_DSS_DH=@0xD/*_PROV_DSS_DH*/
_PROV_EC_ECDSA_SIG=@0xE/*_PROV_EC_ECDSA_SIG*/
_PROV_EC_ECNRA_SIG=@0xF/*_PROV_EC_ECNRA_SIG*/
_PROV_EC_ECDSA_FULL=@0x10/*_PROV_EC_ECDSA_FULL*/
_PROV_EC_ECNRA_FULL=@0x11/*_PROV_EC_ECNRA_FULL*/
_PROV_DH_SCHANNEL=@0x12/*_PROV_DH_SCHANNEL*/
_PROV_SPYRUS_LYNKS=@0x14/*_PROV_SPYRUS_LYNKS*/
_PROV_RNG=@0x15/*_PROV_RNG*/
_PROV_INTEL_SEC=@0x16/*_PROV_INTEL_SEC*/
_PROV_REPLACE_OWF=@0x17/*_PROV_REPLACE_OWF*/
_PROV_RSA_AES=@0x18/*_PROV_RSA_AES*/ 
_ALG_CLASS_ANY=@0/*_ALG_CLASS_ANY*/
_ALG_CLASS_SIGNATURE=@0x2000/*_ALG_CLASS_S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ST=@6/*_ALG_SID_CAST*/
_ALG_SID_SAFERSK64=@7/*_ALG_SID_SAFERSK64*/
_ALG_SID_SAFERSK128=@8/*_ALG_SID_SAFERSK128*/
_ALG_SID_3DES_112=@9/*_ALG_SID_3DES_112*/
_ALG_SID_CYLINK_MEK=@0xC/*_ALG_SID_CYLINK_MEK*/
_ALG_SID_RC5=@0xD/*_ALG_SID_RC5*/
_ALG_SID_AES_128=@0xE/*_ALG_SID_AES_128*/
_ALG_SID_AES_192=@0xF/*_ALG_SID_AES_192*/
_ALG_SID_AES_256=@0x10/*_ALG_SID_AES_256*/
_ALG_SID_AES=@0x11/*_ALG_SID_AES*/
_ALG_SID_SKIPJACK=@0xA/*_ALG_SID_SKIPJACK*/
_ALG_SID_TEK=@0xB/*_ALG_SID_TEK*/
_ALG_SID_RC2=@2/*_ALG_SID_RC2*/
_ALG_SID_RC4=@1/*_ALG_SID_RC4*/
_ALG_SID_SEAL=@2/*_ALG_SID_SEAL*/
_ALG_SID_DH_SANDF=@1/*_ALG_SID_DH_SANDF*/
_ALG_SID_DH_EPHEM=@2/*_ALG_SID_DH_EPHEM*/
_ALG_SID_AGREED_KEY_ANY=@3/*_ALG_SID_AGREED_KEY_ANY*/
_ALG_SID_KEA=@4/*_ALG_SID_KEA*/
_ALG_SID_ECDH=@5/*_ALG_SID_ECDH*/
_ALG_SID_MD2=@1/*_ALG_SID_MD2*/
_ALG_SID_MD4=@2/*_ALG_SID_MD4*/
_ALG_SID_MD5=@3/*_ALG_SID_MD5*/
_ALG_SID_SHA=@4/*_ALG_SID_SHA*/
_ALG_SID_SHA1=@4/*_ALG_SID_SHA1*/
_ALG_SID_MAC=@5/*_ALG_SID_MAC*/
_ALG_SID_RIPEMD=@6/*_ALG_SID_RIPEMD*/
_ALG_SID_RIPEMD160=@7/*_ALG_SID_RIPEMD160*/
_ALG_SID_SSL3SHAMD5=@8/*_ALG_SID_SSL3SHAMD5*/
_ALG_SID_HMAC=@9/*_ALG_SID_HMAC*/
_ALG_SID_TLS1PRF=@0xA/*_ALG_SID_TLS1PRF*/
_ALG_SID_HASH_REPLACE_OWF=@0xB/*_ALG_SID_HASH_REPLACE_OWF*/
_ALG_SID_SHA_256=@0xC/*_ALG_SID_SHA_256*/
_ALG_SID_SHA_384=@0xD/*_ALG_SID_SHA_384*/
_ALG_SID_SHA_512=@0xE/*_ALG_SID_SHA_512*/
_ALG_SID_SSL3_MASTER=@1/*_ALG_SID_SSL3_MASTER*/
_ALG_SID_SCHANNEL_MASTER_HASH=@2/*_ALG_SID_SCHANNEL_MASTER_HASH*/
_ALG_SID_SCHANNEL_MAC_KEY=@3/*_ALG_SID_SCHANNEL_MAC_KEY*/
_ALG_SID_PCT1_MASTER=@4/*_ALG_SID_PCT1_MASTER*/
_ALG_SID_SSL2_MASTER=@5/*_ALG_SID_SSL2_MASTER*/
_ALG_SID_TLS1_MASTER=@6/*_ALG_SID_TLS1_MASTER*/
_ALG_SID_SCHANNEL_ENC_KEY=@7/*_ALG_SID_SCHANNEL_ENC_KEY*/
_ALG_SID_ECMQV=@1/*_ALG_SID_ECMQV*/
_ALG_SID_EXAMPLE=@0x50/*_ALG_SID_EXAMPLE*/
_CALG_MD2=@0x8001/*_CALG_MD2*/
_CALG_MD4=@0x8002/*_CALG_MD4*/
_CALG_MD5=@0x8003/*_CALG_MD5*/
_CALG_SHA=@0x8004/*_CALG_SHA*/
_CALG_SHA1=@0x8004/*_CALG_SHA1*/
_CALG_MAC=@0x8005/*_CALG_MAC*/
_CALG_RSA_SIGN=@0x2400/*_CALG_RSA_SIGN*/
_CALG_DSS_SIGN=@0x2200/*_CALG_DSS_SIGN*/
_CALG_NO_SIGN=@0x2000/*_CALG_NO_SIGN*/
_CALG_RSA_KEYX=@0xA400/*_CALG_RSA_KEYX*/
_CALG_DES=@0x6601/*_CALG_DES*/
_CALG_3DES_112=@0x6609/*_CALG_3DES_112*/
_CALG_3DES=@0x6603/*_CALG_3DES*/
_CALG_DESX=@0x6604/*_CALG_DESX*/
_CALG_RC2=@0x6602/*_CALG_RC2*/
_CALG_RC4=@0x6801/*_CALG_RC4*/
_CALG_SEAL=@0x6802/*_CALG_SEAL*/
_CALG_DH_SF=@0xAA01/*_CALG_DH_SF*/
_CALG_DH_EPHEM=@0xAA02/*_CALG_DH_EPHEM*/
_CALG_AGREEDKEY_ANY=@0xAA03/*_CALG_AGREEDKEY_ANY*/
_CALG_KEA_KEYX=@0xAA04/*_CALG_KEA_KEYX*/
_CALG_HUGHES_MD5=@0xA003/*_CALG_HUGHES_MD5*/
_CALG_SKIPJACK=@0x660A/*_CALG_SKIPJACK*/
_CALG_TEK=@0x660B/*_CALG_TEK*/
_CALG_CYLINK_MEK=@0x660C/*_CALG_CYLINK_MEK*/
_CALG_SSL3_SHAMD5=@0x8008/*_CALG_SSL3_SHAMD5*/
_CALG_SSL3_MASTER=@0x4C01/*_CALG_SSL3_MASTER*/
_CALG_SCHANNEL_MASTER_HASH=@0x4C02/*_CALG_SCHANNEL_MASTER_HASH*/
_CALG_SCHANNEL_MAC_KEY=@0x4C03/*_CALG_SCHANNEL_MAC_KEY*/
_CALG_SCHANNEL_ENC_KEY=@0x4C07/*_CALG_SCHANNEL_ENC_KEY*/
_CALG_PCT1_MASTER=@0x4C04/*_CALG_PCT1_MASTER*/
_CALG_SSL2_MASTER=@0x4C05/*_CALG_SSL2_MASTER*/
_CALG_TLS1_MASTER=@0x4C06/*_CALG_TLS1_MASTER*/
_CALG_RC5=@0x660D/*_CALG_RC5*/
_CALG_HMAC=@0x8009/*_CALG_HMAC*/
_CALG_TLS1PRF=@0x800A/*_CALG_TLS1PRF*/
_CALG_HASH_REPLACE_OWF=@0x800B/*_CALG_HASH_REPLACE_OWF*/
_CALG_AES_128=@0x660E/*_CALG_AES_128*/
_CALG_AES_192=@0x660F/*_CALG_AES_192*/
_CALG_AES_256=@0x6610/*_CALG_AES_256*/
_CALG_AES=@0x6611/*_CALG_AES*/
_CALG_SHA_256=@0x800C/*_CALG_SHA_256*/
_CALG_SHA_384=@0x800D/*_CALG_SHA_384*/
_CALG_SHA_512=@0x800E/*_CALG_SHA_512*/
_CALG_ECDH=@0xAA05/*_CALG_ECDH*/
_CALG_ECMQV=@0xA001/*_CALG_ECMQV*/
_CALG_ECDSA=@0x2203/*_CALG_ECDSA*/
_SIGNATURE_RESOURCE_NUMBER=@0x29A/*_SIGNATURE_RESOURCE_NUMBER*/
_CRYPT_VERIFYCONTEXT=@0xF0000000/*_CRYPT_VERIFYCONTEXT*/
_CRYPT_NEWKEYSET=@8/*_CRYPT_NEWKEYSET*/
_CRYPT_DELETEKEYSET=@0x10/*_CRYPT_DELETEKEYSET*/
_CRYPT_MACHINE_KEYSET=@0x20/*_CRYPT_MACHINE_KEYSET*/
_CRYPT_SILENT=@0x40/*_CRYPT_SILENT*/
_CRYPT_DEFAULT_CONTAINER_OPTIONAL=@0x80/*_CRYPT_DEFAULT_CONTAINER_OPTIONAL*/
_CRYPT_EXPORTABLE=@1/*_CRYPT_EXPORTABLE*/
_CRYPT_USER_PROTECTED=@2/*_CRYPT_USER_PROTECTED*/
_CRYPT_CREATE_SALT=@4/*_CRYPT_CREATE_SALT*/
_CRYPT_UPDATE_KEY=@8/*_CRYPT_UPDATE_KEY*/
_CRYPT_NO_SALT=@0x10/*_CRYPT_NO_SALT*/
_CRYPT_PREGEN=@0x40/*_CRYPT_PREGEN*/
_CRYPT_RECIPIENT=@0x10/*_CRYPT_RECIPIENT*/
_CRYPT_INITIATOR=@0x40/*_CRYPT_INITIATOR*/
_CRYPT_ONLINE=@0x80/*_CRYPT_ONLINE*/
_CRYPT_SF=@0x100/*_CRYPT_SF*/
_CRYPT_CREATE_IV=@0x200/*_CRYPT_CREATE_IV*/
_CRYPT_KEK=@0x400/*_CRYPT_KEK*/
_CRYPT_DATA_KEY=@0x800/*_CRYPT_DATA_KEY*/
_CRYPT_VOLATILE=@0x1000/*_CRYPT_VOLATILE*/
_CRYPT_SGCKEY=@0x2000/*_CRYPT_SGCKEY*/
_CRYPT_ARCHIVABLE=@0x4000/*_CRYPT_ARCHIVABLE*/
_CRYPT_FORCE_KEY_PROTECTION_HIGH=@0x8000/*_CRYPT_FORCE_KEY_PROTECTION_HIGH*/
_RSA1024BIT_KEY=@0x4000000/*_RSA1024BIT_KEY*/
_CRYPT_SERVER=@0x400/*_CRYPT_SERVER*/
_KEY_LENGTH_MASK=@0xFFFF0000/*_KEY_LENGTH_MASK*/
_CRYPT_Y_ONLY=@1/*_CRYPT_Y_ONLY*/
_CRYPT_SSL2_FALLBACK=@2/*_CRYPT_SSL2_FALLBACK*/
_CRYPT_DESTROYKEY=@4/*_CRYPT_DESTROYKEY*/
_CRYPT_BLOB_VER3=@0x80/*_CRYPT_BLOB_VER3*/
_CRYPT_IPSEC_HMAC_KEY=@0x100/*_CRYPT_IPSEC_HMAC_KEY*/
_CRYPT_DECRYPT_RSA_NO_PADDING_CHECK=@0x20/*_CRYPT_DECRYPT_RSA_NO_PADDING_CHECK*/
_CRYPT_SECRETDIGEST=@1/*_CRYPT_SECRETDIGEST*/
_CRYPT_OWF_REPL_LM_HASH=@1/*_CRYPT_OWF_REPL_LM_HASH*/
_CRYPT_LITTLE_ENDIAN=@1/*_CRYPT_LITTLE_ENDIAN*/
_CRYPT_NOHASHOID=@1/*_CRYPT_NOHASHOID*/
_CRYPT_TYPE2_FORMAT=@2/*_CRYPT_TYPE2_FORMAT*/
_CRYPT_X931_FORMAT=@4/*_CRYPT_X931_FORMAT*/
_CRYPT_MACHINE_DEFAULT=@1/*_CRYPT_MACHINE_DEFAULT*/
_CRYPT_USER_DEFAULT=@2/*_CRYPT_USER_DEFAULT*/
_CRYPT_DELETE_DEFAULT=@4/*_CRYPT_DELETE_DEFAULT*/
_SIMPLEBLOB=@1/*_SIMPLEBLOB*/
_PUBLICKEYBLOB=@6/*_PUBLICKEYBLOB*/
_PRIVATEKEYBLOB=@7/*_PRIVATEKEYBLOB*/
_PLAINTEXTKEYBLOB=@8/*_PLAINTEXTKEYBLOB*/
_OPAQU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DSS_DH=@0xD/*_PROV_DSS_DH*/
_PROV_EC_ECDSA_SIG=@0xE/*_PROV_EC_ECDSA_SIG*/
_PROV_EC_ECNRA_SIG=@0xF/*_PROV_EC_ECNRA_SIG*/
_PROV_EC_ECDSA_FULL=@0x10/*_PROV_EC_ECDSA_FULL*/
_PROV_EC_ECNRA_FULL=@0x11/*_PROV_EC_ECNRA_FULL*/
_PROV_DH_SCHANNEL=@0x12/*_PROV_DH_SCHANNEL*/
_PROV_SPYRUS_LYNKS=@0x14/*_PROV_SPYRUS_LYNKS*/
_PROV_RNG=@0x15/*_PROV_RNG*/
_PROV_INTEL_SEC=@0x16/*_PROV_INTEL_SEC*/
_PROV_REPLACE_OWF=@0x17/*_PROV_REPLACE_OWF*/
_PROV_RSA_AES=@0x18/*_PROV_RSA_AES*/
_PROV_STT_MER=@7/*_PROV_STT_MER*/
_PROV_STT_ACQ=@8/*_PROV_STT_ACQ*/
_PROV_STT_BRND=@9/*_PROV_STT_BRND*/
_PROV_STT_ROOT=@0xA/*_PROV_STT_ROOT*/
_PROV_STT_ISS=@0xB/*_PROV_STT_ISS*/
_MAXUIDLEN=@0x40/*_MAXUIDLEN*/
_MS_DEF_PROV=@"Microsoft Base Cryptographic Provider v1.0" 
_MS_ENHANCED_PROV=@"Microsoft Enhanced Cryptographic Provider v1.0" 
_MS_STRONG_PROV=@"Microsoft Strong Cryptographic Provider" 
_MS_DEF_RSA_SIG_PROV=@"Microsoft RSA Signature Cryptographic Provider" 
_MS_DEF_RSA_SCHANNEL_PROV=@"Microsoft RSA SChannel Cryptographic Provider" 
_MS_DEF_DSS_PROV=@"Microsoft Base DSS Cryptographic Provider" 
_MS_DEF_DSS_DH_PROV=@"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"  
_MS_ENH_DSS_DH_PROV=@"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"  
_MS_DEF_DH_SCHANNEL_PROV=@"Microsoft DH SChannel Cryptographic Provider" 
_MS_SCARD_PROV=@"Microsoft Base Smart Card Crypto Provider" 
_MS_ENH_RSA_AES_PROV=@"Microsoft Enhanced RSA and AES Cryptographic Provider" 
_EXPO_OFFLOAD_REG_VALUE=@"ExpoOffload"
_EXPO_OFFLOAD_FUNC_NAME=@"OffloadModExpo" 
_szKEY_CRYPTOAPI_PRIVATE_KEY_OPTIONS=@"Software\\Policies\\Microsoft\\Cryptography" 
_szFORCE_KEY_PROTECTION=@"ForceKeyProtection"
_szKEY_CACHE_ENABLED=@"CachePrivateKeys"
_szKEY_CACHE_SECONDS=@"PrivateKeyLifetimeSeconds"
_szPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS=@"PrivKeyCachePurgeIntervalSeconds"
_szPRIV_KEY_CACHE_MAX_ITEMS=@"PrivKeyCacheMaxItems"
end intellisense**/