Search in sources :

Example 1 with Certificate

use of java.security.Certificate in project robovm by robovm.

the class Identity2Test method test_certificates.

/**
     * java.security.Identity#certificates()
     */
public void test_certificates() throws Exception {
    IdentitySubclass sub = new IdentitySubclass("test", new IdentityScopeSubclass());
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    X509Certificate[] cert = new X509Certificate[1];
    cert[0] = (X509Certificate) cf.generateCertificate(certArray);
    sub.setPublicKey(cert[0].getPublicKey());
    CertificateImpl certImpl = new CertificateImpl(cert[0]);
    sub.addCertificate(certImpl);
    java.security.Certificate[] certs = sub.certificates();
    assertEquals("Certificate not contained in the identity", certs[0], certImpl);
}
Also used : IdentityScopeSubclass(org.apache.harmony.security.tests.java.security.IdentityScope2Test.IdentityScopeSubclass) CertificateFactory(java.security.cert.CertificateFactory) X509Certificate(java.security.cert.X509Certificate) X509Certificate(java.security.cert.X509Certificate) Certificate(java.security.Certificate)

Aggregations

Certificate (java.security.Certificate)1 CertificateFactory (java.security.cert.CertificateFactory)1 X509Certificate (java.security.cert.X509Certificate)1 IdentityScopeSubclass (org.apache.harmony.security.tests.java.security.IdentityScope2Test.IdentityScopeSubclass)1