Table of Contents

Class RSAPublicKey

Namespace
Yubico.YubiKey.Cryptography
Assembly
Yubico.YubiKey.dll

Represents an RSA public key.

public sealed class RSAPublicKey : PublicKey, IPublicKey, IKeyBase
Inheritance
object
RSAPublicKey
Implements
Extension Methods

Remarks

This sealed class encapsulates RSA public key parameters (Modulus and Exponent) and provides factory methods for creating instances from RSA parameters or DER-encoded data.

Properties

KeyDefinition

Gets the key definition associated with this RSA private key.

public KeyDefinition KeyDefinition { get; }

Property Value

KeyDefinition

A KeyDefinition object that describes the key's properties, including its type and length.

KeyType

Gets the type of the cryptographic key.

public override KeyType KeyType { get; }

Property Value

KeyType

A KeyType value indicating the type of the key.

Parameters

Gets the RSA cryptographic parameters required for the private key operations.

public RSAParameters Parameters { get; }

Property Value

RSAParameters

A structure containing RSA parameters, including Modulus, Exponent, D, P, Q, DP, DQ, and InverseQ values.

Remarks

This property provides access to the fundamental mathematical components needed for RSA private key operations. The parameters are used in cryptographic operations such as decryption and digital signature creation.

Methods

CreateFromParameters(RSAParameters)

Creates a new instance of RSAPublicKey from the given parameters.

public static RSAPublicKey CreateFromParameters(RSAParameters parameters)

Parameters

parameters RSAParameters

The RSA parameters containing the public key data.

Returns

RSAPublicKey

A new instance of RSAPublicKey.

Exceptions

ArgumentException

Thrown if the parameters contain private key data.

CreateFromSubjectPublicKeyInfo(ReadOnlyMemory<byte>)

Creates a new instance of IPublicKey from ASN.1 DER-encoded SubjectPublicKeyInfo.

public static RSAPublicKey CreateFromSubjectPublicKeyInfo(ReadOnlyMemory<byte> subjectPublicKeyInfo)

Parameters

subjectPublicKeyInfo ReadOnlyMemory<byte>

The DER-encoded SubjectPublicKeyInfo.

Returns

RSAPublicKey

A new instance of IPublicKey.

Exceptions

CryptographicException

Thrown if the public key is invalid.

ExportSubjectPublicKeyInfo()

Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.

public override byte[] ExportSubjectPublicKeyInfo()

Returns

byte[]

A byte array containing the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key