Exemplo n.º 1
0
        public Message CreateMyKeyMessage(Node messageTo)
        {
            Message m = new Message(network, MessageType.MyKey);

            if (messageTo != null) {
                m.To = messageTo.NodeID;
            }

            KeyInfo info = new KeyInfo ();
            info.Key = Core.CryptoProvider.ToXmlString (false);
            info.Info = Core.Settings.NickName;

            m.Content = info;

            return m;
        }
Exemplo n.º 2
0
 public ReceivedKeyEventArgs(Node node, KeyInfo keyInfo)
 {
     this.node = node;
     this.keyInfo = keyInfo;
 }
Exemplo n.º 3
0
 public ReceivedKeyEventArgs(LocalNodeConnection connection, KeyInfo keyInfo)
 {
     this.connection = connection;
     this.keyInfo = keyInfo;
 }
Exemplo n.º 4
0
 internal bool RaiseReceivedKey(Node node, KeyInfo key)
 {
     return OnReceivedKey(new ReceivedKeyEventArgs(node, key));
 }
Exemplo n.º 5
0
 internal bool RaiseReceivedKey(LocalNodeConnection connection, KeyInfo key)
 {
     return OnReceivedKey(new ReceivedKeyEventArgs(connection, key));
 }
Exemplo n.º 6
0
        internal void ProcessMyKeyMessage(Node node, KeyInfo key)
        {
            bool acceptKey = network.RaiseReceivedKey (node, key);

            if (acceptKey) {
                TrustedNodeInfo tni = new TrustedNodeInfo();
                tni.Identifier = node.NickName;
                tni.PublicKey = new PublicKey(key.Key);

                network.AddTrustedNode(tni);

                Core.Settings.SyncNetworkInfoAndSave();
            }
        }