Skip navigation.
Downloads | Product Documentation | Support

WebLogic Server Command Reference

## CertGen

The `CertGen` utility generates certificates that should only be used for demonstration or testing purposes and not in a production environment.

### Syntax

>     $ java utils.CertGen

>     [-cacert <ca_cert_file-name>] [-cakey <ca_key_filename>]
>     [-cakeypass <ca_key_password>] [-selfsigned]
>     [-certfile <certfile>] [-keyfile <privatekeyfile>]
>     [-keyfilepass <keyfilepassword>] [-strength <keystrength>]
>     [-cn <commonname>] [-ou <orgunit>] [-o <organization>]
>     [-l <locality>] [-s <state>] [-c <countrycode>]
>     [-subjectkeyid <subjectkeyidentifier>]
>     [-subjectkeyidformat UTF-8|BASE64]

Argument | Definition
--- | ---
`ca_cert_filename` | The file name of the issuer's CA public certificate.
`ca_key_filename` | The file name of the issuer's CA private key.
`ca_key_password` | The password for the issuer's CA private key.
`selfsigned` | Generates a self-signed certificate that can be used as a trusted CA certificate. If this argument is specified, the `ca_cert_filename`, `ca_key_filename`, and `ca_key_password` arguments should not be specified.
`certfile` | The name of the generated certificate file.
`privatekeyfile` | The name of the generated private key file.
`keyfilepassword` | The password for the private key.
`keystrength` | The length (in bits) of the keys to be generated. The longer the key, the more difficult it is for someone to break the encryption.
`commonname` | The name to be associated with the generated certificate.
`orgunit` | The name of the organizational unit associated with the generated certificate.
`organization` | The name of the organization associated with the generated certificate.
`locality` | The name of a city or town.
`state` | The name of the state or province in which the organizational unit (ou) operates if your organization is in the United States or Canada, respectively. Do not abbreviate.
`countrycode` | Two-letter ISO code for your country. The code for the United States is US.
`subjectkeyidentifier` | Generates a certificate with the Subject Key identifier extension and the ID value specified on the command line.
`UTF-8|BASE64` | Format of the `subjectkeyid` value. Allowed values are UTF-8 or BASE64, with UTF-8 assumed by default.

### Example

By default, the CertGen utility looks for the `CertGenCA.der` and `CertGenCAKey.der` files in the current directory, or in the `WL_HOME` directory, as specified in the `weblogic.home` system property or the `CLASSPATH`. Alternatively, you can specify CA files on the command line.

Enter the following command to generate certificate files named `testcert` with private key files named `testkey`:

>     $ java utils.CertGen mykeypass testcert testkey
>     Creating Domestic Key Strength - 1024

>     Encoding
>     ................................................................
>     ................................................................
>     ................................................................
>     Created Private Key files - testkey.der and testkey.pem
>     Encoding
>     ................................................................
>     ................................................................
>     ................................................................
>     Created Certificate files - testcert.der and testcert.pem
>     ................................................................