Examples of TestKeyPair


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

        KeyStore.PasswordProtection protPass1 = new KeyStore.PasswordProtection(
                pass);
        KeyStore.ProtectionParameter [] pp = { protPass, protPass1,
                callbackHand, myProtParam };
        TestKeyPair tkp = new TestKeyPair("DSA");
        Certificate certs[] = {
                new MCertificate("DSA", tkp.getPrivate()
                        .getEncoded()),
                new MCertificate("DSA", tkp.getPrivate()
                        .getEncoded()) };
        PrivateKey privKey = tkp.getPrivate();

        KeyStore.PrivateKeyEntry pKey = new KeyStore.PrivateKeyEntry(privKey,
                certs);
        for (int i = 0; i < pp.length; i++) {
            ks = KeyStore.getInstance(defaultType);
View Full Code Here

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

*/
public class SecurityTest extends TestCase {

    public final void testMixed() {

        TestKeyPair tkp = null;
        try {
            tkp = new TestKeyPair("DSA");
        } catch (NoSuchAlgorithmException e1) {
            e1.printStackTrace();
            return;
        }

        try {
            MessageDigest.getInstance("SHA-1");
            KeyFactory.getInstance("DSA");
            Signature ss =Signature.getInstance("DSA");
            ss.initSign(tkp.getPrivate());
            Signature.getInstance("aaaaaaaaaaaa");
        } catch (Exception e) {
            // ignore
        }   

View Full Code Here

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

     */
    public void testSetSubjectPublicKeyAlgID() throws Exception {
        String pkaid1 = "1.2.840.113549.1.1.1"; // RSA (source: http://asn1.elibel.tm.fr)
        String pkaid2 = "1.2.840.10040.4.1"; // DSA (source: http://asn1.elibel.tm.fr)

        PublicKey pkey1 = new TestKeyPair("RSA").getPublic();
        PublicKey pkey2 = new TestKeyPair("DSA").getPublic();

        TestCert cert_1 = new TestCert(pkey1);
        TestCert cert_2 = new TestCert(pkey2);
        X509CertSelector selector = new X509CertSelector();

View Full Code Here

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

     * setSubjectPublicKey(PublicKey key) method testing.
     * Tests if any certificates match in the case of null criteria,
     * if [not]proper certificates [do not]match.
     */
    public void testSetSubjectPublicKey1() throws Exception {
        PublicKey pkey1 = new TestKeyPair("RSA").getPublic();
        PublicKey pkey2 = new TestKeyPair("DSA").getPublic();

        TestCert cert_1 = new TestCert(pkey1);
        TestCert cert_2 = new TestCert(pkey2);
        X509CertSelector selector = new X509CertSelector();

View Full Code Here

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

     * Tests if the method return null in the case of not specified criteria,
     * if the returned value corresponds to specified
     */
    public void testGetSubjectPublicKey1() throws Exception {

        PublicKey pkey = new TestKeyPair("RSA").getPublic();

        X509CertSelector selector = new X509CertSelector();

        assertNull("Selector should return null",
                                            selector.getSubjectPublicKey());
View Full Code Here

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

     * Tests if any certificates match in the case of null criteria,
     * if [not]proper certificates [do not]match, and if the initialization
     * object are copied during the initialization.
     */
    public void testSetSubjectPublicKey2() throws Exception {
        PublicKey pkey1 = new TestKeyPair("RSA").getPublic();
        PublicKey pkey2 = new TestKeyPair("DSA").getPublic();

        byte[] encoding1 = pkey1.getEncoded();
        byte[] encoding2 = pkey2.getEncoded();
        TestCert cert_1 = new TestCert(pkey1);
        TestCert cert_2 = new TestCert(pkey2);
View Full Code Here

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

     * Tests if the method return null in the case of not specified criteria,
     * if the returned value corresponds to specified
     */
    public void testGetSubjectPublicKey2() throws Exception {

        PublicKey pkey = new TestKeyPair("RSA").getPublic();

        X509CertSelector selector = new X509CertSelector();

        assertNull("Selector should return null",
                                            selector.getSubjectPublicKey());
View Full Code Here

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

                new Date(300000000L)
        };
        String pkAlgID = "1.2.840.113549.1.1.4"; // MD5 with RSA encryption (source: http://asn1.elibel.tm.fr)
        PublicKey pkey;
        try {
            pkey = new TestKeyPair("RSA").getPublic();
        } catch (Exception e) {
            e.printStackTrace();
            fail("Unexpected Exception was thrown: " + e.getMessage());
            return;
        }
View Full Code Here

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

                new Date(300000000L)
        };
        String pkAlgID = "1.2.840.113549.1.1.1"; // RSA encryption (source: http://asn1.elibel.tm.fr)
        PublicKey pkey;
        try {
            pkey = new TestKeyPair("RSA").getPublic();
        } catch (Exception e) {
            e.printStackTrace();
            fail("Unexpected Exception was thrown: " + e.getMessage());
            return;
        }
View Full Code Here

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

                new Date(300000000L)
        };
        String pkAlgID = "1.2.840.113549.1.1.1"; // RSA encryption (source: http://asn1.elibel.tm.fr)
        PublicKey pkey;
        try {
            pkey = new TestKeyPair("RSA").getPublic();
        } catch (Exception e) {
            e.printStackTrace();
            fail("Unexpected Exception was thrown: " + e.getMessage());
            return;
        }
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.