Show / Hide Table of Contents

Class RSACryptoStream

Implements a stream that reads and writes RSA‑encrypted information on a specified Stream.

Inheritance
object
MarshalByRefObject
Stream
RSACryptoStream
Implements
IAsyncDisposable
IDisposable
Inherited Members
Stream.Null
Stream.BeginRead(byte[], int, int, AsyncCallback, object)
Stream.BeginWrite(byte[], int, int, AsyncCallback, object)
Stream.Close()
Stream.CopyTo(Stream)
Stream.CopyTo(Stream, int)
Stream.CopyToAsync(Stream)
Stream.CopyToAsync(Stream, int)
Stream.CopyToAsync(Stream, int, CancellationToken)
Stream.CopyToAsync(Stream, CancellationToken)
Stream.CreateWaitHandle()
Stream.Dispose()
Stream.Dispose(bool)
Stream.DisposeAsync()
Stream.EndRead(IAsyncResult)
Stream.EndWrite(IAsyncResult)
Stream.FlushAsync()
Stream.FlushAsync(CancellationToken)
Stream.ObjectInvariant()
Stream.Read(Span<byte>)
Stream.ReadAsync(byte[], int, int)
Stream.ReadAsync(byte[], int, int, CancellationToken)
Stream.ReadAsync(Memory<byte>, CancellationToken)
Stream.ReadAtLeast(Span<byte>, int, bool)
Stream.ReadAtLeastAsync(Memory<byte>, int, bool, CancellationToken)
Stream.ReadByte()
Stream.ReadExactly(byte[], int, int)
Stream.ReadExactly(Span<byte>)
Stream.ReadExactlyAsync(byte[], int, int, CancellationToken)
Stream.ReadExactlyAsync(Memory<byte>, CancellationToken)
Stream.Synchronized(Stream)
Stream.ValidateBufferArguments(byte[], int, int)
Stream.ValidateCopyToArguments(Stream, int)
Stream.Write(ReadOnlySpan<byte>)
Stream.WriteAsync(byte[], int, int)
Stream.WriteAsync(byte[], int, int, CancellationToken)
Stream.WriteAsync(ReadOnlyMemory<byte>, CancellationToken)
Stream.WriteByte(byte)
Stream.CanTimeout
Stream.ReadTimeout
Stream.WriteTimeout
MarshalByRefObject.GetLifetimeService()
MarshalByRefObject.InitializeLifetimeService()
MarshalByRefObject.MemberwiseClone(bool)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Security.Cryptography
Assembly: MCART.Windows.dll
Syntax
public class RSACryptoStream : Stream, IAsyncDisposable, IDisposable

Constructors

| Edit this page View Source

RSACryptoStream(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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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 Source

BaseStream

Gets a reference to the Stream in which this instance reads and writes data.

Declaration
public Stream BaseStream { get; }
Property Value
Type Description
Stream
| Edit this page View Source

CanRead

Gets a value that indicates whether this Stream can be read.

Declaration
public override bool CanRead { get; }
Property Value
Type Description
bool
Overrides
Stream.CanRead
| Edit this page View Source

CanSeek

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
Stream.CanSeek
| Edit this page View Source

CanWrite

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
Stream.CanWrite
| Edit this page View Source

Length

Gets the length of this Stream.

Declaration
public override long Length { get; }
Property Value
Type Description
long
Overrides
Stream.Length
| Edit this page View Source

Position

Gets or sets the current position within this Stream.

Declaration
public override long Position { get; set; }
Property Value
Type Description
long
Overrides
Stream.Position

Methods

| Edit this page View Source

Flush()

Flushes the write buffers of this Stream, causing any buffered data to be written to the underlying device.

Declaration
public override void Flush()
Overrides
Stream.Flush()
| Edit this page View Source

Read(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
Stream.Read(byte[], int, int)
| Edit this page View Source

ReadToEnd()

Reads the entire content of this Stream.

Declaration
public byte[] ReadToEnd()
Returns
Type Description
byte[]

The data read from this Stream.

| Edit this page View Source

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
Stream.Seek(long, SeekOrigin)
| Edit this page View Source

SetLength(long)

Sets the length of this Stream.

Declaration
public override void SetLength(long value)
Parameters
Type Name Description
long value
Overrides
Stream.SetLength(long)
| Edit this page View Source

Write(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.

Overrides
Stream.Write(byte[], int, int)

Implements

IAsyncDisposable
IDisposable

Extension Methods

StreamExtensions.Destroy(Stream)
StreamExtensions.ReadString(Stream, int)
StreamExtensions.ReadString(Stream, int, Encoding)
StreamExtensions.ReadStringAsync(Stream, int)
StreamExtensions.ReadStringAsync(Stream, int, Encoding)
StreamExtensions.ReadStringToAsync(Stream, long)
StreamExtensions.ReadStringToEndAsync(Stream)
StreamExtensions.RemainingBytes(Stream)
StreamExtensions.Skip(Stream, int)
StreamExtensions.WriteBytes(Stream, params byte[])
StreamExtensions.WriteSeveralBytes(Stream, params byte[][])
Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Common.IfNotNull<T>(T?, Action<T>)
Objects.Itself<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX