1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-18 02:12:06 +01:00

Clean up CachingBcPublicKeyDataDecryptorFactory

This commit is contained in:
Paul Schaub 2022-11-23 20:07:03 +01:00
parent b495e602e5
commit be7349f0b5

View file

@ -59,16 +59,20 @@ public class CachingBcPublicKeyDataDecryptorFactory
}
private byte[] lookupSessionKeyData(byte[][] secKeyData) {
byte[] sk = secKeyData[0];
String key = Base64.toBase64String(sk);
String key = toKey(secKeyData);
byte[] sessionKey = cachedSessionKeys.get(key);
return copy(sessionKey);
}
private void cacheSessionKeyData(byte[][] secKeyData, byte[] sessionKey) {
String key = toKey(secKeyData);
cachedSessionKeys.put(key, copy(sessionKey));
}
private static String toKey(byte[][] secKeyData) {
byte[] sk = secKeyData[0];
String key = Base64.toBase64String(sk);
cachedSessionKeys.put(key, copy(sessionKey));
return key;
}
private static byte[] copy(byte[] bytes) {