Skip to content

Class IdentifiedKey

Namespace: Void.Minecraft.Profiles
Assembly: Void.Minecraft.dll

Represents the signed public key data used to identify Minecraft chat signatures.

public record IdentifiedKey : IEquatable<IdentifiedKey>

Inheritance

objectIdentifiedKey

Implements

IEquatable<IdentifiedKey>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

IdentifiedKey(IdentifiedKeyRevision, long, byte[], byte[])

Represents the signed public key data used to identify Minecraft chat signatures.

public IdentifiedKey(IdentifiedKeyRevision Revision, long ExpiresAt, byte[] PublicKey, byte[] Signature)

Parameters

Revision IdentifiedKeyRevision

The key-signature layout and protocol applicability.

ExpiresAt long

The expiration timestamp encoded by the protocol.

PublicKey byte[]

The DER-encoded subject public key. The supplied array is retained without copying.

Signature byte[]

The Yggdrasil signature over the key data. The supplied array is retained without copying.

Fields

YggdrasilSessionPublicKey

The DER-encoded Yggdrasil session public key used to validate profile public-key signatures.

public static readonly byte[] YggdrasilSessionPublicKey

Field Value

byte[]

Properties

ExpiresAt

The expiration timestamp encoded by the protocol.

public long ExpiresAt { get; init; }

Property Value

long

IsSignatureValid

Gets or sets the cached result of validating the Yggdrasil key signature.

public bool IsSignatureValid { get; set; }

Property Value

bool

ProfileUuid

Gets or sets the profile UUID linked to this key.

public Uuid ProfileUuid { get; set; }

Property Value

Uuid

Remarks

Assigning this property directly does not invalidate a previously cached value.

PublicKey

The DER-encoded subject public key. The supplied array is retained without copying.

public byte[] PublicKey { get; init; }

Property Value

byte[]

Revision

The key-signature layout and protocol applicability.

public IdentifiedKeyRevision Revision { get; init; }

Property Value

IdentifiedKeyRevision

Signature

The Yggdrasil signature over the key data. The supplied array is retained without copying.

public byte[] Signature { get; init; }

Property Value

byte[]

Methods

AddUuid(Uuid)

Associates a profile UUID with this key after validating its Yggdrasil signature.

public bool AddUuid(Uuid uuid)

Parameters

uuid Uuid

The profile UUID to associate.

Returns

bool

true when the UUID is nonzero and either matches an already associated valid UUID or validates successfully; otherwise, false.

Remarks

A successful first association sets and caches as true.

VerifyDataSignature(ReadOnlySpan<byte>, params ReadOnlySpan<byte>)

Verifies a SHA-256 PKCS#1 signature using this profile public key.

public bool VerifyDataSignature(ReadOnlySpan<byte> signature, params ReadOnlySpan<byte> data)

Parameters

signature ReadOnlySpan<byte>

The signature bytes to verify.

data ReadOnlySpan<byte>

The data bytes covered by the signature.

Returns

bool

true when verification succeeds; otherwise, false. Invalid key material and cryptographic errors are reported as false.