Class SilverbackCryptoStream
The base class for the Stream implementations used to encrypt and decrypt the integration messages.
Inheritance
Inherited Members
Namespace: Silverback.Messaging.Encryption
Assembly: Silverback.Integration.dll
Syntax
public abstract class SilverbackCryptoStream : Stream, IAsyncDisposable, IDisposable
Properties
| Improve this doc View sourceCanRead
Gets a value indicating whether the current CryptoStream is readable.
Declaration
public override bool CanRead { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Improve this doc View sourceCanSeek
Gets a value indicating whether you can seek within the current CryptoStream.
Declaration
public override bool CanSeek { get; }
Property Value
Type | Description |
---|---|
bool | Always false. |
Overrides
| Improve this doc View sourceCanWrite
Gets a value indicating whether the current CryptoStream is writable.
Declaration
public override bool CanWrite { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Improve this doc View sourceCryptoStream
Gets the underlying CryptoStream.
Declaration
protected abstract CryptoStream CryptoStream { get; }
Property Value
Type | Description |
---|---|
CryptoStream |
Length
Gets the length in bytes of the stream.
Declaration
public override long Length { get; }
Property Value
Type | Description |
---|---|
long | This property is not supported. |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | This property is not supported. |
Position
Gets or sets the position within the current stream.
Declaration
public override long Position { get; set; }
Property Value
Type | Description |
---|---|
long | This property is not supported. |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | This property is not supported. |
Methods
| Improve this doc View sourceClose()
Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. Instead of calling this method, ensure that the stream is properly disposed.
Declaration
public override void Close()
Overrides
| Improve this doc View sourceFlush()
Clears all buffers for the current stream and causes any buffered data to be written to the underlying device.
Declaration
public override void Flush()
Overrides
| Improve this doc View sourceFlushAsync(CancellationToken)
Clears all buffers for the current stream asynchronously, causes any buffered data to be written to the underlying device, and monitors cancellation requests.
Declaration
public override Task FlushAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The token to monitor for cancellation requests. The default value is None. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous flush operation. |
Overrides
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The stream has been disposed. |
Read(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. |
Seek(long, SeekOrigin)
Sets the position within the current stream.
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Type | Name | Description |
---|---|---|
long | offset | A byte offset relative to the |
SeekOrigin | origin | A SeekOrigin object indicating the reference point used to obtain the new position. |
Returns
Type | Description |
---|---|
long | This method is not supported. |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | This method is not supported. |
SetLength(long)
Sets the length of the current stream.
Declaration
public override void SetLength(long value)
Parameters
Type | Name | Description |
---|---|---|
long | value | The desired length of the current stream in bytes. |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | This property exists only to support inheritance from Stream, and cannot be used. |
Write(byte[], int, int)
Writes a sequence of bytes to the current CryptoStream and advances the current position within the stream by the number of bytes written.
Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | An array of bytes. This method copies |
int | offset | The byte offset in |
int | count | The number of bytes to be written to the current stream. |
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 Write with an underlying stream that is read only. |
ArgumentOutOfRangeException | The |
ArgumentException | The sum of the |
WriteAsync(byte[], int, int, CancellationToken)
Writes a sequence of bytes to the current stream asynchronously, advances the current position within the stream by the number of bytes written, and monitors cancellation requests.
Declaration
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | The buffer to write data from. |
int | offset | The zero-based byte offset in |
int | count | The maximum number of bytes to write. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. The default value is None. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous write operation. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
ArgumentException | The sum of |
NotSupportedException | The stream does not support writing. |
ObjectDisposedException | The stream has been disposed. |
InvalidOperationException | The stream is currently in use by a previous write operation. |