public static ResultHolder generateValidCertificateChain(@Nullable final String subjectCommonName) throws Exception
    {
        return generateCertificateChainWithExpiredCertOnPosition(subjectCommonName, -1);
    }
Generates a chain of certificates, where the first certificate represents the end-entity certificate and the last
certificate represents the trust anchor (the 'root certificate').

Exactly four certificates are returned:
<ol>
    <li>The end-entity certificate</li>
    <li>an intermediate CA certificate</li>
    <li>a different intermediate CA certificate</li>
    <li>a root CA certificate</li>
</ol>

Each certificate is issued by the certificate that's in the next position of the chain. The last certificate is
self-signed.

@param subjectCommonName The CN value to use in the end-entity certificate.
@return an array of certificates. Never null, never an empty array.
xmppserver/src/test/java/org/jivesoftware/openfire/keystore/KeystoreTestUtils.java