mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-02-16 22:26:25 +01:00
EncryptImpl: Rename default profile, add documentation
This commit is contained in:
parent
926e540016
commit
676e7d166a
1 changed files with 6 additions and 3 deletions
|
@ -42,15 +42,15 @@ import sop.util.ProxyOutputStream;
|
||||||
*/
|
*/
|
||||||
public class EncryptImpl implements Encrypt {
|
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();
|
EncryptionOptions encryptionOptions = EncryptionOptions.get();
|
||||||
SigningOptions signingOptions = null;
|
SigningOptions signingOptions = null;
|
||||||
MatchMakingSecretKeyRingProtector protector = new MatchMakingSecretKeyRingProtector();
|
MatchMakingSecretKeyRingProtector protector = new MatchMakingSecretKeyRingProtector();
|
||||||
private final Set<PGPSecretKeyRing> signingKeys = new HashSet<>();
|
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;
|
private EncryptAs encryptAs = EncryptAs.Binary;
|
||||||
boolean armor = true;
|
boolean armor = true;
|
||||||
|
@ -121,13 +121,16 @@ public class EncryptImpl implements Encrypt {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Encrypt profile(String profileName) {
|
public Encrypt profile(String profileName) {
|
||||||
|
// sanitize profile name to make sure we only accept supported profiles
|
||||||
for (Profile profile : SUPPORTED_PROFILES) {
|
for (Profile profile : SUPPORTED_PROFILES) {
|
||||||
if (profile.getName().equals(profileName)) {
|
if (profile.getName().equals(profileName)) {
|
||||||
|
// profile is supported, return
|
||||||
this.profile = profile.getName();
|
this.profile = profile.getName();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Profile is not supported, throw
|
||||||
throw new SOPGPException.UnsupportedProfile("encrypt", profileName);
|
throw new SOPGPException.UnsupportedProfile("encrypt", profileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue