Signer .java

net.minecraft.util.Signer (interface, 30 lines): members: sign, LOGGER. strings: "Failed to sign message". imports: LogUtils.

net.minecraft.utilinterface30 linescommon732 B

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (1)

LOGGER

String literals (1)

"Failed to sign message"

Code Graph: Dependencies (1)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

Signer.java30 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util;
2
3
import com.mojang.logging.LogUtils;
4
import java.security.PrivateKey;
5
import java.security.Signature;
6
import org.slf4j.Logger;
7
8
public interface Signer {
9
	Logger LOGGER = LogUtils.getLogger();
10
11
	byte[] sign(SignatureUpdater updater);
12
13
	default byte[] sign(final byte[] payload) {
14
		return this.sign(output -> output.update(payload));
15
	}
16
17
	static Signer from(final PrivateKey privateKey, final String algorithm) {
18
		return updater -> {
19
			try {
20
				Signature signer = Signature.getInstance(algorithm);
21
				signer.initSign(privateKey);
22
				updater.update(signer::update);
23
				return signer.sign();
24
			} catch (Exception e) {
25
				throw new IllegalStateException("Failed to sign message", e);
26
			}
27
		};
28
	}
29
}
30

Decompiled Minecraft 26.3 source of Signer (net/minecraft/util/Signer.java) with Mojang official mappings, stored verbatim on the site.