mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 21:01:02 -05:00
Change key generation back to just "AES", be explicit when getting Cipher instance.
This commit is contained in:
parent
2aa66f73e1
commit
2a8483a155
1 changed files with 3 additions and 3 deletions
|
@ -23,7 +23,7 @@ public class CryptUtil {
|
|||
|
||||
public static SecretKey generateSharedKey() {
|
||||
try {
|
||||
KeyGenerator gen = KeyGenerator.getInstance("AES/CFB8/NoPadding");
|
||||
KeyGenerator gen = KeyGenerator.getInstance("AES");
|
||||
gen.init(128);
|
||||
return gen.generateKey();
|
||||
} catch(NoSuchAlgorithmException e) {
|
||||
|
@ -50,7 +50,7 @@ public class CryptUtil {
|
|||
}
|
||||
|
||||
public static SecretKey decryptSharedKey(PrivateKey privateKey, byte[] sharedKey) {
|
||||
return new SecretKeySpec(decryptData(privateKey, sharedKey), "AES/CFB8/NoPadding");
|
||||
return new SecretKeySpec(decryptData(privateKey, sharedKey), "AES");
|
||||
}
|
||||
|
||||
public static byte[] encryptData(Key key, byte[] data) {
|
||||
|
@ -63,7 +63,7 @@ public class CryptUtil {
|
|||
|
||||
private static byte[] runEncryption(int mode, Key key, byte[] data) {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance(key.getAlgorithm());
|
||||
Cipher cipher = Cipher.getInstance("AES/CFB8/NoPadding");
|
||||
cipher.init(mode, key);
|
||||
return cipher.doFinal(data);
|
||||
} catch(GeneralSecurityException e) {
|
||||
|
|
Loading…
Reference in a new issue