public override void toAdmin(QuickFix.Message message, QuickFix.SessionID sessionID)
        {
            base.toAdmin(message, sessionID);

            if (message is QuickFix42.Logon)
            {
                message.setField(new ResetSeqNumFlag(true));

                GSFIX gsfix = provider as GSFIX;

                string encrypt_pwd      = gsfix.Password;
                byte[] encrypt_pwd_byte = new byte[128];
                switch (gsfix.EncryptType)
                {
                case EncryptType.NONE:
                    message.setField(new EncryptMethod(EncryptMethod.NONE));
                    break;

                case EncryptType.DESECB:
                    gsEncrypt(2, gsfix.Password, gsfix.Password.Length, gsfix.PublicKey, encrypt_pwd_byte, 128);
                    encrypt_pwd = Encoding.ASCII.GetString(encrypt_pwd_byte);
                    message.setField(new EncryptMethod(EncryptMethod.DESECBMODE));
                    break;

                case EncryptType.BlowFish:
                    gsEncrypt(101, gsfix.Password, gsfix.Password.Length, gsfix.PublicKey, encrypt_pwd_byte, 128);
                    encrypt_pwd = Encoding.ASCII.GetString(encrypt_pwd_byte);
                    message.setField(new EncryptMethod((int)EncryptType.BlowFish));
                    break;

                default:
                    break;
                }

                if (!string.IsNullOrEmpty(gsfix.Account) && !string.IsNullOrEmpty(gsfix.CreditAccount))
                {
                    message.setField(new RawData(string.Format("T:{0},{1}:{2}:", gsfix.Account, gsfix.CreditAccount, encrypt_pwd.ToString())));
                }
                else if (!string.IsNullOrEmpty(gsfix.Account))
                {
                    message.setField(new RawData(string.Format("Z:{0}:{1}:", gsfix.Account, encrypt_pwd.ToString())));
                }
                else if (!string.IsNullOrEmpty(gsfix.CreditAccount))
                {
                    message.setField(new RawData(string.Format("X:{0}:{1}:", gsfix.CreditAccount, encrypt_pwd.ToString())));
                }
                else
                {
                    message.setField(new RawData(string.Format("T:{0},{1}:{2}:", gsfix.Account, gsfix.CreditAccount, encrypt_pwd.ToString())));
                }
            }
        }
 public GSFIXApplication(GSFIX provider)
     : base(provider, "GS_FIX")
 {
 }
예제 #3
0
 public GSFIXApplication(GSFIX provider)
     : base(provider,"GS_FIX")
 {
 }