public iBonAuthenticate() { this.hexConverter = new HexConverter(); this.byteWorker = new ByteWorker(); this.symCryptor = new SymCryptor(); this.RandomACreater = new SessionKeyGenerator(); this.GenerateRanAIndex = new Random(Guid.NewGuid().GetHashCode()); if (dicKmsLoginConfig == null) { LoadXmlConfig(@"EsKmsWebApiConfig.xml"); } this.esKmsWebApi = new EsKmsWebApi() { Url = dicKmsLoginConfig["Url"], //"http://10.27.68.163:8080/eGATEsKMS/interface", //"http://127.0.0.1:8081/eGATEsKMS/interface", AppCode = dicKmsLoginConfig["AppCode"], //"APP_001", AuthCode = dicKmsLoginConfig["AuthCode"], //"12345678", AppName = dicKmsLoginConfig["AppName"], //"icash2Test", HttpMethod = dicKmsLoginConfig["HttpMethod"], //"POST", HexConverter = new HexConverter(), HashWorker = new HashWorker() { HashAlg = "SHA1", HexConverter = new HexConverter() } }; this.aesCMac2Worker = new AesCMac2Worker(this.esKmsWebApi); }
public KMSGetter() { this.hexConverter = new HexConverter(); this.byteWorker = new ByteWorker(); this.symCryptor = new SymCryptor(); if (dicKmsLoginConfig == null) { LoadXmlConfig(@"EsKmsWebApiConfig.xml"); } this.esKmsWebApi = new EsKmsWebApi() { Url = dicKmsLoginConfig["Url"], //"http://10.27.68.163:8080/eGATEsKMS/interface", //"http://127.0.0.1:8081/eGATEsKMS/interface", AppCode = dicKmsLoginConfig["AppCode"], //"APP_001", AuthCode = dicKmsLoginConfig["AuthCode"], //"12345678", AppName = dicKmsLoginConfig["AppName"], //"icash2Test", HttpMethod = dicKmsLoginConfig["HttpMethod"], //"POST", HexConverter = new HexConverter(), HashWorker = new HashWorker() { HashAlg = "SHA1", HexConverter = new HexConverter() } }; this.aesCMac2Worker = new AesCMac2Worker(this.esKmsWebApi); }
//測試Dennis的dll(Spring.net) static void Main1(string[] args) { //app.config要先加入設定的object,目前已在Assembly file內loading,要改成可變更需拿出來變resource file IApplicationContext ctx = ContextRegistry.GetContext(); IHexConverter hexConverter = ctx["hexConverter"] as IHexConverter; IByteWorker byteWorker = ctx["byteWorker"] as IByteWorker; IMac2Manager mac2Manager = ctx["mac2Manager"] as IMac2Manager; IHashWorker hashWorker = ctx["hashWorker"] as IHashWorker; IMsgUtility msgUtility = ctx["icash2AOLReqMsgUtility"] as IMsgUtility; IMsgUtility PAMReqMsgUtility = ctx["icash2PAMReqMsgUtility"] as IMsgUtility; IMsgUtility PAMRespMsgUtility = ctx["icash2PAMRespMsgUtility"] as IMsgUtility; Console.ReadKey(); }
public void InitContext() { this.hexConverter = new HexConverter(); this.byteWorker = new ByteWorker(); //KMS參數設定 kms_context_param_t ctx_param = new kms_context_param_t(); ctx_param.app_name = "kms2Test"; ctx_param.kms_server = //@"http://10.27.68.163:8080/eGATEsKMS/interface"; @"http://127.0.0.1:8081/eGATEsKMS/interface"; ctx_param.ssl = 0; ctx_param.debug = 1; ctx_param.timeout = 30; ctx_param.connect_timeout = 10; ctx_param.auth_with_cipher = 1; //DLL要在X64下跑,所以編譯的設定都改成x64和容許UnSafe程式碼(因DLL是C++寫的),測試設定的預設處理器架構也要改x64 this.esKmsApi = EsKmsApi.GetInstance(ctx_param); }
public void Init() { this.esKmsWebApi = new EsKmsWebApi() { Url = "http://127.0.0.1:8081/eGATEsKMS/interface",//"http://10.27.68.163:8080/eGATEsKMS/interface", AppCode = "APP_001", AuthCode = "12345678", AppName = "icash2Test", HttpMethod = "POST", HexConverter = new HexConverter(), HashWorker = new HashWorker() { HashAlg = "SHA1", HexConverter = new HexConverter() }, }; this.hexConverter = new HexConverter(); this.byteWorker = new ByteWorker(); }
public void Init() { this.hexConverter = new HexConverter(); this.symCryptor = new SymCryptor("AES"); this.paddingHelper = new Pkcs7PaddingHelper(); this.byteWorker = new ByteWorker(); // aes-128-cbc //byte[] key = {145,12,32,245,98,132,98,214,6,77,131,44,221,3,9,50}; //KEY(128|192|256,128bit):910C20F5628462D6064D832CDD030932 // AES-192-CBC //*************************************** string keyString = "0123456789abcdef";//AES用的加解密金鑰字串 string hexKeyString = this.hexConverter.Str2Hex(keyString);//AES用的加解密金鑰轉hex Debug.WriteLine("Hex Key String:" + hexKeyString); //*************************************** byte[] key = this.hexConverter.Hex2Bytes //AES用的加解密金鑰轉Byte Array(固定長度: 16 bytes) ( // "00112233445566778899AABBCCDDEEFF0102030405060708" //"3FE9489CC954E7DA1B4806A8133B81EB" hexKeyString//16 bytes ); // //byte[] iv = {15,122,132,5,93,198,44,31,9,39,241,49,250,188,80,7}; //IV(128bit):0F7A84055DC62C1F0927F131FABC5007 //IV: ALL ZERO //byte[] iv = new byte[16]; //for (int i = 0; i < iv.Length; i++) //{ // iv[i] = 0; //} // this.symCryptor.SetIV(SymCryptor.ConstZero); this.symCryptor.SetKey(key); //log.Debug( "KEY:" + this.hexConverter.Bytes2Hex( key ) ); //log.Debug( "IV:" + this.hexConverter.Bytes2Hex( iv ) ); }
public void InitContext() { this.hexConverter = new HexConverter(); this.pkcs7PaddingHelper = new Pkcs7PaddingHelper(); this.byteWorker = new ByteWorker(); }