feat: opt pktype
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
"repo": {
|
||||
"dependencies": [
|
||||
"info.picocli:picocli:4.6.1",
|
||||
"me.hatter:commons:3.67",
|
||||
"me.hatter:commons:3.68",
|
||||
"me.hatter:crypto:1.12"
|
||||
],
|
||||
"testDependencies": [
|
||||
|
||||
@@ -17,7 +17,6 @@ import me.hatter.tools.yubikeyca.hatterink.CertificateUtil;
|
||||
import java.security.KeyPair;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
public class YubikeyCaMain {
|
||||
private static final LogTool log;
|
||||
@@ -178,13 +177,11 @@ public class YubikeyCaMain {
|
||||
log.error("Keypair type is required.");
|
||||
return null;
|
||||
}
|
||||
final Optional<PKType> pkTypeOpt = Arrays.stream(PKType.values())
|
||||
.filter(t -> t.name().equalsIgnoreCase(args.keypairType))
|
||||
.findFirst();
|
||||
if (!pkTypeOpt.isPresent()) {
|
||||
final PKType pkType = PKType.from(args.keypairType);
|
||||
if (pkType == null) {
|
||||
log.error("Invalid keypair type: " + args.keypairType);
|
||||
return null;
|
||||
}
|
||||
return pkTypeOpt.get();
|
||||
return pkType;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user