Beispiel #1
0
        /// <summary>
        /// Initializes the negotiation. must be called before any other method.
        /// </summary>
        /// <param name="enableEncryption">Enable encryption.</param>
        /// <param name="cryptographyProvider">The cryptography provider.</param>
        public void Reset(bool enableEncryption, IResonanceCryptographyProvider cryptographyProvider)
        {
            ClientID = Guid.NewGuid().GetHashCode();

            EncryptionEnabled = enableEncryption;

            State = ResonanceHandShakeState.Idle;

            _cryptographyProvider = cryptographyProvider;
            var keys = _cryptographyProvider.CreateKeys();

            _privateKey = keys.PrivateKey;
            _publicKey  = keys.PublicKey;

            _wasReset = true;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ResonanceCryptographyConfiguration"/> class.
 /// </summary>
 public ResonanceCryptographyConfiguration()
 {
     CryptographyProvider = new RSACryptographyProvider();
 }