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

More documentation

This commit is contained in:
Paul Schaub 2021-05-31 15:33:42 +02:00
parent a871bc3a0c
commit 73f6c54fa2
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -15,6 +15,8 @@
*/ */
package org.pgpainless; package org.pgpainless;
import java.util.Date;
import org.bouncycastle.openpgp.PGPKeyRing; import org.bouncycastle.openpgp.PGPKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing; import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.pgpainless.algorithm.EncryptionPurpose; import org.pgpainless.algorithm.EncryptionPurpose;
@ -106,6 +108,17 @@ public class PGPainless {
/** /**
* Verify a cleartext-signed message. * Verify a cleartext-signed message.
* Cleartext signed messages are often found in emails and look like this:
* <pre>
* {@code
* -----BEGIN PGP SIGNED MESSAGE-----
* Hash: [Hash algorithm]
* [Human Readable Message Body]
* -----BEGIN PGP SIGNATURE-----
* [Signature]
* -----END PGP SIGNATURE-----
* }
* </pre>
* *
* @return builder * @return builder
*/ */
@ -113,12 +126,25 @@ public class PGPainless {
return new VerifyCleartextSignaturesImpl(); return new VerifyCleartextSignaturesImpl();
} }
/**
* Make changes to a key ring.
* This method can be used to change key expiration dates and passphrases, or add/remove/revoke subkeys.
*
* After making the desired changes in the builder, the modified key ring can be extracted using {@link SecretKeyRingEditorInterface#done()}.
*
* @param secretKeys secret key ring
* @return builder
*/
public static SecretKeyRingEditorInterface modifyKeyRing(PGPSecretKeyRing secretKeys) { public static SecretKeyRingEditorInterface modifyKeyRing(PGPSecretKeyRing secretKeys) {
return new SecretKeyRingEditor(secretKeys); return new SecretKeyRingEditor(secretKeys);
} }
/** /**
* Quickly access information about a {@link org.bouncycastle.openpgp.PGPPublicKeyRing} / {@link PGPSecretKeyRing}. * Quickly access information about a {@link org.bouncycastle.openpgp.PGPPublicKeyRing} / {@link PGPSecretKeyRing}.
* This method can be used to determine expiration dates, key flags and other information about a key.
*
* To evaluate a key at a given date (e.g. to determine if the key was allowed to create a certain signature)
* use {@link KeyRingInfo#KeyRingInfo(PGPKeyRing, Date)} instead.
* *
* @param keyRing key ring * @param keyRing key ring
* @return access object * @return access object
@ -127,6 +153,11 @@ public class PGPainless {
return new KeyRingInfo(keyRing); return new KeyRingInfo(keyRing);
} }
/**
* Access, and make changes to PGPainless policy on acceptable/default algorithms etc.
*
* @return policy
*/
public static Policy getPolicy() { public static Policy getPolicy() {
return Policy.getInstance(); return Policy.getInstance();
} }