Package org.apache.harmony.security.tests.support

Examples of org.apache.harmony.security.tests.support.PrivateKeyStub


        assertEquals("[Signer]testToString1", s1.toString());

        Signer s2 = new SignerStub("testToString2", IdentityScope.getSystemScope());
        s2.toString();

        KeyPair kp = new KeyPair(new PublicKeyStub("public", "SignerTest.testToString", null), new PrivateKeyStub("private", "SignerTest.testToString", null));
        s1.setKeyPair(kp);
        s1.toString();

        s2.setKeyPair(kp);
        s2.toString();
View Full Code Here


    /**
     * verify Signer.getPrivateKey() returns null or private key
     */
    public void testGetPrivateKey() throws Exception {
        byte [] privateKeyData = { 1, 2, 3, 4, 5}
        PrivateKeyStub privateKey = new PrivateKeyStub("private", "fff", privateKeyData);
        PublicKeyStub publicKey = new PublicKeyStub("public", "fff", null);
        KeyPair kp = new KeyPair(publicKey, privateKey);
       
        Signer s = new SignerStub("sss5");
       
View Full Code Here

        MySecurityManager sm = new MySecurityManager();
        sm.denied.add(new SecurityPermission("getSignerPrivateKey"));
        System.setSecurityManager(sm);
        try {
            Signer s = new SignerStub("sss6");
            s.setKeyPair(new KeyPair(new PublicKeyStub("public", "fff", null), new PrivateKeyStub("private", "fff", null)));
            try {
                s.getPrivateKey();
                fail("SecurityException should be thrown");
            } catch (SecurityException ok) {}           
        } finally {
View Full Code Here

        System.setSecurityManager(sm);
        try {
            Signer s = new SignerStub("sss7");
            try {
                s.setKeyPair(new KeyPair(new PublicKeyStub("public", "fff",
                        null), new PrivateKeyStub("private", "fff", null)));
                fail("SecurityException should be thrown");
            } catch (SecurityException ok) {
            }
        } finally {
            System.setSecurityManager(oldSm);
View Full Code Here

    // key pair for testing
    private KeyPair keyPair;

    protected void setUp() throws Exception {
        PrivateKeyStub privateKey = new PrivateKeyStub("privateAlgorithm",
                "privateFormat", new byte[] { 0x00, 0x05, 0x10 });
        PublicKeyStub publicKey = new PublicKeyStub("publicAlgorithm",
                "publicFormat", new byte[] { 0x01, 0x02, 0x12 });

        keyPair = new KeyPair(publicKey, privateKey);
View Full Code Here

        assertEquals("[Signer]testToString1", s1.toString());

        Signer s2 = new SignerStub("testToString2", IdentityScope.getSystemScope());
        s2.toString();

        KeyPair kp = new KeyPair(new PublicKeyStub("public", "SignerTest.testToString", null), new PrivateKeyStub("private", "SignerTest.testToString", null));
        s1.setKeyPair(kp);
        s1.toString();

        s2.setKeyPair(kp);
        s2.toString();
View Full Code Here

    /**
     * verify Signer.getPrivateKey() returns null or private key
     */
    public void testGetPrivateKey() throws Exception {
        byte [] privateKeyData = { 1, 2, 3, 4, 5}
        PrivateKeyStub privateKey = new PrivateKeyStub("private", "fff", privateKeyData);
        PublicKeyStub publicKey = new PublicKeyStub("public", "fff", null);
        KeyPair kp = new KeyPair(publicKey, privateKey);
       
        Signer s = new SignerStub("sss5");
       
View Full Code Here

        MySecurityManager sm = new MySecurityManager();
        sm.denied.add(new SecurityPermission("getSignerPrivateKey"));
        System.setSecurityManager(sm);
        try {
            Signer s = new SignerStub("sss6");
            s.setKeyPair(new KeyPair(new PublicKeyStub("public", "fff", null), new PrivateKeyStub("private", "fff", null)));
            try {
                s.getPrivateKey();
                fail("SecurityException should be thrown");
            } catch (SecurityException ok) {}           
        } finally {
View Full Code Here

        System.setSecurityManager(sm);
        try {
            Signer s = new SignerStub("sss7");
            try {
                s.setKeyPair(new KeyPair(new PublicKeyStub("public", "fff",
                        null), new PrivateKeyStub("private", "fff", null)));
                fail("SecurityException should be thrown");
            } catch (SecurityException ok) {
            }
        } finally {
            System.setSecurityManager(oldSm);
View Full Code Here

    // key pair for testing
    private KeyPair keyPair;

    protected void setUp() throws Exception {
        PrivateKeyStub privateKey = new PrivateKeyStub("privateAlgorithm",
                "privateFormat", new byte[] { 0x00, 0x05, 0x10 });
        PublicKeyStub publicKey = new PublicKeyStub("publicAlgorithm",
                "publicFormat", new byte[] { 0x01, 0x02, 0x12 });

        keyPair = new KeyPair(publicKey, privateKey);
View Full Code Here

TOP

Related Classes of org.apache.harmony.security.tests.support.PrivateKeyStub

Copyright © 2018 www.massapicom. 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.