1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-10 14:21:09 +01:00

Add tests for PublicKeyParameterValidation

This commit is contained in:
Paul Schaub 2021-12-09 13:25:23 +01:00
parent 296f811b7f
commit 35462ab539
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 153 additions and 24 deletions

View file

@ -12,6 +12,7 @@ import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.pgpainless.exception.KeyIntegrityException;
import org.pgpainless.exception.WrongPassphraseException;
import org.pgpainless.key.info.KeyInfo;
import org.pgpainless.key.util.PublicKeyParameterValidationUtil;
import org.pgpainless.util.Passphrase;
public final class UnlockSecretKey {
@ -50,6 +51,8 @@ public final class UnlockSecretKey {
throw new PGPException("Cannot decrypt secret key.");
}
PublicKeyParameterValidationUtil.verifyPublicKeyParameterIntegrity(privateKey, secretKey.getPublicKey());
return privateKey;
}