public class CryptUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.security.PublicKey |
MOJANG_PUBLIC_KEY |
static java.security.Signature |
MOJANG_PUBLIC_KEY_SIGNATURE |
| Constructor and Description |
|---|
CryptUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
computeServerIdHash(java.lang.String serverId,
java.security.PublicKey publicKey,
javax.crypto.SecretKey secretKey) |
static java.security.PublicKey |
decodeRsaPublicKey(byte[] key) |
static byte[] |
decryptData(java.security.Key key,
byte[] data) |
static javax.crypto.SecretKey |
decryptSecretKey(java.security.PrivateKey privateKey,
byte[] encryptedSecretKey) |
static java.lang.String |
encodeRsaPublicKey(java.security.PublicKey key) |
static byte[] |
encryptData(java.security.Key key,
byte[] data) |
static java.security.KeyPair |
generateKeyPair() |
static javax.crypto.SecretKey |
generateSecretKey() |
static byte[] |
signNonce(java.security.PrivateKey privateKey,
byte[] nonce,
long salt) |
static boolean |
verifySignedNonce(java.security.PublicKey publicKey,
byte[] nonce,
long salt,
byte[] signature) |
public static final java.security.PublicKey MOJANG_PUBLIC_KEY
public static final java.security.Signature MOJANG_PUBLIC_KEY_SIGNATURE
public static javax.crypto.SecretKey generateSecretKey()
public static java.security.KeyPair generateKeyPair()
public static java.security.PublicKey decodeRsaPublicKey(byte[] key)
public static java.lang.String encodeRsaPublicKey(java.security.PublicKey key)
public static javax.crypto.SecretKey decryptSecretKey(java.security.PrivateKey privateKey,
byte[] encryptedSecretKey)
public static byte[] encryptData(java.security.Key key,
byte[] data)
public static byte[] decryptData(java.security.Key key,
byte[] data)
public static byte[] computeServerIdHash(java.lang.String serverId,
java.security.PublicKey publicKey,
javax.crypto.SecretKey secretKey)
public static boolean verifySignedNonce(java.security.PublicKey publicKey,
byte[] nonce,
long salt,
byte[] signature)
public static byte[] signNonce(java.security.PrivateKey privateKey,
byte[] nonce,
long salt)