Raven.Bundles.Encryption.CodecSaltExtensions.ReadSalt C# (CSharp) Метод

ReadSalt() публичный статический Метод

public static ReadSalt ( this stream, string key ) : Stream
stream this
key string
Результат Stream
		public static Stream ReadSalt(this Stream stream, string key)
		{
			try
			{
				byte[] keyBytes = Encoding.UTF8.GetBytes(key);
				byte[] readBytes = stream.ReadEntireBlock(keyBytes.Length);
				if (!readBytes.SequenceEqual(keyBytes))
				{
					throw new InvalidDataException("The encrypted stream's salt was different than the expected salt.");
				}
				return stream;

			}
			catch (Exception ex)
			{
				throw new IOException("Encrypted stream is not correctly salted with the document key.", ex);
			}
		}
	}
CodecSaltExtensions