Show / Hide Table of Contents

Class RSACryptoTransform

Implements a cryptographic transformation that encrypts data using the RSA algorithm.

Inheritance
object
Disposable
RSACryptoTransform
Implements
IDisposableEx
ICryptoTransform
IDisposable
Inherited Members
Disposable.IsDisposed
Disposable.Dispose(bool)
Disposable.OnFinalize()
Disposable.Dispose()
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 RSACryptoTransform : Disposable, IDisposableEx, ICryptoTransform, IDisposable

Constructors

| Edit this page View Source

RSACryptoTransform()

Initializes a new instance of the RSACryptoTransform class, generating a 4096‑bit RSA key.

Declaration
public RSACryptoTransform()
| Edit this page View Source

RSACryptoTransform(byte[])

Initializes a new instance of the RSACryptoTransform class using the specified byte blob containing RSA configuration information.

Declaration
public RSACryptoTransform(byte[] keyBlob)
Parameters
Type Name Description
byte[] keyBlob

Binary CSP blob that contains the RSA key configuration.

| Edit this page View Source

RSACryptoTransform(int)

Initializes a new instance of the RSACryptoTransform class with the specified RSA key size.

Declaration
public RSACryptoTransform(int keySize)
Parameters
Type Name Description
int keySize

Size of the RSA key to generate.

| Edit this page View Source

RSACryptoTransform(int, CspParameters)

Initializes a new instance of the RSACryptoTransform class, specifying the key size and CspParameters for initialization.

Declaration
public RSACryptoTransform(int dwKeySize, CspParameters parameters)
Parameters
Type Name Description
int dwKeySize

RSA key size to use.

CspParameters parameters

CspParameters for the RSA provider.

| Edit this page View Source

RSACryptoTransform(CspParameters)

Initializes a new instance of the RSACryptoTransform class, specifying the CspParameters to use for initialization.

Declaration
public RSACryptoTransform(CspParameters parameters)
Parameters
Type Name Description
CspParameters parameters

CspParameters for the RSA provider.

| Edit this page View Source

RSACryptoTransform(RSACryptoServiceProvider)

Initializes a new instance of the RSACryptoTransform class with the supplied RSACryptoServiceProvider.

Declaration
public RSACryptoTransform(RSACryptoServiceProvider rsa)
Parameters
Type Name Description
RSACryptoServiceProvider rsa
| Edit this page View Source

RSACryptoTransform(RSAParameters)

Initializes a new instance of the RSACryptoTransform class, specifying the RSA parameters to use for initialization.

Declaration
public RSACryptoTransform(RSAParameters parameters)
Parameters
Type Name Description
RSAParameters parameters

RSA initialization parameters.

Properties

| Edit this page View Source

CanReuseTransform

Indicates whether this ICryptoTransform can be reused to transform more than one block.

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

CanTransformMultipleBlocks

Indicates whether this ICryptoTransform can transform multiple blocks.

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

InputBlockSize

Gets the input block size for the transformation.

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

OutputBlockSize

Gets the output block size for the transformation.

Declaration
public int OutputBlockSize { get; }
Property Value
Type Description
int

Methods

| Edit this page View Source

GetRSACspBlob(bool)

Exports the RSA CSP blob for this RSACryptoTransform.

Declaration
public byte[] GetRSACspBlob(bool includePrivateParameters)
Parameters
Type Name Description
bool includePrivateParameters

Indicates whether to include private key parameters in the exported value.

Returns
Type Description
byte[]

The RSA CSP blob for this RSACryptoTransform.

| Edit this page View Source

GetRSAParameters(bool)

Gets the RSA parameters for this RSACryptoTransform.

Declaration
public RSAParameters GetRSAParameters(bool includePrivateParameters)
Parameters
Type Name Description
bool includePrivateParameters

Indicates whether to include private key parameters in the exported value.

Returns
Type Description
RSAParameters

The RSA parameters for this RSACryptoTransform.

| Edit this page View Source

OnDispose()

Releases all resources used by this object.

Declaration
protected override void OnDispose()
Overrides
Disposable.OnDispose()
| Edit this page View Source

ToStream(Stream, RSACryptoServiceProvider)

Instantiates a new CryptoStream using the RSACryptoServiceProvider instance to create a new RSACryptoTransform.

Declaration
public static CryptoStream ToStream(Stream stream, RSACryptoServiceProvider rsa)
Parameters
Type Name Description
Stream stream

Stream on which to write the encrypted data.

RSACryptoServiceProvider rsa

RSACryptoServiceProvider instance to use for constructing the new RSACryptoTransform.

Returns
Type Description
CryptoStream

A new CryptoStream with the specified destination and transformation object.

| Edit this page View Source

TransformBlock(byte[], int, int, byte[], int)

Performs the transformation of a block of data.

Declaration
public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
Parameters
Type Name Description
byte[] inputBuffer

Input data buffer.

int inputOffset

Offset within the input buffer from which to begin reading data.

int inputCount

Number of bytes from the input buffer to transform.

byte[] outputBuffer

Output buffer for the transformed data.

int outputOffset

Offset within the output buffer at which to start writing.

Returns
Type Description
int

The number of bytes written to the output buffer.

| Edit this page View Source

TransformFinalBlock(byte[], int, int)

Performs the transformation of the final block of data.

Declaration
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
Parameters
Type Name Description
byte[] inputBuffer

Input data buffer.

int inputOffset

Offset within the input buffer from which to begin reading.

int inputCount

Number of bytes from the input buffer to transform.

Returns
Type Description
byte[]

The transformed data block.

Implements

IDisposableEx
ICryptoTransform
IDisposable

Extension Methods

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.ShallowClone<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