Inheritance: IAsymmetricKey
Ejemplo n.º 1
0
		public GablarskiSocialClient (Person person, RSAAsymmetricKey key)
			: base (new NetworkClientConnection (new [] { SocialProtocol.Instance, GablarskiProtocol.Instance }, key), person)
		{
			if (key == null)
				throw new ArgumentNullException ("key");

			this.RegisterMessageHandler<JoinVoiceMessage> (OnJoinVoiceMessage);

			InvitedToGroup += (sender, args) => args.AcceptInvite = true;
		}
Ejemplo n.º 2
0
        public void ImportKey(RSAAsymmetricKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            var rsaKey = (key as RSAAsymmetricKey);

            if (rsaKey == null)
            {
                throw new ArgumentException("key must be RSAAsymmetricKey");
            }

            this.rsaCrypto.ImportParameters(rsaKey);
        }
Ejemplo n.º 3
0
        public override bool Equals(object obj)
        {
            RSAAsymmetricKey key = (obj as RSAAsymmetricKey);

            if (key != null)
            {
                if (this.publicKey.Length != key.publicKey.Length)
                {
                    return(false);
                }

                for (int i = 0; i < this.publicKey.Length; ++i)
                {
                    if (this.publicKey[i] != key.publicKey[i])
                    {
                        return(false);
                    }
                }

                return(true);
            }

            return(base.Equals(obj));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConnectionMadeEventArgs"/> class.
        /// </summary>
        /// <param name="connection">The newly made connection.</param>
        /// <param name="publicKey">The clients public authentication key.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connection"/> is <c>null</c>.</exception>
        public ConnectionMadeEventArgs(IServerConnection connection, RSAAsymmetricKey publicKey)
        {
            if (connection == null)
                throw new ArgumentNullException ("connection");

            Connection = connection;
            ClientPublicKey = publicKey;
        }
Ejemplo n.º 5
0
 public static Task StartAsync(RSAAsymmetricKey key)
 {
     return Task.Factory.StartNew (Start, key, TaskCreationOptions.HideScheduler);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new instance of the <see cref="ClientConnectedEventArgs"/> class.
 /// </summary>
 /// <param name="connection">The connection for the event.</param>
 /// <param name="publicKey">The server's public authentication key, if it has one.</param>
 public ClientConnectedEventArgs(IClientConnection connection, RSAAsymmetricKey publicKey)
     : base(connection)
 {
     ServerPublicKey = publicKey;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Constructs and initializes a new instance of the <see cref="ClientConnectionResult"/> class.
        /// </summary>
        /// <param name="result">The result of the connection attempt.</param>
        /// <param name="publicKey">The server's public authentication key, if it has one.</param>
        public ClientConnectionResult(ConnectionResult result, RSAAsymmetricKey publicKey)
        {
            if (!Enum.IsDefined (typeof(ConnectionResult), result))
                throw new ArgumentException ("result is not a valid member of ConnectionResult", "result");

            Result = result;
            ServerPublicKey = publicKey;
        }
Ejemplo n.º 8
0
        public void ImportKey(RSAAsymmetricKey key)
        {
            if (key == null)
                throw new ArgumentNullException ("key");

            var rsaKey = (key as RSAAsymmetricKey);
            if (rsaKey == null)
                throw new ArgumentException ("key must be RSAAsymmetricKey");

            this.rsaCrypto.ImportParameters (rsaKey);
        }