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; }
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); }
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)); }
/// <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; }
public static Task StartAsync(RSAAsymmetricKey key) { return Task.Factory.StartNew (Start, key, TaskCreationOptions.HideScheduler); }
/// <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; }
/// <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; }
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); }