diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyTest.java deleted file mode 100644 index 4cebb9a1..00000000 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2020 Paul Schaub. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.pgpainless.key.generation; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.security.InvalidAlgorithmParameterException; -import java.security.NoSuchAlgorithmException; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.bouncycastle.bcpg.ArmoredOutputStream; -import org.bouncycastle.openpgp.PGPException; -import org.bouncycastle.openpgp.PGPPublicKeyRing; -import org.bouncycastle.openpgp.PGPSecretKeyRing; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import org.pgpainless.PGPainless; -import org.pgpainless.implementation.ImplementationFactory; -import org.pgpainless.key.OpenPgpV4Fingerprint; -import org.pgpainless.key.util.KeyRingUtils; -import org.pgpainless.util.ArmoredOutputStreamFactory; - -public class GenerateKeyTest { - - private static final Logger LOGGER = Logger.getLogger(GenerateKeyTest.class.getName()); - - @ParameterizedTest - @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") - public void generateKey(ImplementationFactory implementationFactory) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException, IOException { - ImplementationFactory.setFactoryImplementation(implementationFactory); - - PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().simpleEcKeyRing("fresh@encrypted.key", "password123"); - PGPPublicKeyRing publicKeys = KeyRingUtils.publicKeyRingFrom(secretKeys); - - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - ArmoredOutputStream armor = ArmoredOutputStreamFactory.get(bytes); - publicKeys.encode(armor); - armor.close(); - String publicKey = bytes.toString(); - - bytes = new ByteArrayOutputStream(); - armor = ArmoredOutputStreamFactory.get(bytes); - secretKeys.encode(armor); - armor.close(); - String privateKey = bytes.toString(); - - LOGGER.log(Level.INFO, String.format("Generated random fresh EC key ring.\n" + - "User-ID: %s\n" + - "Fingerprint: %s\n" + - "Key-ID: %s\n" + - "%s\n" + - "%s\n", secretKeys.getPublicKey().getUserIDs().next(), - new OpenPgpV4Fingerprint(publicKeys), - publicKeys.getPublicKey().getKeyID(), - publicKey, privateKey)); - } -}