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

EncryptImpl: Rename default profile, add documentation

This commit is contained in:
Paul Schaub 2023-04-17 16:06:45 +02:00
parent 926e540016
commit 676e7d166a
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -42,15 +42,15 @@ import sop.util.ProxyOutputStream;
*/
public class EncryptImpl implements Encrypt {
private static final Profile DEFAULT_PROFILE = new Profile("default", "Use the implementer's recommendations");
private static final Profile RFC4880_PROFILE = new Profile("rfc4880", "Follow the packet format of rfc4880");
public static final List<Profile> SUPPORTED_PROFILES = Arrays.asList(DEFAULT_PROFILE);
public static final List<Profile> SUPPORTED_PROFILES = Arrays.asList(RFC4880_PROFILE);
EncryptionOptions encryptionOptions = EncryptionOptions.get();
SigningOptions signingOptions = null;
MatchMakingSecretKeyRingProtector protector = new MatchMakingSecretKeyRingProtector();
private final Set<PGPSecretKeyRing> signingKeys = new HashSet<>();
private String profile = DEFAULT_PROFILE.getName(); // TODO: Use in future releases
private String profile = RFC4880_PROFILE.getName(); // TODO: Use in future releases
private EncryptAs encryptAs = EncryptAs.Binary;
boolean armor = true;
@ -121,13 +121,16 @@ public class EncryptImpl implements Encrypt {
@Override
public Encrypt profile(String profileName) {
// sanitize profile name to make sure we only accept supported profiles
for (Profile profile : SUPPORTED_PROFILES) {
if (profile.getName().equals(profileName)) {
// profile is supported, return
this.profile = profile.getName();
return this;
}
}
// Profile is not supported, throw
throw new SOPGPException.UnsupportedProfile("encrypt", profileName);
}