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

Add javadoc

This commit is contained in:
Paul Schaub 2021-10-18 16:19:12 +02:00
parent 2ad917d27c
commit dc0b96278e
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 40 additions and 2 deletions

View file

@ -225,6 +225,9 @@ public class ConsumerOptions {
/**
* Add a passphrase for message decryption.
* This passphrase will be used to try to decrypt messages which were symmetrically encrypted for a passphrase.
*
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.7">Symmetrically Encrypted Data Packet</a>
*
* @param passphrase passphrase
* @return options
@ -288,15 +291,39 @@ public class ConsumerOptions {
return this;
}
/**
* Return true, if PGPainless is ignoring MDC errors.
*
* @return ignore mdc errors
*/
boolean isIgnoreMDCErrors() {
return ignoreMDCErrors;
}
/**
* Specify the {@link MissingKeyPassphraseStrategy}.
* This strategy defines, how missing passphrases for unlocking secret keys are handled.
* In interactive mode ({@link MissingKeyPassphraseStrategy#INTERACTIVE}) PGPainless will try to obtain missing
* passphrases for secret keys via the {@link SecretKeyRingProtector SecretKeyRingProtectors}
* {@link org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider} callback.
*
* In non-interactice mode ({@link MissingKeyPassphraseStrategy#THROW_EXCEPTION}, PGPainless will instead
* throw a {@link org.pgpainless.exception.MissingPassphraseException} containing the ids of all keys for which
* there are missing passphrases.
*
* @param strategy strategy
* @return options
*/
public ConsumerOptions setMissingKeyPassphraseStrategy(MissingKeyPassphraseStrategy strategy) {
this.missingKeyPassphraseStrategy = strategy;
return this;
}
/**
* Return the currently configured {@link MissingKeyPassphraseStrategy}.
*
* @return missing key passphrase strategy
*/
MissingKeyPassphraseStrategy getMissingKeyPassphraseStrategy() {
return missingKeyPassphraseStrategy;
}

View file

@ -4,7 +4,18 @@
package org.pgpainless.decryption_verification;
/**
* Strategy defining how missing secret key passphrases are handled.
*/
public enum MissingKeyPassphraseStrategy {
INTERACTIVE, // ask for missing key passphrases one by one
THROW_EXCEPTION // throw an exception with all keys with missing passphrases
/**
* Try to interactively obtain key passphrases one-by-one via callbacks,
* eg {@link org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider}.
*/
INTERACTIVE,
/**
* Do not try to obtain passphrases interactively and instead throw a
* {@link org.pgpainless.exception.MissingPassphraseException} listing all keys with missing passphrases.
*/
THROW_EXCEPTION
}