mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-10-31 17:45:58 +01:00
Add documentation to ManagePolicy
This commit is contained in:
parent
e8311f0cc5
commit
8d05eea92d
1 changed files with 13 additions and 1 deletions
|
@ -34,8 +34,13 @@ import org.pgpainless.util.NotationRegistry;
|
||||||
* PGPainless comes with an algorithm policy.
|
* PGPainless comes with an algorithm policy.
|
||||||
* This policy is consulted during signature verification, such that signatures made using weak algorithms
|
* This policy is consulted during signature verification, such that signatures made using weak algorithms
|
||||||
* can be rejected.
|
* can be rejected.
|
||||||
|
* Note, that PGPainless distinguishes between hash algorithms used in revocation and non-revocation signatures,
|
||||||
|
* and has different policies for those.
|
||||||
*
|
*
|
||||||
* The following examples show how this policy can be modified.
|
* Furthermore PGPainless has policies for symmetric encryption algorithms (both for encrypting and decrypting),
|
||||||
|
* for public key algorithms and key lengths, as well as compression algorithms.
|
||||||
|
*
|
||||||
|
* The following examples show how these policies can be modified.
|
||||||
*
|
*
|
||||||
* PGPainless' policy is being accessed by calling {@link PGPainless#getPolicy()}.
|
* PGPainless' policy is being accessed by calling {@link PGPainless#getPolicy()}.
|
||||||
* Custom sub-policies can be set by calling the setter methods of {@link Policy}.
|
* Custom sub-policies can be set by calling the setter methods of {@link Policy}.
|
||||||
|
@ -48,18 +53,25 @@ public class ManagePolicy {
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void resetPolicy() {
|
public void resetPolicy() {
|
||||||
|
// Policy for hash algorithms in non-revocation signatures
|
||||||
PGPainless.getPolicy().setSignatureHashAlgorithmPolicy(
|
PGPainless.getPolicy().setSignatureHashAlgorithmPolicy(
|
||||||
Policy.HashAlgorithmPolicy.defaultSignatureAlgorithmPolicy());
|
Policy.HashAlgorithmPolicy.defaultSignatureAlgorithmPolicy());
|
||||||
|
// Policy for hash algorithms in revocation signatures
|
||||||
PGPainless.getPolicy().setRevocationSignatureHashAlgorithmPolicy(
|
PGPainless.getPolicy().setRevocationSignatureHashAlgorithmPolicy(
|
||||||
Policy.HashAlgorithmPolicy.defaultRevocationSignatureHashAlgorithmPolicy());
|
Policy.HashAlgorithmPolicy.defaultRevocationSignatureHashAlgorithmPolicy());
|
||||||
|
// Policy for public key algorithms and bit lengths
|
||||||
PGPainless.getPolicy().setPublicKeyAlgorithmPolicy(
|
PGPainless.getPolicy().setPublicKeyAlgorithmPolicy(
|
||||||
Policy.PublicKeyAlgorithmPolicy.defaultPublicKeyAlgorithmPolicy());
|
Policy.PublicKeyAlgorithmPolicy.defaultPublicKeyAlgorithmPolicy());
|
||||||
|
// Policy for acceptable symmetric encryption algorithms when decrypting messages
|
||||||
PGPainless.getPolicy().setSymmetricKeyDecryptionAlgorithmPolicy(
|
PGPainless.getPolicy().setSymmetricKeyDecryptionAlgorithmPolicy(
|
||||||
Policy.SymmetricKeyAlgorithmPolicy.defaultSymmetricKeyDecryptionAlgorithmPolicy());
|
Policy.SymmetricKeyAlgorithmPolicy.defaultSymmetricKeyDecryptionAlgorithmPolicy());
|
||||||
|
// Policy for acceptable symmetric encryption algorithms when encrypting messages
|
||||||
PGPainless.getPolicy().setSymmetricKeyEncryptionAlgorithmPolicy(
|
PGPainless.getPolicy().setSymmetricKeyEncryptionAlgorithmPolicy(
|
||||||
Policy.SymmetricKeyAlgorithmPolicy.defaultSymmetricKeyEncryptionAlgorithmPolicy());
|
Policy.SymmetricKeyAlgorithmPolicy.defaultSymmetricKeyEncryptionAlgorithmPolicy());
|
||||||
|
// Policy for acceptable compression algorithms
|
||||||
PGPainless.getPolicy().setCompressionAlgorithmPolicy(
|
PGPainless.getPolicy().setCompressionAlgorithmPolicy(
|
||||||
Policy.CompressionAlgorithmPolicy.defaultCompressionAlgorithmPolicy());
|
Policy.CompressionAlgorithmPolicy.defaultCompressionAlgorithmPolicy());
|
||||||
|
// Known notations
|
||||||
PGPainless.getPolicy().getNotationRegistry().clear();
|
PGPainless.getPolicy().getNotationRegistry().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue