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