Class SymmetricEncryptStream
The implementation of SilverbackCryptoStream based on a SymmetricAlgorithm used to encrypt the messages.
Inherited Members
Namespace: Silverback.Messaging.Encryption
Assembly: Silverback.Integration.dll
Syntax
public class SymmetricEncryptStream : SilverbackCryptoStream, IAsyncDisposable, IDisposable
Constructors
| Improve this doc View sourceSymmetricEncryptStream(Stream, SymmetricEncryptionSettings)
Initializes a new instance of the SymmetricEncryptStream class.
Declaration
public SymmetricEncryptStream(Stream stream, SymmetricEncryptionSettings settings)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The inner Stream to read the clear-text message from. |
SymmetricEncryptionSettings | settings | The SymmetricEncryptionSettings specifying the cryptographic algorithm settings. |
Properties
| Improve this doc View sourceCryptoStream
Gets the underlying CryptoStream.
Declaration
protected override CryptoStream CryptoStream { get; }
Property Value
Type | Description |
---|---|
CryptoStream |
Overrides
Methods
| Improve this doc View sourceDispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Overrides
| Improve this doc View sourceRead(byte[], int, int)
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | An array of bytes. A maximum of |
int | offset | The byte offset in |
int | count | The maximum number of bytes to be read from the current stream. |
Returns
Type | Description |
---|---|
int | The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the end of the stream has been reached. |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | The CryptoStreamMode associated with current CryptoStream object does not match the underlying stream. For example, this exception is thrown when using Read with an underlying stream that is write only. |
ArgumentOutOfRangeException | The |
ArgumentException | The sum of the |
ReadAsync(byte[], int, int, CancellationToken)
Reads a sequence of bytes from the current stream asynchronously, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
Declaration
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | The buffer to write the data into. |
int | offset | The byte offset in |
int | count | The maximum number of bytes to read. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. The default value is None. |
Returns
Type | Description |
---|---|
Task<int> | A task that represents the asynchronous read operation. The value of the task object's |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
ArgumentException | The sum of |
NotSupportedException | The stream does not support reading. |
ObjectDisposedException | The stream has been disposed. |
InvalidOperationException | The stream is currently in use by a previous read operation. |