@Test public void testGenerateSelfSignedCert() throws GeneralSecurityException, IOException, OperatorCreationException { String dn = "CN=testDN,O=testOrg"; X509Certificate x509Certificate = CertificateUtils.generateSelfSignedX509Certificate(TlsHelper.generateKeyPair(keyPairAlgorithm, keySize), dn, signingAlgorithm, days); Date notAfter = x509Certificate.getNotAfter(); assertTrue(notAfter.after(inFuture(days - 1))); assertTrue(notAfter.before(inFuture(days + 1))); Date notBefore = x509Certificate.getNotBefore(); assertTrue(notBefore.after(inFuture(-1))); assertTrue(notBefore.before(inFuture(1))); assertEquals(dn, x509Certificate.getIssuerX500Principal().getName()); assertEquals(signingAlgorithm, x509Certificate.getSigAlgName()); assertEquals(keyPairAlgorithm, x509Certificate.getPublicKey().getAlgorithm()); x509Certificate.checkValidity(); }
public static KeyPair generateKeyPair(String algorithm, int keySize) throws NoSuchAlgorithmException { return createKeyPairGenerator(algorithm, keySize).generateKeyPair(); }
TlsHelper { public static KeyPair generateKeyPair(String algorithm, int keySize) throws NoSuchAlgorithmException { return createKeyPairGenerator(algorithm, keySize).generateKeyPair(); } }
TlsHelper { public static KeyPair generateKeyPair(String algorithm, int keySize) throws NoSuchAlgorithmException { return createKeyPairGenerator(algorithm, keySize).generateKeyPair(); } private  TlsHelper(); }
TlsHelper { public static KeyPair generateKeyPair(String algorithm, int keySize) throws NoSuchAlgorithmException { return createKeyPairGenerator(algorithm, keySize).generateKeyPair(); } private  TlsHelper(); static boolean isUnlimitedStrengthCryptographyEnabled(); static String writeKeyStore(KeyStore keyStore, OutputStreamFactory outputStreamFactory, File file, String password, boolean generatedPassword); static byte[] calculateHMac(String token, PublicKey publicKey); static byte[] getKeyIdentifier(PublicKey publicKey); static String pemEncodeJcaObject(Object object); static JcaPKCS10CertificationRequest parseCsr(String pemEncodedCsr); static X509Certificate parseCertificate(Reader pemEncodedCertificate); static KeyPair parseKeyPair(Reader pemEncodedKeyPair); static T parsePem(Class<T> clazz, Reader pemReader); static KeyPair generateKeyPair(String algorithm, int keySize); static JcaPKCS10CertificationRequest generateCertificationRequest(String requestedDn, String domainAlternativeNames,
            KeyPair keyPair, String signingAlgorithm); static Extensions createDomainAlternativeNamesExtensions(String domainAlternativeNames); }
TlsHelper { public static KeyPair generateKeyPair(String algorithm, int keySize) throws NoSuchAlgorithmException { return createKeyPairGenerator(algorithm, keySize).generateKeyPair(); } private  TlsHelper(); static boolean isUnlimitedStrengthCryptographyEnabled(); static String writeKeyStore(KeyStore keyStore, OutputStreamFactory outputStreamFactory, File file, String password, boolean generatedPassword); static byte[] calculateHMac(String token, PublicKey publicKey); static byte[] getKeyIdentifier(PublicKey publicKey); static String pemEncodeJcaObject(Object object); static JcaPKCS10CertificationRequest parseCsr(String pemEncodedCsr); static X509Certificate parseCertificate(Reader pemEncodedCertificate); static KeyPair parseKeyPair(Reader pemEncodedKeyPair); static T parsePem(Class<T> clazz, Reader pemReader); static KeyPair generateKeyPair(String algorithm, int keySize); static JcaPKCS10CertificationRequest generateCertificationRequest(String requestedDn, String domainAlternativeNames,
            KeyPair keyPair, String signingAlgorithm); static Extensions createDomainAlternativeNamesExtensions(String domainAlternativeNames); static final String JCE_URL; static final String ILLEGAL_KEY_SIZE; }