TSystems.RELOAD.Transport.SecurityBlock.SignMessage C# (CSharp) Method

SignMessage() public method

This method signs a message content contained within the stream.
public SignMessage ( UInt32 overlay, string transId, RELOAD_MessageBody body ) : void
overlay System.UInt32
transId string The transaction Id used for signing
body RELOAD_MessageBody
return void
        public void SignMessage(UInt32 overlay, string transId, RELOAD_MessageBody body)
        {
            var ms = new MemoryStream();
            var br = new BinaryWriter(ms);
            body.Dump(br);
            ms.Position = 0;

            byte[] array = ms.ToArray();

            br.Close();

            signature = new Signature(overlay, transId, array, signerId, m_ReloadConfig);
        }

Usage Example

Esempio n. 1
0
        public ReloadMessage(ReloadConfig rc, NodeId OriginatorNodeID,
          Destination destination, UInt64 trans_id, RELOAD_MessageBody reload_content)
        {
            m_ReloadConfig = rc;
            forwarding_header.version = ReloadGlobals.RELOAD_VERSION;
            forwarding_header.ttl = ReloadGlobals.TTL;
            forwarding_header.overlay = m_ReloadConfig.OverlayHash;
            forwarding_header.transaction_id = trans_id;

            reload_message_body = reload_content;

            forwarding_header.via_list = new List<Destination>();
            forwarding_header.via_list.Add(new Destination(OriginatorNodeID));

            forwarding_header.destination_list = new List<Destination>();
            forwarding_header.destination_list.Add(destination);
            SignerIdentity myId = m_ReloadConfig.AccessController.MyIdentity;
            security_block = new SecurityBlock(rc, myId);
            /* Sign the message, create stream of body */

            security_block.SignMessage(m_ReloadConfig.OverlayHash,
              trans_id.ToString(), reload_message_body);
        }