Class Crypt
java.lang.Object
net.minecraft.util.Crypt
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interfaceCrypt.ByteArrayToKeyFunction<T extends Key>static final recordstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final intprivate static final Stringprivate static final Stringstatic final Base64.Encoderstatic final Stringprivate static final Stringprivate static final Stringstatic final Codec<PrivateKey> private static final Stringstatic final Stringstatic final intstatic final Stringprivate static final Stringprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static PrivateKeybyteToPrivateKey(byte[] keyData) static PublicKeybyteToPublicKey(byte[] keyData) private static byte[]cipherData(int cipherOpMode, Key key, byte[] input) static SecretKeydecryptByteToSecretKey(PrivateKey privateKey, byte[] keyData) static byte[]decryptUsingKey(Key key, byte[] input) private static byte[]digestData(byte[]... inputs) static byte[]digestData(String serverId, PublicKey publicKey, SecretKey sharedKey) static byte[]encryptUsingKey(Key key, byte[] input) static KeyPairstatic SecretKeystatic Cipherstatic StringpemRsaPrivateKeyToString(PrivateKey privateKey) static StringrsaPublicKeyToString(PublicKey publicKey) private static <T extends Key>
TrsaStringToKey(String input, String header, String footer, Crypt.ByteArrayToKeyFunction<T> byteArrayToKey) private static CiphersetupCipher(int cipherOpMode, String algorithm, Key key) static PrivateKeystringToPemRsaPrivateKey(String rsaString) static PublicKeystringToRsaPublicKey(String rsaString)
-
Field Details
-
SYMMETRIC_ALGORITHM
- See Also:
-
SYMMETRIC_BITS
private static final int SYMMETRIC_BITS- See Also:
-
ASYMMETRIC_ALGORITHM
- See Also:
-
ASYMMETRIC_BITS
private static final int ASYMMETRIC_BITS- See Also:
-
BYTE_ENCODING
- See Also:
-
HASH_ALGORITHM
- See Also:
-
SIGNING_ALGORITHM
- See Also:
-
SIGNATURE_BYTES
public static final int SIGNATURE_BYTES- See Also:
-
PEM_RSA_PRIVATE_KEY_HEADER
- See Also:
-
PEM_RSA_PRIVATE_KEY_FOOTER
- See Also:
-
RSA_PUBLIC_KEY_HEADER
- See Also:
-
RSA_PUBLIC_KEY_FOOTER
- See Also:
-
MIME_LINE_SEPARATOR
- See Also:
-
MIME_ENCODER
-
PUBLIC_KEY_CODEC
-
PRIVATE_KEY_CODEC
-
-
Constructor Details
-
Crypt
public Crypt()
-
-
Method Details
-
generateSecretKey
- Throws:
CryptException
-
generateKeyPair
- Throws:
CryptException
-
digestData
public static byte[] digestData(String serverId, PublicKey publicKey, SecretKey sharedKey) throws CryptException - Throws:
CryptException
-
digestData
-
rsaStringToKey
private static <T extends Key> T rsaStringToKey(String input, String header, String footer, Crypt.ByteArrayToKeyFunction<T> byteArrayToKey) throws CryptException - Throws:
CryptException
-
stringToPemRsaPrivateKey
- Throws:
CryptException
-
stringToRsaPublicKey
- Throws:
CryptException
-
rsaPublicKeyToString
-
pemRsaPrivateKeyToString
-
byteToPrivateKey
- Throws:
CryptException
-
byteToPublicKey
- Throws:
CryptException
-
decryptByteToSecretKey
public static SecretKey decryptByteToSecretKey(PrivateKey privateKey, byte[] keyData) throws CryptException - Throws:
CryptException
-
encryptUsingKey
- Throws:
CryptException
-
decryptUsingKey
- Throws:
CryptException
-
cipherData
- Throws:
CryptException
-
setupCipher
-
getCipher
- Throws:
CryptException
-