1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-10 10:49:39 +02:00

Fix some tests

This commit is contained in:
Paul Schaub 2025-02-04 15:59:26 +01:00
parent a9ad3a9cdc
commit 89bed45ad1
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
6 changed files with 22 additions and 24 deletions

View file

@ -13,6 +13,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory;
import org.bouncycastle.openpgp.operator.bc.BcPublicKeyDataDecryptorFactory;
import org.bouncycastle.util.io.Streams;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.algorithm.EncryptionPurpose;
@ -28,16 +29,15 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class CustomPublicKeyDataDecryptorFactoryTest {
@Test
@Disabled
public void testDecryptionWithEmulatedHardwareDecryptionCallback()
throws PGPException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
throws PGPException, IOException {
PGPSecretKeyRing secretKey = PGPainless.generateKeyRing().modernKeyRing("Alice");
PGPPublicKeyRing cert = PGPainless.extractCertificate(secretKey);
KeyRingInfo info = PGPainless.inspectKeyRing(secretKey);

View file

@ -183,7 +183,7 @@ public class ModifyKeys {
* The provided expiration date will be set on each user-id certification signature.
*/
@Test
public void setKeyExpirationDate() throws PGPException {
public void setKeyExpirationDate() {
Date expirationDate = DateUtil.parseUTCDate("2030-06-24 12:44:56 UTC");
SecretKeyRingProtector protector = SecretKeyRingProtector

View file

@ -6,13 +6,10 @@ package org.pgpainless.key.generation;
import static org.junit.jupiter.api.Assertions.assertFalse;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
@ -29,8 +26,7 @@ import org.pgpainless.util.DateUtil;
public class GenerateKeyWithCustomCreationDateTest {
@Test
public void generateKeyWithCustomCreationDateTest()
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
public void generateKeyWithCustomCreationDateTest() {
Date creationDate = DateUtil.parseUTCDate("2018-06-11 14:12:09 UTC");
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
.addSubkey(KeySpec.getBuilder(KeyType.XDH_LEGACY(XDHLegacySpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
@ -49,7 +45,7 @@ public class GenerateKeyWithCustomCreationDateTest {
}
@Test
public void generateSubkeyWithFutureKeyCreationDate() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
public void generateSubkeyWithFutureKeyCreationDate() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.YEAR, 20);
Date future = calendar.getTime();

View file

@ -219,8 +219,7 @@ public class KeyRingInfoTest {
@TestTemplate
@ExtendWith(TestAllImplementations.class)
public void testGetKeysWithFlagsAndExpiry()
throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
public void testGetKeysWithFlagsAndExpiry() {
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
.setPrimaryKey(KeySpec.getBuilder(