Examples of certificates()


Examples of java.security.Identity.certificates()

                        (rb.getString("Keystore entry for <id.getName()> already exists"));
                    Object[] source = {id.getName()};
                    System.err.println(form.format(source));
                    continue;
                }
                java.security.Certificate[] certs = id.certificates();
                if (certs!=null && certs.length>0) {
                    // we can only store one user cert per identity.
                    // convert old-style to new-style cert via the encoding
                    DerOutputStream dos = new DerOutputStream();
                    certs[0].encode(dos);
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", new byte[]{1,2,3,4,5});
        i.setPublicKey(pk1);
        // try with the same key
        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
        i.addCertificate(c1);
        assertSame(c1, i.certificates()[0]);
        // try Certificate with different key
        try {
            i.addCertificate(new CertificateStub("ccc", null, null, new PublicKeyStub("k2", "fff", new byte[]{6,7,8,9,0})));
            fail("KeyManagementException should be thrown");
        } catch (KeyManagementException ok) {}       
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

    public void testAddCertificate2() throws Exception {
        Identity i = new IdentityStub("iii");
        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);       
        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
        i.addCertificate(c1);
        assertSame(c1, i.certificates()[0]);
        assertSame(pk1, i.getPublicKey());
         
    }
   
    /**
 
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

        sm.denied.add(new SecurityPermission("removeIdentityCertificate"));
        Identity i = new IdentityStub("iii");
        i.addCertificate(new CertificateStub("ccc", null, null, null));
        System.setSecurityManager(sm);
        try {
            i.removeCertificate(i.certificates()[0]);
            fail("SecurityException should be thrown");
        } catch (SecurityException ok) {
        } finally {
            System.setSecurityManager(null);
        }
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

        PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);       
        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
        CertificateStub c2 = new CertificateStub("zzz", null, null, pk1);
        i.addCertificate(c1);
        i.addCertificate(c2);
        Certificate[] s = i.certificates();
        assertEquals(2, s.length);
        assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
        assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
        s[0] = null;
        s[1] = null;
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

        assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
        assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
        s[0] = null;
        s[1] = null;
        // check that the copy was modified
        s = i.certificates();
        assertEquals(2, s.length);
        assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
        assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
    }
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

        PublicKeyStub pk1 = new PublicKeyStub("kkk", "Identity.testSetPublicKey4", null);       
        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
        CertificateStub c2 = new CertificateStub("zzz", null, null, pk1);
        i.addCertificate(c1);
        i.addCertificate(c2);
        assertEquals(2, i.certificates().length);
        assertSame(pk1, i.getPublicKey());
       
        PublicKeyStub pk2 = new PublicKeyStub("zzz", "Identity.testSetPublicKey4", null);   
        i.setPublicKey(pk2);
        assertSame(pk2, i.getPublicKey());
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

        assertSame(pk1, i.getPublicKey());
       
        PublicKeyStub pk2 = new PublicKeyStub("zzz", "Identity.testSetPublicKey4", null);   
        i.setPublicKey(pk2);
        assertSame(pk2, i.getPublicKey());
        assertEquals(0, i.certificates().length);
    }
   
    /**
     * verify Identity.getPublicKey() returns public key
     */
 
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

        PublicKeyStub pk1 = new PublicKeyStub("kkk", "Identity.testSetPublicKey4", null);       
        CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
        CertificateStub c2 = new CertificateStub("zzz", null, null, pk1);
        i.addCertificate(c1);
        i.addCertificate(c2);
        assertEquals(2, i.certificates().length);
        assertSame(pk1, i.getPublicKey());
       
        PublicKeyStub pk2 = new PublicKeyStub("zzz", "Identity.testSetPublicKey4", null);   
        i.setPublicKey(pk2);
        assertSame(pk2, i.getPublicKey());
View Full Code Here

Examples of org.apache.harmony.security.tests.support.IdentityStub.certificates()

        assertSame(pk1, i.getPublicKey());
       
        PublicKeyStub pk2 = new PublicKeyStub("zzz", "Identity.testSetPublicKey4", null);   
        i.setPublicKey(pk2);
        assertSame(pk2, i.getPublicKey());
        assertEquals(0, i.certificates().length);
    }
   
    /**
     * verify Identity.getPublicKey() returns public key
     */
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.