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

Fix tests

This commit is contained in:
Paul Schaub 2021-05-20 13:42:52 +02:00
parent d70ee86468
commit a30767eb91
9 changed files with 78 additions and 33 deletions

View file

@ -28,7 +28,6 @@ import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSignature;
import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.key.util.KeyRingUtils;
@ -72,8 +71,7 @@ public class PGPPublicKeyRingTest {
assertTrue(userIds.contains(userId));
PGPPublicKey publicKey = publicKeys.getPublicKey();
PGPSignature cert = publicKey.getSignaturesForID(userId).next();
publicKey = PGPPublicKey.removeCertification(publicKey, cert);
publicKey = PGPPublicKey.removeCertification(publicKey, userId);
userIds = CollectionUtils.iteratorToList(publicKey.getUserIDs());
assertFalse(userIds.contains(userId));

View file

@ -15,7 +15,6 @@
*/
package org.pgpainless.encryption_signing;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -38,8 +37,6 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.pgpainless.PGPainless;
import org.pgpainless.algorithm.DocumentSignatureType;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.decryption_verification.DecryptionStream;
import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.implementation.ImplementationFactory;
@ -107,8 +104,6 @@ public class SigningTest {
decryptionStream.close();
OpenPgpMetadata metadata = decryptionStream.getResult();
assertEquals(SymmetricKeyAlgorithm.AES_192, metadata.getSymmetricKeyAlgorithm());
assertEquals(HashAlgorithm.SHA384.getAlgorithmId(), metadata.getSignatures().iterator().next().getHashAlgorithm());
assertTrue(metadata.isEncrypted());
assertTrue(metadata.isSigned());
assertTrue(metadata.isVerified());

View file

@ -26,6 +26,7 @@ import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
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.encryption_signing.EncryptionResult;
@ -51,6 +52,7 @@ public class TestTwoSubkeysEncryption {
* @throws PGPException not expected
*/
@Test
@Disabled("We may not want to encrypt to all enc capable subkeys.")
public void testEncryptsToBothSubkeys() throws IOException, PGPException {
PGPSecretKeyRing twoSuitableSubkeysKeyRing = WeirdKeys.getTwoCryptSubkeysKey();
PGPPublicKeyRing publicKeys = KeyRingUtils.publicKeyRingFrom(twoSuitableSubkeysKeyRing);