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;
        }
Exemple #2
0
 public ReceivedKeyEventArgs(Node node, KeyInfo keyInfo)
 {
     this.node = node;
     this.keyInfo = keyInfo;
 }
Exemple #3
0
 public ReceivedKeyEventArgs(LocalNodeConnection connection, KeyInfo keyInfo)
 {
     this.connection = connection;
     this.keyInfo = keyInfo;
 }
Exemple #4
0
 internal bool RaiseReceivedKey(Node node, KeyInfo key)
 {
     return OnReceivedKey(new ReceivedKeyEventArgs(node, key));
 }
Exemple #5
0
 internal bool RaiseReceivedKey(LocalNodeConnection connection, KeyInfo key)
 {
     return OnReceivedKey(new ReceivedKeyEventArgs(connection, key));
 }
        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();
            }
        }