public static String pemEncodeCertAndPrivateKey(X509Certificate cert, PrivateKey privateKey,
    char[] keyPassword) throws IOException, OperatorCreationException {
    return pemEncodeX509Certificate(cert) + "\n" + pemEncodePrivateKey(privateKey, keyPassword);
  }
PEM-encodes the given X509 certificate and private key (compatible with OpenSSL), optionally
protecting the private key with a password. Concatenates them both and returns the result as a
single string. This creates the PEM encoding of a key store.
@param cert        the X509 certificate to PEM-encode.
@param privateKey  the private key to PEM-encode.
@param keyPassword an optional key password. If empty or null, the private key will not be
                   encrypted.
@return a String containing the PEM encodings of the certificate and private key.
@throws IOException               if converting the certificate or private key to PEM format
                                  fails.
@throws OperatorCreationException if constructing the encryptor from the given password fails.
hbase-common/src/test/java/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.java