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

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


     * 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

     * 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

     * 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

     * 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

                new Date(300000000L)
        };
        String pkAlgID = "1.2.840.113549.1.1.4"; // MD5 with RSA encryption (source: http://asn1.elibel.tm.fr)
        PublicKey pkey;

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

        boolean[] keyUsage = new boolean[]
                    {true, true, true, true, true, true, true, true, false};
        // OID values was taken from rfc 3280
        HashSet extKeyUsage = new HashSet(Arrays.asList(new String[] {
View Full Code Here

                new Date(300000000L)
        };
        String pkAlgID = "1.2.840.113549.1.1.1"; // RSA encryption (source: http://asn1.elibel.tm.fr)
        PublicKey pkey;

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

        boolean[] keyUsage = new boolean[]
                    {true, true, true, true, true, true, true, true, false};
        // OID values was taken from rfc 3280
        HashSet extKeyUsage = new HashSet(Arrays.asList(new String[] {
View Full Code Here

                new Date(300000000L)
        };
        String pkAlgID = "1.2.840.113549.1.1.1"; // RSA encryption (source: http://asn1.elibel.tm.fr)
        PublicKey pkey;

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

        boolean[] keyUsage = new boolean[]
                    {true, true, true, true, true, true, true, true, false};
        // OID values was taken from rfc 3280
        HashSet extKeyUsage = new HashSet(Arrays.asList(new String[] {
View Full Code Here

     * KeyStore.PrivateKeyEntry is used.
     *
     */   
    public void testEntry02() throws Exception {
        assertTrue(NotSupportMsg, JKSSupported);
        TestKeyPair tkp = new TestKeyPair("DSA");
        KeyStoreTestSupport.MCertificate certs[] = {
                new KeyStoreTestSupport.MCertificate("DSA", tkp.getPrivate()
                        .getEncoded()),
                new KeyStoreTestSupport.MCertificate("DSA", tkp.getPrivate()
                        .getEncoded()) };
        PrivateKey privKey = tkp.getPrivate();
        KeyStore.PrivateKeyEntry pKey = new KeyStore.PrivateKeyEntry(privKey,
                certs);
        char[] pwd = { 'p', 'a', 's', 's', 'w', 'd' };
        KeyStore.PasswordProtection pPath = new KeyStore.PasswordProtection(pwd);
        KeyStore.PasswordProtection anotherPath = new KeyStore.PasswordProtection(
View Full Code Here

     * FIXME: this test should be changed to verify SecretKeyEntry.
     * It is not supported. 
     */   
    public void testEntry03() throws Exception {
        assertTrue(NotSupportMsg, JKSSupported);
        TestKeyPair tkp = new TestKeyPair("DSA");
        KeyStoreTestSupport.SKey secKey = new KeyStoreTestSupport.SKey("DSA",
                tkp.getPrivate().getEncoded());
        KeyStore.SecretKeyEntry sKey = new KeyStore.SecretKeyEntry(
                secKey);       
        char [] pwd = {'p', 'a', 's', 's', 'w', 'd'};
        KeyStore.PasswordProtection pPath = new KeyStore.PasswordProtection(pwd);
        KeyStoreTestSupport.AnotherEntry aEntry = new KeyStoreTestSupport.AnotherEntry();
View Full Code Here

TOP

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

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.