@Test public void testGenerateCertificate() throws Exception { String rootDn = RSAUtil.buildDN("GB", "SomeState", "SomeLocality", "MyOrg", "Basement", "testing.root"); CertificatePair root = RSAUtil.generateCertificate(rootDn, SerialNum.randomSerialNum(), 365 * 15, 512, KeyType.CA, null); assertThat(root, is(notNullValue())); assertThat(root.getCertificate(), is(notNullValue())); assertThat(root.getKey(), is(notNullValue())); System.out.println("Root:\n" + root); String serverDn = RSAUtil.buildDN("GB", "SomeState", "SomeLocality", "MyOrg", "Basement", "testing.server"); CertificatePair server = RSAUtil.generateCertificate(serverDn, SerialNum.randomSerialNum(), 365 * 15, 512, KeyType.SERVER, root); assertThat(server, is(notNullValue())); assertThat(server.getCertificate(), is(notNullValue())); assertThat(server.getKey(), is(notNullValue())); server.getCertificate().verify(root.getCertificate().getPublicKey()); System.out.println("Server:\n" + server); }
public static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, CertificatePair issuer) throws Exception { return generateCertificate(DN, serial, days, keySize, type, null, issuer); }
RSAUtil { public static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, CertificatePair issuer) throws Exception { return generateCertificate(DN, serial, days, keySize, type, null, issuer); } }
RSAUtil { public static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, CertificatePair issuer) throws Exception { return generateCertificate(DN, serial, days, keySize, type, null, issuer); }  }
RSAUtil { public static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, CertificatePair issuer) throws Exception { return generateCertificate(DN, serial, days, keySize, type, null, issuer); }  static KeyPair generateRSAKeyPair(); static KeyPair generateRSAKeyPair(int size); static String buildDN(String country, String state, String locality, String org, String orgUnit, String commonName); static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, CertificatePair issuer); static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, PublicKey key, CertificatePair issuer); }
RSAUtil { public static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, CertificatePair issuer) throws Exception { return generateCertificate(DN, serial, days, keySize, type, null, issuer); }  static KeyPair generateRSAKeyPair(); static KeyPair generateRSAKeyPair(int size); static String buildDN(String country, String state, String locality, String org, String orgUnit, String commonName); static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, CertificatePair issuer); static CertificatePair generateCertificate(String DN, SerialNum serial, int days, int keySize, KeyType type, PublicKey key, CertificatePair issuer);  }