mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 18:59:39 +02:00
Change HardwareSecurity DecryptionCallback to emit key-id
This commit is contained in:
parent
529c64cf43
commit
228918f96b
5 changed files with 51 additions and 36 deletions
|
@ -29,7 +29,6 @@ import java.io.IOException;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
@ -55,7 +54,7 @@ public class CustomPublicKeyDataDecryptorFactoryTest {
|
|||
|
||||
HardwareSecurity.DecryptionCallback hardwareDecryptionCallback = new HardwareSecurity.DecryptionCallback() {
|
||||
@Override
|
||||
public byte[] decryptSessionKey(int keyAlgorithm, byte[] sessionKeyData)
|
||||
public byte[] decryptSessionKey(long keyId, int keyAlgorithm, byte[] sessionKeyData)
|
||||
throws HardwareSecurity.HardwareSecurityException {
|
||||
// Emulate hardware decryption.
|
||||
try {
|
||||
|
@ -74,8 +73,9 @@ public class CustomPublicKeyDataDecryptorFactoryTest {
|
|||
.onInputStream(new ByteArrayInputStream(ciphertextOut.toByteArray()))
|
||||
.withOptions(ConsumerOptions.get()
|
||||
.addCustomDecryptorFactory(
|
||||
Collections.singleton(encryptionKey.getKeyID()),
|
||||
new HardwareSecurity.HardwareDataDecryptorFactory(hardwareDecryptionCallback)));
|
||||
new HardwareSecurity.HardwareDataDecryptorFactory(
|
||||
encryptionKey.getKeyID(),
|
||||
hardwareDecryptionCallback)));
|
||||
|
||||
ByteArrayOutputStream decryptedOut = new ByteArrayOutputStream();
|
||||
Streams.pipeAll(decryptionStream, decryptedOut);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue