mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-22 19:08:00 +01:00
Clean up CachingBcPublicKeyDataDecryptorFactory
This commit is contained in:
parent
b495e602e5
commit
be7349f0b5
1 changed files with 7 additions and 3 deletions
|
@ -59,16 +59,20 @@ public class CachingBcPublicKeyDataDecryptorFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] lookupSessionKeyData(byte[][] secKeyData) {
|
private byte[] lookupSessionKeyData(byte[][] secKeyData) {
|
||||||
byte[] sk = secKeyData[0];
|
String key = toKey(secKeyData);
|
||||||
String key = Base64.toBase64String(sk);
|
|
||||||
byte[] sessionKey = cachedSessionKeys.get(key);
|
byte[] sessionKey = cachedSessionKeys.get(key);
|
||||||
return copy(sessionKey);
|
return copy(sessionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cacheSessionKeyData(byte[][] secKeyData, byte[] 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];
|
byte[] sk = secKeyData[0];
|
||||||
String key = Base64.toBase64String(sk);
|
String key = Base64.toBase64String(sk);
|
||||||
cachedSessionKeys.put(key, copy(sessionKey));
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] copy(byte[] bytes) {
|
private static byte[] copy(byte[] bytes) {
|
||||||
|
|
Loading…
Reference in a new issue