mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
move yggdrasil key, player textures test
This commit is contained in:
parent
af542b2dfc
commit
9f97b027bc
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.entities.entities.player.properties.textures
|
||||
|
||||
import org.testng.Assert.assertEquals
|
||||
import org.testng.Assert.assertNotNull
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test(groups = ["skin"], dependsOnGroups = ["yggdrasil"])
|
||||
class PlayerTexturesTest {
|
||||
|
||||
|
||||
fun `deserialize and check signature`() {
|
||||
val encoded = "ewogICJ0aW1lc3RhbXAiIDogMTY5OTcxMDcwMzI3MiwKICAicHJvZmlsZUlkIiA6ICIyNGYwZDRhMjE3ODc0NzYxYWVlZjM5YzkwODI0ZTc0NiIsCiAgInByb2ZpbGVOYW1lIiA6ICJ0aGV3YXRpbmciLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDcxYzNhZGVmMmVjMGNiNTBlYmVhODg0MDMxOTQ1ZmU2MDRhMDdkNzI5ZjI4ZjE0MWU5MWUzZDZmZGI3NzE1ZiIKICAgIH0KICB9Cn0="
|
||||
val signature = "evh4Zmc2Pp+n3ZBmmKb+Bdg4psOfhW5qqFuY3vyRxUKDxIE31AnNvwEUBnAYH3NnocOxD15MsxFYKplVKP7AOf4HuC7ELkux1MhsQRHU6P5/ky/wuQFr3sC/KKpIihkjUQgozJqaTmGSXcrlp75CTUzAK49cwXt7Mi9xgpsrQTtOgMgIAErXc4in8pJJ8j5QhqleCxmH6dWYDeFBRt9bGPo6rceHhBuKlV6O5sVu8CqE5Rz7p4/MSgzRDTKclqUZghYZ3v9pGjz1tp6KY9RkMbXjSjpBxkWdGER2Z3C8euPqPSB1r37QUZrcVLkuRQ0jPzthMHSvDKJ6ugX0JJgXC0rzNtbopkXn43XqwfutcceWF5D3RjPgbEBmHQeO9jNS9XOpMHecU2MZY304c1Lhhn1lIBmpP4ckReJiTXl9axyOtQY2MnuHdxLQD/UKg5Y8ILjAzxnRr26FSHWrnS/nevL/D98W2XR3YfDX7TjpjBK0kihGIEA2/FBh2vu6ta9TwhOUH9JgVEaSkdv0jMBUgkJOrlxImpWJLkzD2c13m/Z6Tn7pOZK73QZXKLJWazT0bUUOl42G1VXixBBMjoCUwyrbFUXMG1fl97MR897gep5+RjqMCvlf1lwl/JYS8ITs+eZbPzZsy01k4kUjdhskyaNyflDY8fz7qcVBVA6EFP0="
|
||||
|
||||
val textures = PlayerTextures.of(encoded, signature)
|
||||
|
||||
assertEquals(textures.name, "thewating")
|
||||
assertNotNull(textures.skin)
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.data.registries.identified
|
||||
|
||||
object Namespaces {
|
||||
const val MINECRAFT = "minecraft"
|
||||
const val MOJANG = "mojang"
|
||||
const val MINOSOFT = "minosoft"
|
||||
const val DEFAULT = MINECRAFT
|
||||
|
||||
@ -23,6 +24,10 @@ object Namespaces {
|
||||
return ResourceLocation(MINECRAFT, path)
|
||||
}
|
||||
|
||||
fun mojang(path: String): ResourceLocation {
|
||||
return ResourceLocation(MOJANG, path)
|
||||
}
|
||||
|
||||
fun minosoft(path: String): ResourceLocation {
|
||||
return ResourceLocation(MINOSOFT, path)
|
||||
}
|
||||
|
@ -223,6 +223,7 @@ class PlayInByteBuffer : InByteBuffer {
|
||||
|
||||
fun readPlayerProperties(): PlayerProperties {
|
||||
var textures: PlayerTextures? = null
|
||||
|
||||
for (i in 0 until readVarInt()) {
|
||||
val name = readString()
|
||||
val value = readString()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,8 +14,8 @@
|
||||
package de.bixilon.minosoft.util.yggdrasil
|
||||
|
||||
import de.bixilon.minosoft.Minosoft
|
||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.mojang
|
||||
import de.bixilon.minosoft.terminal.RunConfiguration
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
@ -36,7 +36,7 @@ object YggdrasilUtil {
|
||||
return
|
||||
}
|
||||
check(!this::PUBLIC_KEY.isInitialized) { "Already loaded!" }
|
||||
val spec = X509EncodedKeySpec(Minosoft.MINOSOFT_ASSETS_MANAGER["minosoft:mojang/yggdrasil_session_pubkey.der".toResourceLocation()].readAllBytes())
|
||||
val spec = X509EncodedKeySpec(Minosoft.MINOSOFT_ASSETS_MANAGER[mojang("yggdrasil/pubkey.der")].readAllBytes())
|
||||
val keyFactory: KeyFactory = KeyFactory.getInstance("RSA")
|
||||
PUBLIC_KEY = keyFactory.generatePublic(spec)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user