Generating keys and certificates

How to generate keys and certificates.

About this task

You can generate a private cryptographic key and optionally a self-signed certificate. The certificate signing request (CSR) that is needed by the certificate authority (CA) is created by default.

You can generate an RSA key or ECDSA key.
  • If you generate an RSA key, you must define the key length and the hash algorithm of the generated RSA keys.
  • If you generate an ECDSA key, you must define the elliptic curve to use to generate the ECDSA keys.

For a physical DataPower® Gateway that is HSM-equipped, the private key is exportable with an HSM-generated key-wrapping key. A key-wrapping key is a key that encrypts another key.

  • If a file is stored in the cert: directory, you cannot edit it.
  • If a file is stored in the local: or temporary: directory, you can edit it.
  • If the file is store on the HSM, which is represented as the hsm://hsm2/ directory, you cannot edit it.

Procedure

  1. From the search results, click Crypto Tools.
  2. Define the LDAP entry.
    1. Set the LDAP (reverse) Order of RDNs property to indicate whether to create the LDAP entry in reverse RDN order.
      The default behavior is to create the entry in forward RDN order, not in reverse RDN order.
    2. Optional: In the Country Name (C) field, enter a country name.
    3. Optional: In the State or Province (ST) field, enter a state name or a province name.
    4. Optional: In the Locality (L) field, enter a locality name.
    5. Optional: In the Organization (O) field, enter the name of an organization.
    6. Optional: In the Organizational Unit (OU) field, enter the name of an organizational unit.
    7. Optional: In the Organizational Unit 2 (OU), Organizational Unit 3 (OU), and Organizational Unit 4 (OU) fields, enter the names of additional organizational units.
    8. In the Common Name (CN) field, enter a common name.
  3. From the Key type list, select the type of key to generate.
  4. Define the key-type specific characteristics to use to generate the key.
    • For an RSA key, select the key length and hash algorithm.
    • For an ECDSA key, select the elliptic curve.
  5. In the File Name field, enter the name of the key file to generate.
    The value takes the directory:///name form. Leave blank to allow the action to create the name.
  6. In the Validity Period field, enter the duration that the key is valid.
  7. From the Password Alias list, select, the password alias map that defines the alias that maps to the cleartext password.
    The password in the map encrypts the files, and the alias in the map decrypts the password to access the file.
  8. Set the Export Private Key property to indicate whether the action writes the key file to the temporary: directory.
    The default behavior is to not write the key file to the temporary: directory.
  9. Set the Generate Self-Signed Certificate property to indicate whether the action creates a self-signed certificate that matches the key.
    The default behavior is to create a self-signed certificate.
  10. Set the Export Self-Signed Certificate property to indicate whether the action writes the self-signed certificate to the temporary: directory.
    The default behavior is to write the self-signed certificate to the temporary: directory.
  11. Set the Generate Key and Certificate Objects property to indicate whether the action automatically creates the configurations from the generated files.
    The default behavior is to create objects from the generated files.
  12. In the Object Name field, enter the name to use for the key and certificate. Leave blank to allow the action to generate the names from the input information based on the Common Name (CN) or File Name property.
  13. Set the Generate Key on HSM property to indicate whether to create the key on the HSM.
    This property is meaningful only on an HSM-equipped DataPower Gateway.
    • When set, creates the key on the HSM. The file name (URL) for the key has the hsm://hsm2/name format.
    • When not set, creates the key on the DataPower Gateway. The file name (URL) for the key has the cert:///name format.
  14. In the Using Existing Key Object field, enter the name of an existing key alias.
    If supplied and valid, the action generates a new certificate and a new CSR that is based on the key in the identified key alias. In this case, the DataPower Gateway does not generate a new key.
  15. Click Generate Key to generate a private key and, if requested, a self-signed certificate.
    A CSR is created automatically.
  16. Follow the prompts.

Results

The CSR can be submitted to a CA to receive a certificate that is based on this private key. This action creates the following files and configurations.
  • Creates the private key file in the cert: directory. For example, cert:///sample-privkey.pem.
  • Creates the CSR in the temporary: directory, For example, temporary:///sample.csr.
  • When the Generate Self-Signed Certificate property is enabled, create a self-signed certificate in the cert: directory. For example, cert:///sample-sscert.pem.
  • When the Export Self-Signed Certificate property is enabled, create a copy of the self-signed certificate in the temporary: directory. For example, temporary:///sample-sscert.pem.
  • When the Generate Key and Certificate Objects property is enabled, create a key and certificate aliases.
When the action creates a self-signed certificate, you can use this certificate-key pair for the following purposes.
  • Establish identification credentials.
  • Encrypt or decrypt XML documents.