Beispiel #1
0
        public ConnectionReceiver(IConnectionReceiver receiver, CryptoAlgorithmType cryptoAlgorithmType, int maxReceiveByteCount, byte[] cryptoKey, byte[] nonce, IBytesPool bytesPool)
        {
            _receiver            = receiver;
            _maxReceiveByteCount = maxReceiveByteCount;

            if (cryptoAlgorithmType == CryptoAlgorithmType.Aes_Gcm_256)
            {
                _decrypter = new AesGcmDecrypter(cryptoKey, nonce, bytesPool);
            }
            else
            {
                throw new NotSupportedException(nameof(cryptoAlgorithmType));
            }

            _bytesPool = bytesPool;
        }
Beispiel #2
0
 public void AddConnectionReceiver(IConnectionReceiver receiver)
 {
     _receivers.Add(receiver);
 }
 public static bool TryReceive <T>(this IConnectionReceiver connectionReceiver, [NotNullWhen(true)] out T value)
     where T : IRocketMessage <T>
 {
     T   valueResult  = default !;