| | |
| | | import com.beust.jcommander.Parameters;
|
| | | import com.gitblit.utils.TimeUtils;
|
| | |
|
| | | /**
|
| | | * Utility class to generate self-signed certificates.
|
| | | * |
| | | * @author James Moger
|
| | | * |
| | | */
|
| | | public class MakeCertificate {
|
| | |
|
| | | private static final String BC = org.bouncycastle.jce.provider.BouncyCastleProvider.PROVIDER_NAME;
|
| | |
| | | jc.usage();
|
| | | }
|
| | | File keystore = new File("keystore");
|
| | | generateSelfSignedCertificate(params.alias, keystore, params.storePassword, params.subject);
|
| | | generateSelfSignedCertificate(params.hostname, keystore, params.storePassword,
|
| | | params.subject);
|
| | | }
|
| | |
|
| | | public static void generateSelfSignedCertificate(String hostname, File keystore,
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * JCommander Parameters class for MakeCertificate.
|
| | | */
|
| | | @Parameters(separators = " ")
|
| | | private static class Params {
|
| | |
|
| | | private static final FileSettings FILESETTINGS = new FileSettings(Constants.PROPERTIES_FILE);
|
| | |
|
| | | @Parameter(names = { "--alias" }, description = "Server alias", required = true)
|
| | | public String alias;
|
| | | @Parameter(names = { "--hostname" }, description = "Server Hostname", required = true)
|
| | | public String hostname;
|
| | |
|
| | | @Parameter(names = { "--subject" }, description = "Certificate subject", required = true)
|
| | | public String subject;
|