예제 #1
0
        private BankRawMessage TranslateZoneKeys(NetworkManagementModel model, Session2805Data data, HostCryptography hostCrypt)
        {
            var    value       = model.AddtlDataPriv;
            string zak         = value.Substring(0, 32);
            string zpk         = value.Substring(32);
            int    node_number = model.SecControlInfo;

            _log.Info("Keys received under ZMK. ZAK = " + zak + " and ZPK = " + zpk);

            Dictionary <string, string> zoneKeySet2 = hostCrypt.TranslateSetOfZoneKeys(KEKr, zpk, zak, "11111111111111111111111111111111");

            if (zoneKeySet2["ErrorCode"] == "00")
            {
                data.UpdateSession_Recieve_as2805(zoneKeySet2["ZPK(LMK)"], zpk, zoneKeySet2["ZPK Check Value"], zoneKeySet2["ZAK(LMK)"], zak, zoneKeySet2["ZAK Check Value"], zoneKeySet2["ZEK(LMK)"], zoneKeySet2["ZEK Check Value"], node_number.ToString());

                _log.Info("Sent keys under LMK : ZAK : " + zoneKeySet2["ZAK(LMK)"] + " ZAK check value : " + zoneKeySet2["ZAK Check Value"] + "ZPK : " + zoneKeySet2["ZPK(LMK)"] + "ZPK Check Value : " + zoneKeySet2["ZPK Check Value"]);

                model.Mti            = "0830";
                model.RespCode       = "00";
                model.NetMgtInfoCode = "101";
                model.AddtlDataPriv  = zoneKeySet2["ZAK Check Value"] + zoneKeySet2["ZPK Check Value"];

                _log.Info("Sending key exchange response");
                return(new BankRawMessage(_responseBuilder.NetworkManagementAdviceResponse(model)));
            }

            _log.Error("Error Translating Set of Zone Keys");
            zoneKeySet2.Clear();
            SetState(SimulatorStates.Disconnect);
            model.RespCode = "30";
            return(new BankRawMessage(_responseBuilder.NetworkManagementAdviceResponse(model)));
        }
예제 #2
0
        public void TranslateZoneKeys(string kekr)
        {
            var    value       = this.AddtlDataPriv;
            string zak         = value.Substring(0, 32);
            string zpk         = value.Substring(32);
            int    node_number = this.SecControlInfo;

            _log.Info("Keys received under ZMK. ZAK = " + zak + " and ZPK = " + zpk);

            var hostCrypt = new HostCryptography();

            _log.Debug("Translating Zone Keys");
            Dictionary <string, string> zoneKeySet2 = hostCrypt.TranslateSetOfZoneKeys(kekr, zpk, zak, "11111111111111111111111111111111");

            using (Session2805Data data = new Session2805Data())
            {
                if (zoneKeySet2["ErrorCode"] == "00")
                {
                    data.UpdateSession_Recieve_as2805(zoneKeySet2["ZPK(LMK)"], zpk, zoneKeySet2["ZPK Check Value"], zoneKeySet2["ZAK(LMK)"], zak, zoneKeySet2["ZAK Check Value"], zoneKeySet2["ZEK(LMK)"], zoneKeySet2["ZEK Check Value"], node_number.ToString());
                    _log.Info("Sent keys under LMK : ZAK : " + zoneKeySet2["ZAK(LMK)"] + " ZAK check value : " + zoneKeySet2["ZAK Check Value"] + "ZPK : " + zoneKeySet2["ZPK(LMK)"] + "ZPK Check Value : " + zoneKeySet2["ZPK Check Value"]);
                    this.Mti            = "0830";
                    this.NetMgtInfoCode = "101";
                    this.RespCode       = "00";
                    this.AddtlDataPriv  = zoneKeySet2["ZAK Check Value"] + zoneKeySet2["ZPK Check Value"];
                    _log.Info("Sending key exchange response");
                }
                else
                {
                    _log.Error("Error Translating Set of Zone Keys");
                    zoneKeySet2.Clear();
                    this.RespCode = "30";
                }
            }
        }