### Question:
CertificateUtil { public static X509Certificate generateSelfSignedCertificate( X500Name issuer, KeyPair keyPair, int days, String algoStr ) throws CertificateException, IOException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException { X509CertInfo info = new X509CertInfo(); setInfo( info, issuer, issuer, keyPair, days, algoStr, SELF_SIGNED ); X509CertImpl certificate = new X509CertImpl( info ); certificate.sign( keyPair.getPrivate(), algoStr ); return certificate; } private  CertificateUtil(); static X509Certificate generateSelfSignedCertificate( X500Name issuer, KeyPair keyPair,  int days, String algoStr ); static X509Certificate generateCertificate( X500Name subject, X500Name issuer, KeyPair keyPair,  int days, String algoStr ); static KeyManagerFactory loadKeyStore( String keyStoreFile, String keyStorePasswordStr ); static File createTempKeyStore( String keyStoreName, char[] keyStorePassword );  }### Answer:
@Test public void testSelfSignedCertificateCreation() throws IOException, GeneralSecurityException { X500Name owner = new X500Name( "apacheds", "directory", "apache", "US" ); KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance( "EC" ); keyPairGenerator.initialize( 256 ); KeyPair keyPair = keyPairGenerator.generateKeyPair(); X509Certificate certificate = CertificateUtil.generateSelfSignedCertificate( owner, keyPair, 3650, "SHA256WithECDSA" ); System.out.println( certificate ); }