protected virtual CryptoStream CreateEncryptingStream( Stream encryptedStream) { if (encryptedStream == null) { throw new ArgumentNullException(nameof(encryptedStream)); } if (!encryptedStream.CanWrite) { throw new ArgumentException(Resources.StreamNotWritable, nameof(encryptedStream)); } return(new CryptoStream( encryptedStream, Symmetric.CreateEncryptor(), CryptoStreamMode.Write)); }