public RpcDht(IDht dht, Node node) { LocalUseOnly = true; _channels = new Brunet.Collections.Cache(100); _node = node; _dht = dht; _node.Rpc.AddHandler("DhtClient", this); }
/// <summary>Creates a new SymmetricEncryption handler for the passed in /// SymmetricAlgorithm.</summary> public SymmetricEncryption(SymmetricAlgorithm Algorithm) { if(Algorithm.Mode != CipherMode.CBC) { throw new Exception("SymmetricEncryption requires the symmetric algorithm to use CBC."); } rng = new RNGCryptoServiceProvider(); _sa = Algorithm; // We take care of PKCS7 padding here due to issues in the underlying implementations... _sa.Padding = PaddingMode.None; BlockSizeByte = _sa.BlockSize / 8; // Match the same size as our Window size... _decryptors = new Brunet.Collections.Cache(64); _enc_iv = new byte[BlockSizeByte]; rng.GetBytes(_enc_iv); _enc = _sa.CreateEncryptor(_sa.Key, _enc_iv); _temp = new byte[BlockSizeByte]; }
/// <summary>Creates a new SymmetricEncryption handler for the passed in /// SymmetricAlgorithm.</summary> public SymmetricEncryption(SymmetricAlgorithm Algorithm) { if (Algorithm.Mode != CipherMode.CBC) { throw new Exception("SymmetricEncryption requires the symmetric algorithm to use CBC."); } rng = new RNGCryptoServiceProvider(); _sa = Algorithm; // We take care of PKCS7 padding here due to issues in the underlying implementations... _sa.Padding = PaddingMode.None; BlockSizeByte = _sa.BlockSize / 8; // Match the same size as our Window size... _decryptors = new Brunet.Collections.Cache(64); _enc_iv = new byte[BlockSizeByte]; rng.GetBytes(_enc_iv); _enc = _sa.CreateEncryptor(_sa.Key, _enc_iv); _temp = new byte[BlockSizeByte]; }