Class CreateKeyPair
java.lang.Object
io.micronaut.starter.cli.command.BaseCommand
io.micronaut.starter.cli.command.CodeGenCommand
io.micronaut.starter.cli.feature.acme.CreateKeyPair
- All Implemented Interfaces:
ConsoleOutput
,Callable<Integer>
- Direct Known Subclasses:
CreateAccount
Allows for generating a keypair in a given location with a given size.
Alternative to using this is using openssl : `openssl genrsa -out /tmp/mydomain.com-key.pem 4096`
-
Field Summary
Fields inherited from class io.micronaut.starter.cli.command.CodeGenCommand
beanContext, config, consoleOutput, outputHandlerSupplier, overwrite
Fields inherited from class io.micronaut.starter.cli.command.BaseCommand
commonOptions, spec
Fields inherited from interface io.micronaut.starter.io.ConsoleOutput
NOOP
-
Constructor Summary
ConstructorDescriptionCreateKeyPair
(CodeGenConfig config) CreateKeyPair
(CodeGenConfig config, io.micronaut.core.util.functional.ThrowingSupplier<OutputHandler, IOException> outputHandlerSupplier, ConsoleOutput consoleOutput) -
Method Summary
Methods inherited from class io.micronaut.starter.cli.command.CodeGenCommand
err, getCommand, getProject, getTemplateRenderer, getTemplateRenderer, out, setBeanContext, warning
Methods inherited from class io.micronaut.starter.cli.command.BaseCommand
errWriter, getOperatingSystem, getSpec, green, outWriter, red, showStacktrace, verbose
-
Field Details
-
keyDir
-
keyName
-
keySize
protected int keySize
-
-
Constructor Details
-
CreateKeyPair
-
CreateKeyPair
public CreateKeyPair(CodeGenConfig config, io.micronaut.core.util.functional.ThrowingSupplier<OutputHandler, IOException> outputHandlerSupplier, ConsoleOutput consoleOutput)
-
-
Method Details
-
applies
public boolean applies()- Specified by:
applies
in classCodeGenCommand
-
call
Uses arguments passed to do all keypair creation.- Returns:
- exit code of the program
-
doKeyCreation
protected KeyPair doKeyCreation(String keyLocation, String keyName, boolean overwrite) throws IOException Create a keypair with a default size of 4096 bits.- Parameters:
keyLocation
- output directory for keykeyName
- name of keypair file- Returns:
- keypair
- Throws:
IOException
- Failed to get/create keypair from disk
-