internal static void InitSecurityData(IFreeformEntity_Msg message, FFTgt_B2B_Security_Data securityData)
        {
            FFTgt_B2B_Security tgt = new FFTgt_B2B_Security_ResponseRequired()
            {
                SecurityData = securityData,
            };

            message.AddTarget(tgt);
        }
Esempio n. 2
0
        static void EncryptSecurity()
        {
            FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H,
                                                                           new FFCreateEntityRequest_G2H_ResponseRequired()
            {
                Command       = FF_AppId_G2H_Commands.ResponseRequest,
                MessageType   = FF_AppId_G2H_MessageTypes.FreeForm,
                SessionID     = FF_AppId_SessionIds.Security,
                TransactionID = 0xB1,
                IPAddress     = IPADDR,
            });
            FFTgt_B2B_Security tgt = new FFTgt_B2B_Security_ResponseRequired()
            {
                SecurityData = new FFTgt_B2B_Security_KeyExchange_Request(),
            };

            msg.AddTarget(tgt);
            byte[] buf2 = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg);
            var    msgF = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, buf2);

            FFMsg_H2G msg2 = msg.CopyTo(FF_FlowDirection.H2G, new FFCreateEntityRequest_H2G_ResponseRequired()
            {
                PollCode = FF_AppId_H2G_PollCodes.FreeformResponse,
            }) as FFMsg_H2G;
            FFTgt_B2B_Security tgt2 = new FFTgt_B2B_Security()
            {
                SecurityData = new FFTgt_B2B_Security_KeyExchange_PartialKey()
                {
                    PartialKey = new byte[] { 10, 11, 12, 34, 56, 78, 96, 89, 44 },
                }
            };

            msg2.AddTarget(tgt2);

            byte[] buf3  = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, msg2);
            var    msgF3 = FreeformEntityFactory.CreateEntity <FFMsg_H2G>(FF_FlowDirection.H2G, buf3, IPADDR);

            ExecutionStepFactory.Current.Execute(msg);
            //byte[] buf1 = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, msg2);
            //UdpFreeformEntity buffer = FreeformEntityFactory.CreateUdpEntity(FF_FlowDirection.G2H, buf1);
            //IFreeformEntity ff = FreeformEntityFactory.CreateEntity(FF_FlowDirection.G2H, buffer);
            //byte[] buf2 = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg);
        }