Ejemplo n.º 1
0
 /// <summary>
 /// Exports the public key information to XML.
 /// </summary>
 /// <param name="Xml">XML output</param>
 public override void ToXml(StringBuilder Xml)
 {
     Xml.Append('<');
     Xml.Append(this.LocalName);
     Xml.Append(" x=\"");
     Xml.Append(Convert.ToBase64String(EcAes256.ToNetwork(this.publicKey.X)));
     Xml.Append("\" xmlns=\"");
     Xml.Append(this.Namespace);
     Xml.Append("\" y=\"");
     Xml.Append(Convert.ToBase64String(EcAes256.ToNetwork(this.publicKey.Y)));
     Xml.Append("\"/>");
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Shared secret, for underlying AES cipher.
        /// </summary>
        public static byte[] GetSharedKey(EcAes256 LocalKey, EcAes256 RemoteKey)
        {
            string Key = LocalKey.keyString + ";" + RemoteKey.keyString;

            if (sharedSecrets.TryGetValue(Key, out byte[] SharedKey))