mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-16 22:34:41 +01:00
Improve session encryption handling
This commit is contained in:
@@ -36,6 +36,24 @@ public class AeadHelper {
|
||||
return iv;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static byte[] encrypt(byte[] data, byte[] sessionKey, int method) throws Exception {
|
||||
if (method == 1) {
|
||||
return encryptChaCha(data, sessionKey);
|
||||
} else {
|
||||
return encryptGCM(data, sessionKey);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] decrypt(byte[] data, byte[] sessionKey, int method) throws Exception {
|
||||
if (method == 1) {
|
||||
return decryptChaCha(data, sessionKey);
|
||||
} else {
|
||||
return decryptGCM(data, sessionKey);
|
||||
}
|
||||
}
|
||||
|
||||
// AES CBC
|
||||
|
||||
public static byte[] encryptCBC(byte[] messageData) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user