Class RootCertificateGenerator

    • Method Detail

      • encodeRootCertificateAsPem

        public java.lang.String encodeRootCertificateAsPem()
        Returns the generated root certificate as a PEM-encoded String.
        Returns:
        encoded RootCertificateAsPem
      • encodePrivateKeyAsPem

        public java.lang.String encodePrivateKeyAsPem​(java.lang.String privateKeyPassword)
        Returns the generated private key as a PEM-encoded String, encrypted using the specified password and the DEFAULT_PEM_ENCRYPTION_ALGORITHM.
        Parameters:
        privateKeyPassword - password to use to encrypt the private key
        Returns:
        encoded PrivateKeyAsPem
      • saveRootCertificateAsPemFile

        public void saveRootCertificateAsPemFile​(java.io.File file)
        Saves the root certificate as PEM-encoded data to the specified file.
        Parameters:
        file - file
      • savePrivateKeyAsPemFile

        public void savePrivateKeyAsPemFile​(java.io.File file,
                                            java.lang.String passwordForPrivateKey)
        Saves the private key as PEM-encoded data to a file, using the specified password to encrypt the private key and the DEFAULT_PEM_ENCRYPTION_ALGORITHM. If the password is null, the private key will be stored unencrypted. In general, private keys should not be stored unencrypted.
        Parameters:
        file - file to save the private key to
        passwordForPrivateKey - password to protect the private key
      • saveRootCertificateAndKey

        public void saveRootCertificateAndKey​(java.lang.String keyStoreType,
                                              java.io.File file,
                                              java.lang.String privateKeyAlias,
                                              java.lang.String password)
        Saves the generated certificate and private key as a file, using the specified password to protect the key store.
        Parameters:
        keyStoreType - the KeyStore type, such as PKCS12 or JKS
        file - file to export the root certificate and private key to
        privateKeyAlias - alias for the private key in the KeyStore
        password - password for the private key and the KeyStore