mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-23 04:42:06 +01:00
Add some clarifying comments to GenerateKeyImpl
This commit is contained in:
parent
702fdf085c
commit
6371485929
1 changed files with 4 additions and 0 deletions
|
@ -63,13 +63,16 @@ public class GenerateKeyImpl implements GenerateKey {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GenerateKey profile(String profileName) {
|
public GenerateKey profile(String profileName) {
|
||||||
|
// Sanitize the profile name to make sure we support the given profile
|
||||||
for (Profile profile : SUPPORTED_PROFILES) {
|
for (Profile profile : SUPPORTED_PROFILES) {
|
||||||
if (profile.getName().equals(profileName)) {
|
if (profile.getName().equals(profileName)) {
|
||||||
this.profile = profileName;
|
this.profile = profileName;
|
||||||
|
// return if we found the profile
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// profile not found, throw
|
||||||
throw new SOPGPException.UnsupportedProfile("generate-key", profileName);
|
throw new SOPGPException.UnsupportedProfile("generate-key", profileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +129,7 @@ public class GenerateKeyImpl implements GenerateKey {
|
||||||
.simpleRsaKeyRing(primaryUserId, RsaLength._4096, passphrase);
|
.simpleRsaKeyRing(primaryUserId, RsaLength._4096, passphrase);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// Missing else-if branch for profile. Oops.
|
||||||
throw new SOPGPException.UnsupportedProfile("generate-key", profile);
|
throw new SOPGPException.UnsupportedProfile("generate-key", profile);
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
|
|
Loading…
Reference in a new issue