1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-16 01:12:05 +01:00

Reorganize classes in packages

Move ArmorUtils to org.pgpainless.ascii_armor
Move Armored*StreamFactory to org.pgpainless.ascii_armor
Move CRCingArmoredInputStreamWrapper to org.pgpainless.ascii_armor
Move SessionKey to org.pgpainless.s2k
Move RevocationAttributes to org.pgpainless.key
Move UserId to org.pgpainless.key
Move Passphrase to org.pgpainless.s2k
Move NotationRegistry to org.pgpainless.policy
This commit is contained in:
Paul Schaub 2022-09-07 13:35:58 +02:00
parent bed18dc0ad
commit 68575f9f1e
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
111 changed files with 162 additions and 126 deletions

View file

@ -8,6 +8,16 @@ SPDX-License-Identifier: CC0-1.0
## 1.3.7-SNAPSHOT
- Add `KeyRingUtils.injectCertification(keys, certification)`
- Bugfix: Fix signature verification when `DecryptionStream` is drained byte-by-byte using `read()` call
- Refactoring:
- Move `ArmorUtils` to `org.pgpainless.ascii_armor` package
- Move `ArmoredInputStreamFactory` to `org.pgpainless.ascii_armor` package
- Move `ArmoredOutputStreamFactory` to `org.pgpainless.ascii_armor` package
- Move `CRCingArmoredInputStreamWrwapper` to `org.pgpainless.ascii_armor` package
- Move `SessionKey` to `org.pgpainless.s2k` package
- Move `RevocationAttributes` to `org.pgpainless.key` package
- Move `UserId` to `org.pgpainless.key` package
- Move `Passphrase` to `org.pgpainless.s2k` package
- Move `NotationRegistry` to `org.pgpainless.policy` package
## 1.3.6
- Remove deprecated methods

View file

