Class RSACryptoStream
Implements a stream that reads and writes RSA‑encrypted information on a specified Stream.
Inherited Members
Namespace: TheXDS.MCART.Security.Cryptography
Assembly: MCART.Windows.dll
Syntax
public class RSACryptoStream : Stream, IAsyncDisposable, IDisposable
Constructors
| Edit this page View SourceRSACryptoStream(Stream)
Initializes a new instance of the RSACryptoStream class.
Declaration
public RSACryptoStream(Stream underlyingStream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | underlyingStream | The underlying Stream on which to perform read/write operations. |
RSACryptoStream(Stream, byte[])
Initializes a new instance of the RSACryptoStream class.
Declaration
public RSACryptoStream(Stream underlyingStream, byte[] keyBlob)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | underlyingStream | The underlying Stream on which to perform read/write operations. |
| byte[] | keyBlob | A binary blob containing the RSA keys to use. |
RSACryptoStream(Stream, int)
Initializes a new instance of the RSACryptoStream class.
Declaration
public RSACryptoStream(Stream underlyingStream, int keySize)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | underlyingStream | The underlying Stream on which to perform read/write operations. |
| int | keySize | The key size to generate for the RSA algorithm. |
RSACryptoStream(Stream, int, CspParameters)
Initializes a new instance of the RSACryptoStream class.
Declaration
public RSACryptoStream(Stream underlyingStream, int dwKeySize, CspParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | underlyingStream | The underlying Stream on which read/write operations are performed. |
| int | dwKeySize | Length of the keys to generate for RSA. |
| CspParameters | parameters | Configuration parameters to use for RSA. |
RSACryptoStream(Stream, CspParameters)
Initializes a new instance of the RSACryptoStream class.
Declaration
public RSACryptoStream(Stream underlyingStream, CspParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | underlyingStream | The underlying Stream on which to perform read/write operations. |
| CspParameters | parameters | Configuration parameters to use for RSA. |
RSACryptoStream(Stream, RSACryptoServiceProvider)
Implements a stream that reads and writes RSA‑encrypted information on a specified Stream.
Declaration
public RSACryptoStream(Stream underlyingStream, RSACryptoServiceProvider rsa)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | underlyingStream | The underlying Stream on which to perform read/write operations. |
| RSACryptoServiceProvider | rsa | The RSACryptoServiceProvider instance used to perform encryption/decryption. |
RSACryptoStream(Stream, RSAParameters)
Initializes a new instance of the RSACryptoStream class.
Declaration
public RSACryptoStream(Stream underlyingStream, RSAParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | underlyingStream | The underlying Stream on which to perform read/write operations. |
| RSAParameters | parameters | Configuration parameters to use for RSA. |
Properties
| Edit this page View SourceBaseStream
Gets a reference to the Stream in which this instance reads and writes data.
Declaration
public Stream BaseStream { get; }
Property Value
| Type | Description |
|---|---|
| Stream |
CanRead
Gets a value that indicates whether this Stream can be read.
Declaration
public override bool CanRead { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceCanSeek
Gets a value that indicates whether this Stream allows seeking through its content.
Declaration
public override bool CanSeek { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceCanWrite
Gets a value that indicates whether data can be written to this Stream.
Declaration
public override bool CanWrite { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceLength
Gets the length of this Stream.
Declaration
public override long Length { get; }
Property Value
| Type | Description |
|---|---|
| long |
Overrides
| Edit this page View SourcePosition
Gets or sets the current position within this Stream.
Declaration
public override long Position { get; set; }
Property Value
| Type | Description |
|---|---|
| long |
Overrides
Methods
| Edit this page View SourceFlush()
Flushes the write buffers of this Stream, causing any buffered data to be written to the underlying device.
Declaration
public override void Flush()
Overrides
| Edit this page View SourceRead(byte[], int, int)
Reads the entire content of this Stream.
Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | buffer | Output data buffer. |
| int | offset | Offset at which to begin writing data. |
| int | count | Maximum number of bytes to write to the output buffer. |
Returns
| Type | Description |
|---|---|
| int | The number of bytes read into the output buffer. |
Overrides
| Edit this page View SourceReadToEnd()
Reads the entire content of this Stream.
Declaration
public byte[] ReadToEnd()
Returns
| Type | Description |
|---|---|
| byte[] | The data read from this Stream. |
Seek(long, SeekOrigin)
Seeks within the readable cursor of this Stream.
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
| Type | Name | Description |
|---|---|---|
| long | offset | The number of positions to move the cursor. |
| SeekOrigin | origin | The origin point for the offset. |
Returns
| Type | Description |
|---|---|
| long | The number of bytes the cursor has moved. |
Overrides
| Edit this page View SourceSetLength(long)
Sets the length of this Stream.
Declaration
public override void SetLength(long value)
Parameters
| Type | Name | Description |
|---|---|---|
| long | value |
Overrides
| Edit this page View SourceWrite(byte[], int, int)
Writes a sequence of data to this Stream.
Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | buffer | The data buffer to write. |
| int | offset | The offset from which to read the data to write. |
| int | count | The number of bytes to write. |