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

Add some missing javadoc

This commit is contained in:
Paul Schaub 2023-01-16 19:38:52 +01:00
parent 6c0bb6c627
commit b58861635d
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
17 changed files with 84 additions and 0 deletions

View file

@ -258,6 +258,18 @@ task javadocAll(type: Javadoc) {
] as String[]
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// The '-quiet' as second argument is actually a hack,
// since the one paramater addStringOption doesn't seem to
// work, we extra add '-quiet', which is added anyway by
// gradle. See https://github.com/gradle/gradle/issues/2354
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
// for information about the -Xwerror option.
options.addStringOption('Xwerror', '-quiet')
}
}
/**
* Fetch sha256 checksums of artifacts published to maven central.
*

View file

@ -18,6 +18,10 @@ public class PGPainlessCLI {
SopCLI.setSopInstance(new SOPImpl());
}
/**
* Main method of the CLI application.
* @param args arguments
*/
public static void main(String[] args) {
int result = execute(args);
if (result != 0) {
@ -25,6 +29,12 @@ public class PGPainlessCLI {
}
}
/**
* Execute the given command and return the exit code of the program.
*
* @param args command string array (e.g. ["pgpainless-cli", "generate-key", "Alice"])
* @return exit code
*/
public static int execute(String... args) {
return SopCLI.execute(args);
}

View file

@ -18,6 +18,9 @@ import sop.enums.ArmorLabel;
import sop.exception.SOPGPException;
import sop.operation.Armor;
/**
* Implementation of the <pre>armor</pre> operation using PGPainless.
*/
public class ArmorImpl implements Armor {
@Override

View file

@ -15,6 +15,9 @@ import sop.Ready;
import sop.exception.SOPGPException;
import sop.operation.Dearmor;
/**
* Implementation of the <pre>dearmor</pre> operation using PGPainless.
*/
public class DearmorImpl implements Dearmor {
@Override

View file

@ -34,6 +34,9 @@ import sop.Verification;
import sop.exception.SOPGPException;
import sop.operation.Decrypt;
/**
* Implementation of the <pre>decrypt</pre> operation using PGPainless.
*/
public class DecryptImpl implements Decrypt {
private final ConsumerOptions consumerOptions = ConsumerOptions.get();

View file

@ -36,6 +36,9 @@ import sop.enums.SignAs;
import sop.exception.SOPGPException;
import sop.operation.DetachedSign;
/**
* Implementation of the <pre>sign</pre> operation using PGPainless.
*/
public class DetachedSignImpl implements DetachedSign {
private boolean armor = true;

View file

@ -23,6 +23,9 @@ import sop.Verification;
import sop.exception.SOPGPException;
import sop.operation.DetachedVerify;
/**
* Implementation of the <pre>verify</pre> operation using PGPainless.
*/
public class DetachedVerifyImpl implements DetachedVerify {
private final ConsumerOptions options = ConsumerOptions.get();

View file

@ -34,6 +34,9 @@ import sop.exception.SOPGPException;
import sop.operation.Encrypt;
import sop.util.ProxyOutputStream;
/**
* Implementation of the <pre>encrypt</pre> operation using PGPainless.
*/
public class EncryptImpl implements Encrypt {
EncryptionOptions encryptionOptions = EncryptionOptions.get();

View file

@ -19,6 +19,9 @@ import sop.Ready;
import sop.exception.SOPGPException;
import sop.operation.ExtractCert;
/**
* Implementation of the <pre>extract-cert</pre> operation using PGPainless.
*/
public class ExtractCertImpl implements ExtractCert {
private boolean armor = true;

View file

@ -24,6 +24,9 @@ import sop.Ready;
import sop.exception.SOPGPException;
import sop.operation.GenerateKey;
/**
* Implementation of the <pre>generate-key</pre> operation using PGPainless.
*/
public class GenerateKeyImpl implements GenerateKey {
private boolean armor = true;

View file

@ -30,6 +30,9 @@ import sop.Signatures;
import sop.exception.SOPGPException;
import sop.operation.InlineDetach;
/**
* Implementation of the <pre>inline-detach</pre> operation using PGPainless.
*/
public class InlineDetachImpl implements InlineDetach {
private boolean armor = true;

View file

@ -29,6 +29,9 @@ import sop.enums.InlineSignAs;
import sop.exception.SOPGPException;
import sop.operation.InlineSign;
/**
* Implementation of the <pre>inline-sign</pre> operation using PGPainless.
*/
public class InlineSignImpl implements InlineSign {
private boolean armor = true;

View file

@ -26,6 +26,9 @@ import sop.Verification;
import sop.exception.SOPGPException;
import sop.operation.InlineVerify;
/**
* Implementation of the <pre>inline-verify</pre> operation using PGPainless.
*/
public class InlineVerifyImpl implements InlineVerify {
private final ConsumerOptions options = ConsumerOptions.get();

View file

@ -13,6 +13,9 @@ import sop.exception.SOPGPException;
import java.io.IOException;
import java.io.InputStream;
/**
* Reader for OpenPGP keys and certificates with error matching according to the SOP spec.
*/
class KeyReader {
static PGPSecretKeyRingCollection readSecretKeys(InputStream keyInputStream, boolean requireContent)

View file

@ -20,12 +20,21 @@ import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.util.Passphrase;
/**
* Implementation of the {@link SecretKeyRingProtector} which can be handed passphrases and keys separately,
* and which then matches up passphrases and keys when needed.
*/
public class MatchMakingSecretKeyRingProtector implements SecretKeyRingProtector {
private final Set<Passphrase> passphrases = new HashSet<>();
private final Set<PGPSecretKeyRing> keys = new HashSet<>();
private final CachingSecretKeyRingProtector protector = new CachingSecretKeyRingProtector();
/**
* Add a single passphrase to the protector.
*
* @param passphrase passphrase
*/
public void addPassphrase(Passphrase passphrase) {
if (passphrase.isEmpty()) {
return;
@ -46,6 +55,11 @@ public class MatchMakingSecretKeyRingProtector implements SecretKeyRingProtector
}
}
/**
* Add a single {@link PGPSecretKeyRing} to the protector.
*
* @param key secret keys
*/
public void addSecretKey(PGPSecretKeyRing key) {
if (!keys.add(key)) {
return;
@ -89,6 +103,9 @@ public class MatchMakingSecretKeyRingProtector implements SecretKeyRingProtector
return protector.getEncryptor(keyId);
}
/**
* Clear all known passphrases from the protector.
*/
public void clear() {
for (Passphrase passphrase : passphrases) {
passphrase.clear();

View file

@ -19,6 +19,12 @@ import sop.operation.InlineSign;
import sop.operation.InlineVerify;
import sop.operation.Version;
/**
* Implementation of the <pre>sop</pre> API using PGPainless.
* <pre> {@code
* SOP sop = new SOPImpl();
* }</pre>
*/
public class SOPImpl implements SOP {
static {

View file

@ -12,6 +12,9 @@ import java.util.Properties;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import sop.operation.Version;
/**
* Implementation of the <pre>version</pre> operation using PGPainless.
*/
public class VersionImpl implements Version {
// draft version