mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-22 20:32:05 +01:00
Improve tests
This commit is contained in:
parent
4dbb4311ad
commit
f6e523685b
6 changed files with 10 additions and 26 deletions
|
@ -15,13 +15,11 @@
|
|||
*/
|
||||
package org.pgpainless;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.Security;
|
||||
import java.util.Date;
|
||||
|
||||
import org.bouncycastle.bcpg.CompressionAlgorithmTags;
|
||||
|
@ -46,12 +44,10 @@ import org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBu
|
|||
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyPair;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BouncycastleExportSubkeys {
|
||||
public class BouncycastleExportSubkeys extends AbstractPGPainlessTest {
|
||||
|
||||
@Test
|
||||
public void testExportImport() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, PGPException, IOException {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
|
||||
public void testExportImport() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, PGPException {
|
||||
KeyPairGenerator generator;
|
||||
KeyPair pair;
|
||||
|
||||
|
|
|
@ -21,11 +21,9 @@ import java.io.IOException;
|
|||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.Security;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||
|
@ -34,14 +32,10 @@ import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
|
|||
import org.junit.Test;
|
||||
import org.pgpainless.key.collection.PGPKeyRing;
|
||||
|
||||
public class ImportExportKeyTest {
|
||||
|
||||
static {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
public class ImportExportKeyTest extends AbstractPGPainlessTest {
|
||||
|
||||
/**
|
||||
* This test is failing. Not sure if a bug in BC or in my code...
|
||||
* Test the export and import of a key ring with sub keys.
|
||||
* @throws PGPException very
|
||||
* @throws NoSuchAlgorithmException much
|
||||
* @throws NoSuchProviderException some
|
||||
|
|
|
@ -21,10 +21,8 @@ import java.io.IOException;
|
|||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.Security;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
|
@ -33,11 +31,7 @@ import org.pgpainless.key.collection.PGPKeyRing;
|
|||
import org.pgpainless.util.BCUtil;
|
||||
import org.pgpainless.util.KeyRingSubKeyFix;
|
||||
|
||||
public class KeyRingSubKeyFixTest {
|
||||
|
||||
static {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
public class KeyRingSubKeyFixTest extends AbstractPGPainlessTest {
|
||||
|
||||
@Test
|
||||
public void test()
|
||||
|
|
|
@ -66,11 +66,11 @@ public class LengthTest extends AbstractPGPainlessTest {
|
|||
|
||||
// @Test
|
||||
public void RsaRsa4096()
|
||||
throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException,
|
||||
throws PGPException,
|
||||
IOException {
|
||||
LOGGER.log(Level.INFO, "\nRSA-4096 -> RSA-4096");
|
||||
PGPKeyRing sender = PGPainless.generateKeyRing().simpleRsaKeyRing("simplejid@server.tld", RsaLength._4096);
|
||||
PGPKeyRing recipient = PGPainless.generateKeyRing().simpleRsaKeyRing("otherjid@other.srv", RsaLength._4096);
|
||||
PGPKeyRing sender = PGPainless.readKeyRing().keyRing(TestKeys.JULIET_PUB, TestKeys.JULIET_SEC);
|
||||
PGPKeyRing recipient = PGPainless.readKeyRing().keyRing(TestKeys.ROMEO_PUB, TestKeys.ROMEO_SEC);
|
||||
encryptDecryptForSecretKeyRings(sender, recipient);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.bouncycastle.openpgp.PGPPublicKey;
|
|||
import org.junit.Test;
|
||||
import org.pgpainless.key.OpenPgpV4Fingerprint;
|
||||
|
||||
public class OpenPgpV4FingerprintTest {
|
||||
public class OpenPgpV4FingerprintTest extends AbstractPGPainlessTest {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void fpTooShort() {
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.bouncycastle.openpgp.PGPUtil;
|
|||
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
||||
import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
|
||||
|
||||
public class TestKeys {
|
||||
public class TestKeys extends AbstractPGPainlessTest {
|
||||
|
||||
private static final KeyFingerPrintCalculator calc = new BcKeyFingerprintCalculator();
|
||||
private static PGPSecretKeyRing julietSecretKeyRing = null;
|
||||
|
|
Loading…
Reference in a new issue