Improve session encryption handling

This commit is contained in:
Melledy
2025-10-30 01:01:21 -07:00
parent ebc48ab955
commit 89ecd29761
4 changed files with 26 additions and 3 deletions

View File

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