Package net.minecraft.network.encryption
Record Class PlayerPublicKey
java.lang.Object
java.lang.Record
net.minecraft.network.encryption.PlayerPublicKey
- Record Components:
expiresAt-keyString- the PEM-formatted X.509 encoded keysignature- the signature certifying that this key is provided from Mojang's server
An RSA public key for a player, signed by the Mojang's server.
Users cannot generate the keys themselves; this must be provided from Mojang's authentication server.
- See Also:
- Mappings:
Namespace Name official brvintermediary net/minecraft/class_7428named net/minecraft/network/encryption/PlayerPublicKeyofficial bintermediary comp_744named expiresAtofficial cintermediary comp_745named keyStringofficial dintermediary comp_746named signature
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA record holding a player's RSA public key data. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<PlayerPublicKey>private final InstantThe field for theexpiresAtrecord component.private final StringThe field for thekeyStringrecord component.private static final Stringprivate final StringThe field for thesignaturerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionPlayerPublicKey(com.mojang.datafixers.util.Pair<Instant, String> expiresAtAndKey, String signature) PlayerPublicKey(Instant instant, String string, String string2) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpiresAtrecord component.static Optional<PlayerPublicKey>fromGameProfile(com.mojang.authlib.GameProfile gameProfile) Returns the public key extracted from thegameProfile.final inthashCode()Returns a hash code value for this object.booleanReturns whether the key is expired and can no longer be used.Returns the value of thekeyStringrecord component.Returns the expiry time and the key content parsed fromcontents.Returns the value of thesignaturerecord component.com.mojang.authlib.properties.PropertyReturns the public key as an authlibProperty.final StringtoString()Returns a string representation of this record class.verifyAndDecode(com.mojang.authlib.minecraft.MinecraftSessionService sessionService) Verifies the public key and decodes it.com.mojang.authlib.GameProfilewrite(com.mojang.authlib.GameProfile gameProfile) Writes the public key to thegameProfileproperties under the "publicKey" key.
-
Field Details
-
expiresAt
The field for theexpiresAtrecord component. -
keyString
The field for thekeyStringrecord component. -
signature
The field for thesignaturerecord component. -
CODEC
- Mappings:
Namespace Name Mixin selector official aLbrv;a:Lcom/mojang/serialization/Codec;intermediary field_39050Lnet/minecraft/class_7428;field_39050:Lcom/mojang/serialization/Codec;named CODECLnet/minecraft/network/encryption/PlayerPublicKey;CODEC:Lcom/mojang/serialization/Codec;
-
PUBLIC_KEY
- See Also:
- Mappings:
Namespace Name Mixin selector official eLbrv;e:Ljava/lang/String;intermediary field_39051Lnet/minecraft/class_7428;field_39051:Ljava/lang/String;named PUBLIC_KEYLnet/minecraft/network/encryption/PlayerPublicKey;PUBLIC_KEY:Ljava/lang/String;
-
-
Constructor Details
-
PlayerPublicKey
public PlayerPublicKey(com.mojang.datafixers.util.Pair<Instant, String> expiresAtAndKey, String signature) - Mappings:
Namespace Name Mixin selector official <init>Lbrv;<init>(Lcom/mojang/datafixers/util/Pair;Ljava/lang/String;)Vintermediary <init>Lnet/minecraft/class_7428;<init>(Lcom/mojang/datafixers/util/Pair;Ljava/lang/String;)Vnamed <init>Lnet/minecraft/network/encryption/PlayerPublicKey;<init>(Lcom/mojang/datafixers/util/Pair;Ljava/lang/String;)V
-
PlayerPublicKey
-
-
Method Details
-
fromGameProfile
Returns the public key extracted from thegameProfile.- Returns:
- the public key extracted from the
gameProfile - API Note:
- This can return an empty value if the profile lacks the public key.
- Mappings:
Namespace Name Mixin selector official aLbrv;a(Lcom/mojang/authlib/GameProfile;)Ljava/util/Optional;intermediary method_43549Lnet/minecraft/class_7428;method_43549(Lcom/mojang/authlib/GameProfile;)Ljava/util/Optional;named fromGameProfileLnet/minecraft/network/encryption/PlayerPublicKey;fromGameProfile(Lcom/mojang/authlib/GameProfile;)Ljava/util/Optional;
-
write
public com.mojang.authlib.GameProfile write(com.mojang.authlib.GameProfile gameProfile) Writes the public key to thegameProfileproperties under the "publicKey" key.- Mappings:
Namespace Name Mixin selector official bLbrv;b(Lcom/mojang/authlib/GameProfile;)Lcom/mojang/authlib/GameProfile;intermediary method_43555Lnet/minecraft/class_7428;method_43555(Lcom/mojang/authlib/GameProfile;)Lcom/mojang/authlib/GameProfile;named writeLnet/minecraft/network/encryption/PlayerPublicKey;write(Lcom/mojang/authlib/GameProfile;)Lcom/mojang/authlib/GameProfile;
-
verifyAndDecode
public PlayerPublicKey.PublicKeyData verifyAndDecode(com.mojang.authlib.minecraft.MinecraftSessionService sessionService) throws com.mojang.authlib.minecraft.InsecurePublicKeyException, NetworkEncryptionException Verifies the public key and decodes it.The checks whether the public key is present, signed with the Mojang's private key, and not expired.
- Throws:
com.mojang.authlib.minecraft.InsecurePublicKeyException.MissingException- when the key is missing or emptycom.mojang.authlib.minecraft.InsecurePublicKeyException.InvalidException- when the key is unsigned or expiredNetworkEncryptionException- when the key is malformedcom.mojang.authlib.minecraft.InsecurePublicKeyException- Mappings:
Namespace Name Mixin selector official aLbrv;a(Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lbrv$a;intermediary method_43550Lnet/minecraft/class_7428;method_43550(Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lnet/minecraft/class_7428$class_7429;named verifyAndDecodeLnet/minecraft/network/encryption/PlayerPublicKey;verifyAndDecode(Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lnet/minecraft/network/encryption/PlayerPublicKey$PublicKeyData;
-
parse
Returns the expiry time and the key content parsed fromcontents.- Returns:
- the expiry time and the key content parsed from
contents - Mappings:
Namespace Name Mixin selector official aLbrv;a(Ljava/lang/String;)Ljava/util/Optional;intermediary method_43552Lnet/minecraft/class_7428;method_43552(Ljava/lang/String;)Ljava/util/Optional;named parseLnet/minecraft/network/encryption/PlayerPublicKey;parse(Ljava/lang/String;)Ljava/util/Optional;
-
toProperty
public com.mojang.authlib.properties.Property toProperty()Returns the public key as an authlibProperty.- Returns:
- the public key as an authlib
Property - Mappings:
Namespace Name Mixin selector official aLbrv;a()Lcom/mojang/authlib/properties/Property;intermediary method_43548Lnet/minecraft/class_7428;method_43548()Lcom/mojang/authlib/properties/Property;named toPropertyLnet/minecraft/network/encryption/PlayerPublicKey;toProperty()Lcom/mojang/authlib/properties/Property;
-
isExpired
public boolean isExpired()Returns whether the key is expired and can no longer be used.- Returns:
- whether the key is expired and can no longer be used
- Mappings:
Namespace Name Mixin selector official bLbrv;b()Zintermediary method_43554Lnet/minecraft/class_7428;method_43554()Znamed isExpiredLnet/minecraft/network/encryption/PlayerPublicKey;isExpired()Z
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-
keyString
Returns the value of thekeyStringrecord component.- Returns:
- the value of the
keyStringrecord component
-
signature
Returns the value of thesignaturerecord component.- Returns:
- the value of the
signaturerecord component
-