Class Curve25519PublicKey
- Namespace
- Yubico.YubiKey.Cryptography
- Assembly
- Yubico.YubiKey.dll
Represents a Curve25519 public key.
public sealed class Curve25519PublicKey : PublicKey, IPublicKey, IKeyBase
- Inheritance
-
objectCurve25519PublicKey
- Implements
- Extension Methods
Remarks
This sealed class encapsulates Curve25519 public key data as a compressed point and supports both Ed25519 and X25519 key types. It also provides factory methods for creating instances from public point values 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
PublicPoint
Gets the bytes representing the public key coordinates as a compressed point.
public ReadOnlyMemory<byte> PublicPoint { get; }
Property Value
- ReadOnlyMemory<byte>
A System.ReadOnlyMemory<T> containing the public key bytes.
Remarks
The public key is represented as a byte array, which is the raw public key data.
Methods
CreateFromSubjectPublicKeyInfo(ReadOnlyMemory<byte>)
Creates a new instance of Curve25519PublicKey from a DER-encoded SubjectPublicKeyInfo.
public static Curve25519PublicKey CreateFromSubjectPublicKeyInfo(ReadOnlyMemory<byte> subjectPublicKeyInfo)
Parameters
subjectPublicKeyInfo
ReadOnlyMemory<byte>The DER-encoded SubjectPublicKeyInfo.
Returns
- Curve25519PublicKey
A new instance of Curve25519PublicKey.
Exceptions
- CryptographicException
Thrown if the subjectPublicKeyInfo is invalid.
CreateFromValue(ReadOnlyMemory<byte>, KeyType)
Creates an instance of Curve25519PublicKey from the given
publicPoint
and keyType
.
public static Curve25519PublicKey CreateFromValue(ReadOnlyMemory<byte> publicPoint, KeyType keyType)
Parameters
publicPoint
ReadOnlyMemory<byte>The raw public key data, formatted as an compressed point.
keyType
KeyTypeThe type of key this is.
Returns
- Curve25519PublicKey
An instance of Curve25519PublicKey.
Exceptions
- ArgumentException
Thrown if the public key data length is not valid.
ExportSubjectPublicKeyInfo()
Converts this public key to an ASN.1 DER encoded format (X.509 SubjectPublicKeyInfo).
public override byte[] ExportSubjectPublicKeyInfo()
Returns
- byte[]
A byte array containing the ASN.1 DER encoded public key.