RSAOpenSsl Constructors

Definition

Overloads

RSAOpenSsl()

Initializes a new instance of the RSAOpenSsl class with a random 2048-bit key pair.

RSAOpenSsl(Int32)

Initializes a new instance of the RSAOpenSsl class with a randomly generated key of the specified size.

RSAOpenSsl(IntPtr)

Initializes a new instance of the RSAOpenSsl class from an existing OpenSSL key represented as an RSA*.

RSAOpenSsl(RSAParameters)

Initializes a new instance of the RSAOpenSsl class using specified key parameters.

RSAOpenSsl(SafeEvpPKeyHandle)

Initializes a new instance of the RSAOpenSsl class from an existing OpenSSL key represented as an EVP_PKEY*.

RSAOpenSsl()

Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs

Initializes a new instance of the RSAOpenSsl class with a random 2048-bit key pair.

public:
 RSAOpenSsl();
public RSAOpenSsl ();
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
public RSAOpenSsl ();
Public Sub New ()
Attributes

Remarks

This constructor does not generate a new public/private keypair immediately. This constructor sets the KeySize property to 2048 and when a key is needed, one is generated using the property value. If a key is loaded via the ImportParameters method or another key import method, the key size from this constructor has no meaning.

Applies to

RSAOpenSsl(Int32)

Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs

Initializes a new instance of the RSAOpenSsl class with a randomly generated key of the specified size.

public:
 RSAOpenSsl(int keySize);
public RSAOpenSsl (int keySize);
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
public RSAOpenSsl (int keySize);
new System.Security.Cryptography.RSAOpenSsl : int -> System.Security.Cryptography.RSAOpenSsl
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("windows")>]
new System.Security.Cryptography.RSAOpenSsl : int -> System.Security.Cryptography.RSAOpenSsl
Public Sub New (keySize As Integer)

Parameters

keySize
Int32

The size of the key to generate in bits.

Attributes

Exceptions

keySize is not valid.

Applies to

RSAOpenSsl(IntPtr)

Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs

Initializes a new instance of the RSAOpenSsl class from an existing OpenSSL key represented as an RSA*.

public:
 RSAOpenSsl(IntPtr handle);
public RSAOpenSsl (IntPtr handle);
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
public RSAOpenSsl (IntPtr handle);
new System.Security.Cryptography.RSAOpenSsl : nativeint -> System.Security.Cryptography.RSAOpenSsl
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("windows")>]
new System.Security.Cryptography.RSAOpenSsl : nativeint -> System.Security.Cryptography.RSAOpenSsl
Public Sub New (handle As IntPtr)

Parameters

handle
IntPtr

nativeint

The OpenSSL RSA* value to use as the key.

Attributes

Exceptions

handle is not a valid RSA*.

handle is invalid

Remarks

Important

OpenSSL supports multiple library versions being loaded within the same process. Before calling this constructor, verify that your pointer value came from the same version of OpenSSL that this class uses. For more information, see OpenSslVersion.

Applies to

RSAOpenSsl(RSAParameters)

Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs

Initializes a new instance of the RSAOpenSsl class using specified key parameters.

public:
 RSAOpenSsl(System::Security::Cryptography::RSAParameters parameters);
public RSAOpenSsl (System.Security.Cryptography.RSAParameters parameters);
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
public RSAOpenSsl (System.Security.Cryptography.RSAParameters parameters);
new System.Security.Cryptography.RSAOpenSsl : System.Security.Cryptography.RSAParameters -> System.Security.Cryptography.RSAOpenSsl
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("windows")>]
new System.Security.Cryptography.RSAOpenSsl : System.Security.Cryptography.RSAParameters -> System.Security.Cryptography.RSAOpenSsl
Public Sub New (parameters As RSAParameters)

Parameters

parameters
RSAParameters

The parameters for the key.

Attributes

Exceptions

parameters is not a valid RSA key.

Remarks

This constructor is equivalent to using the default constructor and calling ImportParameters.

Applies to

RSAOpenSsl(SafeEvpPKeyHandle)

Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs
Source:
RSAOpenSsl.cs

Initializes a new instance of the RSAOpenSsl class from an existing OpenSSL key represented as an EVP_PKEY*.

public:
 RSAOpenSsl(System::Security::Cryptography::SafeEvpPKeyHandle ^ pkeyHandle);
public RSAOpenSsl (System.Security.Cryptography.SafeEvpPKeyHandle pkeyHandle);
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
public RSAOpenSsl (System.Security.Cryptography.SafeEvpPKeyHandle pkeyHandle);
new System.Security.Cryptography.RSAOpenSsl : System.Security.Cryptography.SafeEvpPKeyHandle -> System.Security.Cryptography.RSAOpenSsl
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("windows")>]
new System.Security.Cryptography.RSAOpenSsl : System.Security.Cryptography.SafeEvpPKeyHandle -> System.Security.Cryptography.RSAOpenSsl
Public Sub New (pkeyHandle As SafeEvpPKeyHandle)

Parameters

pkeyHandle
SafeEvpPKeyHandle

The OpenSSL EVP_PKEY* value to use as the key, represented as a SafeEvpPKeyHandle.

Attributes

Exceptions

pkeyHandle does not represent an RSA key.

pkeyHandle is null

pkeyHandle is invalid according to IsInvalid.

Remarks

In .NET 9 and later versions, external modifications of pkeyHandle also affect the handle stored in the instance that this constructor creates.

Important

OpenSSL supports multiple library versions being loaded within the same process. Before calling this constructor, verify that your pointer value came from the same version of OpenSSL that this class uses. For more information, see OpenSslVersion.

Applies to