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:
parent
6c0bb6c627
commit
b58861635d
17 changed files with 84 additions and 0 deletions
12
build.gradle
12
build.gradle
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue