public class KeyToolUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ROOT_CACERT_CRT_PFX |
Modifier and Type | Method and Description |
---|---|
static void |
generateHostCert(java.io.File keystore,
java.lang.String password,
java.lang.String host,
int validity)
Create a host certificate signed with the CA certificate.
|
static void |
generateProxyCA(java.io.File keystore,
java.lang.String password,
int validity)
Creates a self-signed Root CA certificate and an intermediate CA certificate
(signed by the Root CA certificate) that can be used to sign server certificates.
|
static void |
genkeypair(java.io.File keystore,
java.lang.String alias,
java.lang.String password,
int validity,
java.lang.String dname,
java.lang.String ext)
Generate a self-signed keypair using the algorithm "RSA".
|
static java.lang.String[] |
getCAaliases()
Returns a list of the CA aliases that should be in the keystore.
|
static java.lang.String |
getRootCAalias()
Get the root CA alias; needed to check the serial number and fingerprint
|
static boolean |
haveKeytool() |
static java.lang.String |
list(java.io.File keystore,
java.lang.String storePass)
List the contents of a keystore
|
public static final java.lang.String ROOT_CACERT_CRT_PFX
public static void genkeypair(java.io.File keystore, java.lang.String alias, java.lang.String password, int validity, java.lang.String dname, java.lang.String ext) throws java.io.IOException
keystore
- the keystore; if it already contains the alias the command will failalias
- the alias to use, not nullpassword
- the password to use for the store and the keyvalidity
- the validity period in days, greater than 0dname
- the distinguished name value, if omitted use "cn=JMeter Proxy (DO NOT TRUST)"ext
- if not null, the extension (-ext) to add (e.g. "bc:c").java.io.IOException
- if keytool was not configured or running keytool application failspublic static void generateProxyCA(java.io.File keystore, java.lang.String password, int validity) throws java.io.IOException
keystore
- the keystore in which to store everythingpassword
- the password for keystore and keysvalidity
- the validity period in days, must be greater than 0java.io.IOException
- if keytool was not configured, running keytool application failed or copying the keys failedpublic static void generateHostCert(java.io.File keystore, java.lang.String password, java.lang.String host, int validity) throws java.io.IOException
keystore
- the keystore to usepassword
- the password to use for the keystore and keyshost
- the host, e.g. jmeter.apache.org or *.apache.org; also used as the aliasvalidity
- the validity period for the generated keypairjava.io.IOException
- if keytool was not configured or running keytool application failedpublic static java.lang.String list(java.io.File keystore, java.lang.String storePass) throws java.io.IOException
keystore
- the keystore filestorePass
- the keystore passwordjava.io.IOException
- if keytool was not configured or running keytool application
failedpublic static java.lang.String[] getCAaliases()
public static java.lang.String getRootCAalias()
public static boolean haveKeytool()
null
)Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.