示例#1
0
        public I2PRouterInfo(
            I2PRouterIdentity identity,
            I2PDate publisheddate,
            I2PRouterAddress[] adresses,
            I2PMapping options,
            I2PSigningPrivateKey privskey)
        {
            Identity      = identity;
            PublishedDate = publisheddate;
            Adresses      = adresses;
            Options       = options;

            var dest = new List <byte>();

            Identity.Write(dest);
            PublishedDate.Write(dest);
            dest.Add((byte)Adresses.Length);
            foreach (var addr in Adresses)
            {
                addr.Write(dest);
            }
            dest.Add(0);   // Always zero
            Options.Write(dest);
            Data = new BufLen(dest.ToArray());

            Signature = new I2PSignature(new BufRefLen(I2PSignature.DoSign(privskey, Data)), privskey.Certificate);
        }
示例#2
0
        public void Write(BufRefStream dest)
        {
            // Routers MUST set this (expire) field to all zeros. As of release 0.9.12,
            // a non-zero expiration field is again recognized, however we must
            // wait several releases to use this field, until the vast majority
            // of the network recognizes it.
            // TODO: Hmmm?

            dest.Write(Cost);
            Expiration.Write(dest);
            TransportStyle.Write(dest);
            Options.Write(dest);
        }
示例#3
0
        public void Write(BufRefStream dest)
        {
            var dest2 = new BufRefStream();

            Destination.Write(dest2);
            Map.Write(dest2);
            Date.Write(dest2);
            var dest2data = dest2.ToArray();

            var sig = new I2PSignature(new BufRefLen(I2PSignature.DoSign(PrivateSigningKey, new BufLen(dest2data))), PrivateSigningKey.Certificate);

            dest.Write(dest2data);
            sig.Write(dest);
        }