@ -28,7 +28,7 @@ import org.pgpainless.cli.TestUtils;
import org.pgpainless.key.info.KeyInfo;
import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class GenerateCertCmdTest {

View file

@ -25,7 +25,7 @@ import org.pgpainless.key.modification.secretkeyring.SecretKeyRingEditorInterfac
import org.pgpainless.key.parsing.KeyRingReader;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.policy.Policy;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.ascii_armor.ArmorUtils;
public final class PGPainless {

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.util;
package org.pgpainless.ascii_armor;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@ -32,6 +32,8 @@ import org.bouncycastle.util.io.Streams;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.decryption_verification.OpenPgpInputStream;
import org.pgpainless.key.OpenPgpFingerprint;
import org.pgpainless.util.MultiMap;
import org.pgpainless.util.Tuple;
public final class ArmorUtils {

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.util;
package org.pgpainless.ascii_armor;
import java.io.IOException;
import java.io.InputStream;

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.util;
package org.pgpainless.ascii_armor;
import java.io.OutputStream;

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.util;
package org.pgpainless.ascii_armor;
import java.io.IOException;
import java.io.InputStream;

View file

@ -0,0 +1,8 @@
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
/**
* Classes related to ASCII armoring.
*/
package org.pgpainless.ascii_armor;

View file

@ -25,9 +25,9 @@ import org.bouncycastle.openpgp.PGPSignature;
import org.pgpainless.decryption_verification.cleartext_signatures.InMemoryMultiPassStrategy;
import org.pgpainless.decryption_verification.cleartext_signatures.MultiPassStrategy;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.s2k.SessionKey;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.util.Passphrase;
import org.pgpainless.util.SessionKey;
import org.pgpainless.s2k.Passphrase;
/**
* Options for decryption and signature verification.

View file

@ -60,12 +60,12 @@ import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.s2k.SessionKey;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.signature.consumer.DetachedSignatureCheck;
import org.pgpainless.signature.consumer.OnePassSignatureCheck;
import org.pgpainless.util.ArmoredInputStreamFactory;
import org.pgpainless.util.Passphrase;
import org.pgpainless.util.SessionKey;
import org.pgpainless.ascii_armor.ArmoredInputStreamFactory;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.util.Tuple;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View file

@ -23,7 +23,7 @@ import org.bouncycastle.openpgp.PGPPBEEncryptedData;
import org.bouncycastle.openpgp.PGPPublicKeyEncryptedData;
import org.bouncycastle.openpgp.PGPUtil;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.ascii_armor.ArmorUtils;
/**
* Inspect an OpenPGP message to determine IDs of its encryption keys or whether it is passphrase protected.

View file

@ -25,7 +25,8 @@ import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.exception.SignatureValidationException;
import org.pgpainless.key.OpenPgpFingerprint;
import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.util.SessionKey;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.s2k.SessionKey;
public class OpenPgpMetadata {
@ -89,7 +90,7 @@ public class OpenPgpMetadata {
/**
* Return the {@link SubkeyIdentifier} of the key that was used to decrypt the message.
* This can be null if the message was decrypted using a {@link org.pgpainless.util.Passphrase}, or if it was not
* This can be null if the message was decrypted using a {@link Passphrase}, or if it was not
* encrypted at all (e.g. signed only).
*
* @return subkey identifier of decryption key

View file

@ -16,7 +16,7 @@ import org.bouncycastle.openpgp.PGPSignatureList;
import org.bouncycastle.util.Strings;
import org.pgpainless.exception.WrongConsumingMethodException;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.util.ArmoredInputStreamFactory;
import org.pgpainless.ascii_armor.ArmoredInputStreamFactory;
/**
* Utility class to deal with cleartext-signed messages.

View file

@ -29,7 +29,7 @@ import org.pgpainless.key.OpenPgpFingerprint;
import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.key.info.KeyAccessor;
import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Options for the encryption process.

View file

@ -26,8 +26,8 @@ import org.pgpainless.algorithm.StreamEncoding;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.util.ArmoredOutputStreamFactory;
import org.pgpainless.ascii_armor.ArmorUtils;
import org.pgpainless.ascii_armor.ArmoredOutputStreamFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View file

@ -12,6 +12,7 @@ import org.bouncycastle.openpgp.PGPLiteralData;
import org.pgpainless.PGPainless;
import org.pgpainless.algorithm.CompressionAlgorithm;
import org.pgpainless.algorithm.StreamEncoding;
import org.pgpainless.ascii_armor.ArmoredOutputStreamFactory;
public final class ProducerOptions {
@ -120,7 +121,7 @@ public final class ProducerOptions {
* The default value is null, which means no comment header is added.
* Multiline comments are possible using '\\n'.
*
* Note: If a default header comment is set using {@link org.pgpainless.util.ArmoredOutputStreamFactory#setComment(String)},
* Note: If a default header comment is set using {@link ArmoredOutputStreamFactory#setComment(String)},
* then both comments will be written to the produced ASCII armor.
*
* @param comment comment header text

View file

@ -48,7 +48,7 @@ import org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyPair;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class BcImplementationFactory extends ImplementationFactory {

View file

@ -31,7 +31,7 @@ import org.bouncycastle.openpgp.operator.SessionKeyDataDecryptorFactory;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public abstract class ImplementationFactory {

View file

@ -46,7 +46,7 @@ import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.provider.ProviderFactory;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class JceImplementationFactory extends ImplementationFactory {

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.key.util;
package org.pgpainless.key;
import javax.annotation.Nonnull;
import java.util.Map;

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.key.util;
package org.pgpainless.key;
import javax.annotation.Nonnull;

View file

@ -21,7 +21,7 @@ import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.ascii_armor.ArmorUtils;
/**
* This class describes a logic of handling a collection of different {@link PGPKeyRing}. The logic was inspired by

View file

@ -50,7 +50,7 @@ import org.pgpainless.provider.ProviderFactory;
import org.pgpainless.signature.subpackets.SelfSignatureSubpackets;
import org.pgpainless.signature.subpackets.SignatureSubpackets;
import org.pgpainless.signature.subpackets.SignatureSubpacketsHelper;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class KeyRingBuilder implements KeyRingBuilderInterface<KeyRingBuilder> {

View file

@ -11,8 +11,8 @@ import javax.annotation.Nonnull;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.pgpainless.key.util.UserId;
import org.pgpainless.util.Passphrase;
import org.pgpainless.key.UserId;
import org.pgpainless.s2k.Passphrase;
public interface KeyRingBuilderInterface<B extends KeyRingBuilderInterface<B>> {

View file

@ -16,8 +16,8 @@ import org.pgpainless.key.generation.type.KeyType;
import org.pgpainless.key.generation.type.eddsa.EdDSACurve;
import org.pgpainless.key.generation.type.rsa.RsaLength;
import org.pgpainless.key.generation.type.xdh.XDHSpec;
import org.pgpainless.key.util.UserId;
import org.pgpainless.util.Passphrase;
import org.pgpainless.key.UserId;
import org.pgpainless.s2k.Passphrase;
public final class KeyRingTemplates {

View file

@ -41,7 +41,7 @@ import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.exception.KeyException;
import org.pgpainless.key.OpenPgpFingerprint;
import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
import org.pgpainless.policy.Policy;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.signature.consumer.SignaturePicker;

View file

@ -37,7 +37,7 @@ import org.pgpainless.key.protection.UnprotectedKeysProtector;
import org.pgpainless.key.protection.fixes.S2KUsageFix;
import org.pgpainless.key.protection.passphrase_provider.SolitaryPassphraseProvider;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
import org.pgpainless.signature.builder.DirectKeySelfSignatureBuilder;
import org.pgpainless.signature.builder.PrimaryKeyBindingSignatureBuilder;
import org.pgpainless.signature.builder.RevocationSignatureBuilder;
@ -48,7 +48,7 @@ import org.pgpainless.signature.subpackets.SelfSignatureSubpackets;
import org.pgpainless.signature.subpackets.SignatureSubpackets;
import org.pgpainless.signature.subpackets.SignatureSubpacketsHelper;
import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.util.selection.userid.SelectUserId;
import javax.annotation.Nonnull;

View file

@ -20,10 +20,10 @@ import org.pgpainless.key.OpenPgpFingerprint;
import org.pgpainless.key.generation.KeySpec;
import org.pgpainless.key.protection.KeyRingProtectionSettings;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
import org.pgpainless.signature.subpackets.RevocationSignatureSubpackets;
import org.pgpainless.signature.subpackets.SelfSignatureSubpackets;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.util.selection.userid.SelectUserId;
public interface SecretKeyRingEditorInterface {

View file

@ -24,7 +24,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
import org.bouncycastle.util.io.Streams;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.key.collection.PGPKeyRingCollection;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.ascii_armor.ArmorUtils;
public class KeyRingReader {

View file

@ -9,7 +9,7 @@ import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
import javax.annotation.Nullable;

View file

@ -17,7 +17,7 @@ import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor;
import org.pgpainless.key.OpenPgpFingerprint;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Implementation of the {@link SecretKeyRingProtector} which holds a map of key ids and their passwords.

View file

@ -12,7 +12,7 @@ import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Provides {@link PBESecretKeyDecryptor} and {@link PBESecretKeyEncryptor} objects while getting the passphrases

View file

@ -17,7 +17,7 @@ import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.key.protection.passphrase_provider.SolitaryPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Task of the {@link SecretKeyRingProtector} is to map encryptor/decryptor objects to key-ids.

View file

@ -13,7 +13,7 @@ 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;
import org.pgpainless.s2k.Passphrase;
public final class UnlockSecretKey {

View file

@ -7,7 +7,7 @@ package org.pgpainless.key.protection.passphrase_provider;
import java.util.Map;
import javax.annotation.Nullable;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Implementation of the {@link SecretKeyPassphraseProvider} that holds a map of different {@link Passphrase passphrases}.

View file

@ -7,7 +7,7 @@ package org.pgpainless.key.protection.passphrase_provider;
import javax.annotation.Nullable;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Interface to allow the user to provide a {@link Passphrase} for an encrypted OpenPGP secret key.

View file

@ -6,7 +6,7 @@ package org.pgpainless.key.protection.passphrase_provider;
import javax.annotation.Nullable;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Implementation of the {@link SecretKeyPassphraseProvider} that holds a single {@link Passphrase}.

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.util;
package org.pgpainless.policy;
import java.util.HashSet;
import java.util.Set;

View file

@ -21,7 +21,6 @@ import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.util.DateUtil;
import org.pgpainless.util.NotationRegistry;
/**
* Policy class used to configure acceptable algorithm suites etc.

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.util;
package org.pgpainless.s2k;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.util;
package org.pgpainless.s2k;
import javax.annotation.Nonnull;

View file

@ -0,0 +1,8 @@
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
/**
* Classes related to symmetric encryption using S2K mechanisms.
*/
package org.pgpainless.s2k;

View file

@ -38,9 +38,9 @@ import org.pgpainless.algorithm.negotiation.HashAlgorithmNegotiator;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.key.OpenPgpFingerprint;
import org.pgpainless.key.util.OpenPgpKeyAttributeUtil;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.ascii_armor.ArmorUtils;
/**
* Utility methods related to signatures.

View file

@ -33,7 +33,7 @@ import org.pgpainless.policy.Policy;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil;
import org.pgpainless.util.DateUtil;
import org.pgpainless.util.NotationRegistry;
import org.pgpainless.policy.NotationRegistry;
/**
* A collection of validators that perform validation steps over signatures.

View file

@ -8,7 +8,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.bouncycastle.bcpg.sig.RevocationReason;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
public interface RevocationSignatureSubpackets extends BaseSignatureSubpackets {

View file

@ -48,7 +48,7 @@ import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.KeyFlag;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
public class SignatureSubpackets
implements BaseSignatureSubpackets, SelfSignatureSubpackets, CertificationSubpackets, RevocationSignatureSubpackets {

View file

@ -29,7 +29,7 @@ import org.pgpainless.algorithm.Feature;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.KeyFlag;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
public class SignatureSubpacketsHelper {

View file

@ -37,7 +37,7 @@ import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* This test is used to investigate, how messages of the form

View file

@ -21,7 +21,7 @@ import org.pgpainless.key.generation.type.rsa.RsaLength;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.key.util.KeyIdUtil;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class ModifiedPublicKeysInvestigation {

View file

@ -26,8 +26,8 @@ import org.pgpainless.decryption_verification.DecryptionStream;
import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.util.ArmoredInputStreamFactory;
import org.pgpainless.util.Passphrase;
import org.pgpainless.ascii_armor.ArmoredInputStreamFactory;
import org.pgpainless.s2k.Passphrase;
public class AsciiArmorCRCTests {

View file

@ -41,7 +41,7 @@ import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.signature.consumer.CertificateValidator;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.signature.consumer.SignatureVerifier;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.ascii_armor.ArmorUtils;
import org.pgpainless.util.TestUtils;
public class CleartextSignatureVerificationTest {

View file

@ -36,7 +36,7 @@ import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class MissingPassphraseForDecryptionTest {

View file

@ -25,7 +25,7 @@ import org.pgpainless.exception.MessageNotIntegrityProtectedException;
import org.pgpainless.exception.ModificationDetectionException;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.util.TestAllImplementations;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class ModificationDetectionTests {

View file

@ -21,7 +21,7 @@ import org.pgpainless.PGPainless;
import org.pgpainless.key.protection.CachingSecretKeyRingProtector;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class PostponeDecryptionUsingKeyWithMissingPassphraseTest {

View file

@ -42,7 +42,7 @@ import org.pgpainless.PGPainless;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.policy.Policy;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class WrongSignerUserIdTest {

View file

@ -46,7 +46,7 @@ import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnprotectedKeysProtector;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.policy.Policy;
import org.pgpainless.util.ArmoredOutputStreamFactory;
import org.pgpainless.ascii_armor.ArmoredOutputStreamFactory;
import org.pgpainless.util.TestAllImplementations;
public class EncryptDecryptTest {

View file

@ -35,7 +35,7 @@ import org.pgpainless.key.generation.type.KeyType;
import org.pgpainless.key.generation.type.eddsa.EdDSACurve;
import org.pgpainless.key.generation.type.xdh.XDHSpec;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class EncryptionOptionsTest {

View file

@ -15,7 +15,7 @@ import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
import org.pgpainless.PGPainless;
import org.pgpainless.util.TestAllImplementations;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class EncryptionStreamClosedTest {

View file

@ -45,7 +45,7 @@ import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.util.MultiMap;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.util.TestAllImplementations;
public class SigningTest {

View file

@ -27,7 +27,7 @@ import org.pgpainless.encryption_signing.EncryptionStream;
import org.pgpainless.encryption_signing.ProducerOptions;
import org.pgpainless.encryption_signing.SigningOptions;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class Encrypt {

View file

@ -30,8 +30,8 @@ import org.pgpainless.key.generation.type.ecc.EllipticCurve;
import org.pgpainless.key.generation.type.eddsa.EdDSACurve;
import org.pgpainless.key.generation.type.rsa.RsaLength;
import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.util.UserId;
import org.pgpainless.util.Passphrase;
import org.pgpainless.key.UserId;
import org.pgpainless.s2k.Passphrase;
/**
* This class demonstrates how to use PGPainless to generate secret keys.

View file

@ -17,7 +17,7 @@ import org.pgpainless.PGPainless;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.policy.Policy;
import org.pgpainless.util.NotationRegistry;
import org.pgpainless.policy.NotationRegistry;
/**
* PGPainless comes with an algorithm policy.

View file

@ -32,7 +32,7 @@ import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.util.DateUtil;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* PGPainless offers a simple API to modify keys by adding and replacing signatures and/or subkeys.

View file

@ -30,7 +30,7 @@ import org.pgpainless.encryption_signing.ProducerOptions;
import org.pgpainless.encryption_signing.SigningOptions;
import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.ascii_armor.ArmorUtils;
public class Sign {

View file

@ -16,7 +16,7 @@ import org.pgpainless.key.TestKeys;
import org.pgpainless.key.protection.CachingSecretKeyRingProtector;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* {@link PGPSecretKey PGPSecretKeys} are often password protected to prevent unauthorized access.

View file

@ -16,7 +16,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class TestKeys {

View file

@ -5,7 +5,6 @@
package org.pgpainless.key;
import org.junit.jupiter.api.Test;
import org.pgpainless.key.util.UserId;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

View file

@ -28,8 +28,8 @@ import org.pgpainless.key.generation.type.eddsa.EdDSACurve;
import org.pgpainless.key.generation.type.rsa.RsaLength;
import org.pgpainless.key.generation.type.xdh.XDHSpec;
import org.pgpainless.key.info.KeyInfo;
import org.pgpainless.key.util.UserId;
import org.pgpainless.util.Passphrase;
import org.pgpainless.key.UserId;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.util.TestAllImplementations;
public class BrainpoolKeyGenerationTest {

View file

@ -21,7 +21,7 @@ import org.pgpainless.key.generation.type.eddsa.EdDSACurve;
import org.pgpainless.key.generation.type.xdh.XDHSpec;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.key.util.UserId;
import org.pgpainless.key.UserId;
import org.pgpainless.util.TestAllImplementations;
public class GenerateEllipticCurveKeyTest {

View file

@ -24,7 +24,7 @@ import org.pgpainless.algorithm.KeyFlag;
import org.pgpainless.key.generation.type.KeyType;
import org.pgpainless.key.generation.type.rsa.RsaLength;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.key.util.UserId;
import org.pgpainless.key.UserId;
import org.pgpainless.util.DateUtil;
import org.pgpainless.util.TestAllImplementations;

View file

@ -17,7 +17,7 @@ import org.pgpainless.algorithm.KeyFlag;
import org.pgpainless.key.generation.type.KeyType;
import org.pgpainless.key.generation.type.rsa.RsaLength;
import org.pgpainless.util.TestAllImplementations;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Reproduce behavior of https://github.com/pgpainless/pgpainless/issues/16

View file

@ -35,7 +35,7 @@ import org.pgpainless.key.generation.type.xdh.XDHSpec;
import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.signature.subpackets.SelfSignatureSubpackets;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class KeyGenerationSubpacketsTest {

View file

@ -49,10 +49,10 @@ import org.pgpainless.key.generation.type.eddsa.EdDSACurve;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnprotectedKeysProtector;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.util.UserId;
import org.pgpainless.key.RevocationAttributes;
import org.pgpainless.key.UserId;
import org.pgpainless.util.DateUtil;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.util.TestAllImplementations;
public class KeyRingInfoTest {

View file

@ -33,7 +33,7 @@ import org.pgpainless.key.generation.type.xdh.XDHSpec;
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnprotectedKeysProtector;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
public class UserIdRevocationTest {

View file

@ -31,7 +31,7 @@ import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.util.TestAllImplementations;
public class AddSubKeyTest {

View file

@ -26,9 +26,9 @@ import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnprotectedKeysProtector;
import org.pgpainless.key.util.UserId;
import org.pgpainless.key.UserId;
import org.pgpainless.util.TestAllImplementations;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class AddUserIdTest {

View file

@ -33,7 +33,7 @@ import org.pgpainless.key.protection.KeyRingProtectionSettings;
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.util.TestAllImplementations;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class ChangeSecretKeyRingPassphraseTest {

View file

@ -13,7 +13,7 @@ import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class GnuDummyS2KChangePassphraseTest {

View file

@ -26,7 +26,7 @@ import org.pgpainless.key.generation.type.rsa.RsaLength;
import org.pgpainless.key.modification.secretkeyring.SecretKeyRingEditorInterface;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.policy.Policy;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class RefuseToAddWeakSubkeyTest {

View file

@ -18,7 +18,7 @@ import org.pgpainless.PGPainless;
import org.pgpainless.key.TestKeys;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
public class RevocationCertificateTest {

View file

@ -18,7 +18,7 @@ import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
import org.pgpainless.PGPainless;
import org.pgpainless.key.protection.UnprotectedKeysProtector;
import org.pgpainless.util.ArmoredOutputStreamFactory;
import org.pgpainless.ascii_armor.ArmoredOutputStreamFactory;
import org.pgpainless.util.TestAllImplementations;
/**

View file

@ -34,12 +34,12 @@ import org.pgpainless.key.TestKeys;
import org.pgpainless.key.modification.secretkeyring.SecretKeyRingEditorInterface;
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.signature.subpackets.RevocationSignatureSubpackets;
import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil;
import org.pgpainless.util.TestAllImplementations;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class RevokeSubKeyTest {

View file

@ -19,7 +19,7 @@ import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
import org.pgpainless.util.selection.userid.SelectUserId;
public class RevokeUserIdsTest {

View file

@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.util.ArmorUtils;
import org.pgpainless.ascii_armor.ArmorUtils;
public class KeyRingCollectionReaderTest {

View file

@ -40,7 +40,7 @@ import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.collection.PGPKeyRingCollection;
import org.pgpainless.key.util.KeyRingUtils;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.util.ArmoredOutputStreamFactory;
import org.pgpainless.ascii_armor.ArmoredOutputStreamFactory;
import org.pgpainless.util.TestUtils;
class KeyRingReaderTest {

View file

@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.key.TestKeys;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class CachingSecretKeyRingProtectorTest {

View file

@ -16,7 +16,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.junit.jupiter.api.Test;
import org.pgpainless.key.TestKeys;
import org.pgpainless.key.protection.passphrase_provider.MapBasedPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class MapBasedPassphraseProviderTest {

View file

@ -19,7 +19,7 @@ import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.key.TestKeys;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class PassphraseProtectedKeyTest {

View file

@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class PassphraseTest {

View file

@ -27,7 +27,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.pgpainless.PGPainless;
import org.pgpainless.key.TestKeys;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
import org.pgpainless.util.TestAllImplementations;
public class SecretKeyRingProtectorTest {

View file

@ -17,7 +17,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.exception.WrongPassphraseException;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class UnlockSecretKeyTest {

View file

@ -24,7 +24,7 @@ import org.pgpainless.PGPainless;
import org.pgpainless.decryption_verification.ConsumerOptions;
import org.pgpainless.decryption_verification.DecryptionStream;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class S2KUsageFixTest {

View file

@ -5,6 +5,7 @@
package org.pgpainless.key.util;
import org.junit.jupiter.api.Test;
import org.pgpainless.key.RevocationAttributes;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;

View file

@ -53,9 +53,9 @@ import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.key.OpenPgpFingerprint;
import org.pgpainless.key.TestKeys;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.key.util.RevocationAttributes;
import org.pgpainless.key.RevocationAttributes;
import org.pgpainless.util.DateUtil;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class SignatureSubpacketsTest {

View file

@ -20,7 +20,7 @@ import org.pgpainless.encryption_signing.EncryptionOptions;
import org.pgpainless.encryption_signing.EncryptionStream;
import org.pgpainless.encryption_signing.ProducerOptions;
import org.pgpainless.util.TestAllImplementations;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
public class MultiPassphraseSymmetricEncryptionTest {

View file

@ -33,7 +33,7 @@ import org.pgpainless.key.protection.KeyRingProtectionSettings;
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.passphrase_provider.SolitaryPassphraseProvider;
import org.pgpainless.util.Passphrase;
import org.pgpainless.s2k.Passphrase;
/**
* Test parallel symmetric and public key encryption/decryption.

View file

@ -34,11 +34,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.pgpainless.PGPainless;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.KeyFlag;
import org.pgpainless.ascii_armor.ArmorUtils;
import org.pgpainless.ascii_armor.ArmoredInputStreamFactory;
import org.pgpainless.ascii_armor.ArmoredOutputStreamFactory;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.key.TestKeys;
import org.pgpainless.key.generation.KeySpec;
import org.pgpainless.key.generation.type.ecc.EllipticCurve;
import org.pgpainless.key.generation.type.ecc.ecdsa.ECDSA;
import org.pgpainless.s2k.Passphrase;
public class ArmorUtilsTest {

View file

@ -6,6 +6,8 @@ package org.pgpainless.util;
import org.bouncycastle.bcpg.ArmoredInputStream;
import org.junit.jupiter.api.Test;
import org.pgpainless.ascii_armor.ArmoredInputStreamFactory;
import org.pgpainless.ascii_armor.CRCingArmoredInputStreamWrapper;
import java.io.ByteArrayInputStream;
import java.io.IOException;

View file

@ -9,6 +9,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import org.pgpainless.policy.NotationRegistry;
public class NotationRegistryTest {

View file

@ -9,7 +9,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.util.UserId;
import org.pgpainless.key.UserId;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;

Some files were not shown because too many files have changed in this diff Show more