Improve session encryption handling

This commit is contained in:
Melledy committed 2025-10-30 01:01:21 -07:00
1 parent ebc48ab955
commit 89ecd29761
4 files changed
+26 -3

No files matched your search

@@ -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 {