harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r392891 [5/5] - in /incubator/harmony/enhanced/classlib/trunk: make/ modules/auth/make/common/ modules/auth/src/test/java/common/tests/ modules/auth/src/test/java/common/tests/api/ modules/auth/src/test/java/common/tests/api/javax/ modules/...
Date Mon, 10 Apr 2006 05:38:38 GMT
Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/CertificateFactoryTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/CertificateFactoryTest.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/CertificateFactoryTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/CertificateFactoryTest.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,588 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.api.java.security.cert;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.cert.CRL;
+import java.security.cert.CRLException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Collection;
+
+import tests.support.Support_GetResource;
+import tests.support.resource.Support_Resources;
+
+public class CertificateFactoryTest extends junit.framework.TestCase {
+
+	private static final String BASE_URL = Support_GetResource
+			.getResourceURL("/../internalres/");
+
+	private static final String[] CERTIFICATE_URLS = new String[] {
+			"Bug93891-PEM.cer", "Bug93891-DER.cer", "Bug94404-PKCS7.cer" };
+
+	private static final String[] CRL_URLS = new String[] { "Bug93893-1.crl",
+			"Bug93893-2.crl", "Bug94404-DER.crl" };
+
+	private static final String[] CRLCOLLECTION_URLS = new String[] { "Bug94404-PKCS7.crl" };
+
+	/**
+	 * @tests java.security.cert.CertificateFactory#generateCertificate(java.io.InputStream)
+	 */
+	public void test_generateCertificateLjava_io_InputStream() {
+		// Test 1
+		// Test for method java.security.cert.Certificate
+		// java.security.cert.CertificateFactory.generateCertificate(java.io.InputStream)
+		int i = 0;
+		try {
+			CertificateFactory fact = CertificateFactory.getInstance("X.509");
+			for (; i < CERTIFICATES_ENCODED_X509.length; i++)
+				if (CERTIFICATES_ENCODED_X509[i] != null) {
+					ByteArrayInputStream bais = new ByteArrayInputStream(
+							CERTIFICATES_ENCODED_X509[i].getBytes());
+					X509Certificate cert = (X509Certificate) fact
+							.generateCertificate(bais);
+					
+					// try again with generateCertificates()
+					bais = new ByteArrayInputStream(
+							CERTIFICATES_ENCODED_X509[i].getBytes());
+					cert = (X509Certificate) fact.generateCertificate(bais);
+				}
+		} catch (CertificateException e) {
+			fail("CertificateException in getInstance or generateCertificate["
+					+ i + "]");
+		}
+
+		// Test 2
+		InputStream is = Support_Resources.getStream("hyts_badpem.cer");
+		boolean caughtException = false;
+		try {
+			CertificateFactory fact = CertificateFactory.getInstance("X.509");
+			Certificate cert = fact.generateCertificate(is);
+		} catch (CertificateException e) {
+			caughtException = true;
+		} finally {
+			try {
+				is.close();
+			} catch (IOException e) {
+				// Ignore
+			}
+		}
+		assertTrue("Test2: CertificateException not thrown", caughtException);
+	}
+
+	/**
+	 * @tests java.security.cert.CertificateFactory#generateCertificates(java.io.InputStream)
+	 */
+	public void test_generateCertificatesLjava_io_InputStream() {
+		try {
+			CertificateFactory fact = CertificateFactory.getInstance("X.509");
+			for (int i = 0; i < CERTIFICATE_URLS.length; i++) {
+				URL certUrl = new URL(BASE_URL + CERTIFICATE_URLS[i]);
+				try {
+					InputStream is = certUrl.openStream();
+					Collection certs = fact.generateCertificates(is);
+					assertNotNull("The certificates in \""
+							+ certUrl.toExternalForm()
+							+ "\" were not parsed correctly", certs);
+				} catch (IOException e) {
+					// the certificate could not be found, skip it
+				} catch (CertificateException e) {
+					fail("An exception was thrown while parsing \""
+							+ certUrl.toExternalForm() + "\": "
+							+ e.getMessage());
+				}
+			}
+		} catch (CertificateException e) {
+			fail("Could not instantiate the CertificateFactory for X509: "
+					+ e.getMessage());
+		} catch (MalformedURLException e) {
+			fail("Invalid certificate url: " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.security.cert.CertificateFactory#generateCRL(java.io.InputStream)
+	 */
+	public void test_generateCRLLjava_io_InputStream() {
+		try {
+			CertificateFactory fact = CertificateFactory.getInstance("X.509");
+			for (int i = 0; i < CRL_URLS.length; i++) {
+				URL certUrl = new URL(BASE_URL + CRL_URLS[i]);
+				try {
+					InputStream is = certUrl.openStream();
+					CRL crl = fact.generateCRL(is);
+					assertNotNull("The CRL in \"" + certUrl.toExternalForm()
+							+ "\" were not parsed correctly", crl);
+				} catch (IOException e) {
+					// the certificate could not be found, skip it
+				} catch (CRLException e) {
+					fail("An exception was thrown while parsing \""
+							+ certUrl.toExternalForm() + "\": "
+							+ e.getMessage());
+				}
+			}// end for 
+		} catch (CertificateException e) {
+			fail("Could not instantiate the CertificateFactory for X509: "
+					+ e.getMessage());
+		} catch (MalformedURLException e) {
+			fail("Invalid certificate url: " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.security.cert.CertificateFactory#generateCRLs(java.io.InputStream)
+	 */
+	public void test_generateCRLsLjava_io_InputStream() {
+		try {
+			CertificateFactory fact = CertificateFactory.getInstance("X.509");
+			for (int i = 0; i < CRLCOLLECTION_URLS.length; i++) {
+				URL certUrl = new URL(BASE_URL + CRLCOLLECTION_URLS[i]);
+				try {
+					InputStream is = certUrl.openStream();
+					Collection crls = fact.generateCRLs(is);
+					assertTrue("The CRLs in \"" + certUrl.toExternalForm()
+							+ "\" were not parsed correctly", crls != null
+							&& crls.size() > 0);
+				} catch (IOException e) {
+					// the certificate could not be found, skip it
+				} catch (CRLException e) {
+					fail("An exception was thrown while parsing \""
+							+ certUrl.toExternalForm() + "\": "
+							+ e.getMessage());
+				}
+			}
+		} catch (CertificateException e) {
+			fail("Could not instantiate the CertificateFactory for X509: "
+					+ e.getMessage());
+		} catch (MalformedURLException e) {
+			fail("Invalid certificate url: " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.security.cert.CertificateFactory#getInstance(java.lang.String)
+	 */
+	public void test_getInstanceLjava_lang_String() {
+		// Test for method java.security.cert.CertificateFactory
+		// java.security.cert.CertificateFactory.getInstance(java.lang.String)
+		try {
+			CertificateFactory fact = CertificateFactory.getInstance("X.509");
+			assertTrue("factory is null", fact != null);
+		} catch (CertificateException e) {
+			assertTrue("CertificateException in getInstance", false);
+		}
+	}
+
+	/**
+	 * @tests java.security.cert.CertificateFactory#getInstance(java.lang.String,
+	 *        java.lang.String)
+	 */
+	public void test_getInstanceLjava_lang_StringLjava_lang_String() {
+		// Test for method java.security.cert.CertificateFactory
+		// java.security.cert.CertificateFactory.getInstance(java.lang.String,
+		// java.lang.String)
+		try {
+			Provider[] providers = Security
+					.getProviders("CertificateFactory.X.509");
+			if (providers != null) {
+				for (int i = 0; i < providers.length; i++) {
+					CertificateFactory fact = CertificateFactory.getInstance(
+							"X.509", providers[i].getName());
+					assertNotNull("factory is null", fact);
+				}// end for
+			} else {
+				fail("No providers support CertificateFactory.X.509");
+			}
+		} catch (CertificateException e) {
+			fail("CertificateException in getInstance");
+		} catch (NoSuchProviderException e) {
+			fail("getInstance did not find the provider");
+		}
+
+		// exception case
+		try {
+			CertificateFactory fact = CertificateFactory.getInstance("X.509",
+					"IHaventBeenConfigured");
+			fail("Should have thrown NoSuchProviderException");
+		} catch (NoSuchProviderException e) {
+			// Expected
+		} catch (Exception e) {
+			fail("Should have thrown NoSuchProviderException");
+		}
+	}
+
+	/**
+	 * @tests java.security.cert.CertificateFactory#getProvider()
+	 */
+	public void test_getProvider() {
+		// Test for method java.security.Provider
+		// java.security.cert.CertificateFactory.getProvider()
+		try {
+			Provider p = CertificateFactory.getInstance("X.509").getProvider();
+			assertNotNull("provider is null", p);
+		} catch (CertificateException e) {
+			fail("CertificateException in getInstance");
+		}
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+
+	static final String[] CERTIFICATES_ENCODED_X509 = new String[17];
+
+	{
+		CERTIFICATES_ENCODED_X509[0] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIICZTCCAdICBQL3AAC2MA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw\n"
+				+ "HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl\n"
+				+ "IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NzAyMjAwMDAwMDBa\n"
+				+ "Fw05ODAyMjAyMzU5NTlaMIGWMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZv\n"
+				+ "cm5pYTESMBAGA1UEBxMJUGFsbyBBbHRvMR8wHQYDVQQKExZTdW4gTWljcm9zeXN0\n"
+				+ "ZW1zLCBJbmMuMSEwHwYDVQQLExhUZXN0IGFuZCBFdmFsdWF0aW9uIE9ubHkxGjAY\n"
+				+ "BgNVBAMTEWFyZ29uLmVuZy5zdW4uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB\n"
+				+ "iQKBgQCofmdY+PiUWN01FOzEewf+GaG+lFf132UpzATmYJkA4AEA/juW7jSi+LJk\n"
+				+ "wJKi5GO4RyZoyimAL/5yIWDV6l1KlvxyKslr0REhMBaD/3Z3EsLTTEf5gVrQS6sT\n"
+				+ "WMoSZAyzB39kFfsB6oUXNtV8+UKKxSxKbxvhQn267PeCz5VX2QIDAQABMA0GCSqG\n"
+				+ "SIb3DQEBAgUAA34AXl3at6luiV/7I9MN5CXYoPJYI8Bcdc1hBagJvTMcmlqL2uOZ\n"
+				+ "H9T5hNMEL9Tk6aI7yZPXcw/xI2K6pOR/FrMp0UwJmdxX7ljV6ZtUZf7pY492UqwC\n"
+				+ "1777XQ9UEZyrKJvF5ntleeO0ayBqLGVKCWzWZX9YsXCpv47FNLZbupE=\n"
+				+ "-----END CERTIFICATE-----\n";
+
+		CERTIFICATES_ENCODED_X509[1] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIICZzCCAdCgAwIBAgIBGzANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQGEwJVUzEY\n"
+				+ "MBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50MQwwCgYDVQQLEwNEb0QxDDAKBgNVBAsT\n"
+				+ "A1BLSTEcMBoGA1UEAxMTRG9EIFBLSSBNZWQgUm9vdCBDQTAeFw05ODA4MDMyMjAy\n"
+				+ "MjlaFw0wODA4MDQyMjAyMjlaMGExCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9VLlMu\n"
+				+ "IEdvdmVybm1lbnQxDDAKBgNVBAsTA0RvRDEMMAoGA1UECxMDUEtJMRwwGgYDVQQD\n"
+				+ "ExNEb0QgUEtJIE1lZCBSb290IENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n"
+				+ "gQDbrM/J9FrJSX+zxFUbsI9Vw5QbguVBIa95rwW/0M8+sM0r5gd+DY6iubm6wnXk\n"
+				+ "CSvbfQlFEDSKr4WYeeGp+d9WlDnQdtDFLdA45tCi5SHjnW+hGAmZnld0rz6wQekF\n"
+				+ "5xQaa5A6wjhMlLOjbh27zyscrorMJ1O5FBOWnEHcRv6xqQIDAQABoy8wLTAdBgNV\n"
+				+ "HQ4EFgQUVrmYR6m9701cHQ3r5kXyG7zsCN0wDAYDVR0TBAUwAwEB/zANBgkqhkiG\n"
+				+ "9w0BAQUFAAOBgQDVX1Y0YqC7vekeZjVxtyuC8Mnxbrz6D109AX07LEIRzNYzwZ0w\n"
+				+ "MTImSp9sEzWW+3FueBIU7AxGys2O7X0qmN3zgszPfSiocBuQuXIYQctJhKjF5KVc\n"
+				+ "VGQRYYlt+myhl2vy6yPzEVCjiKwMEb1Spu0irCf+lFW2hsdjvmSQMtZvOw==\n"
+				+ "-----END CERTIFICATE-----\n";
+
+		CERTIFICATES_ENCODED_X509[2] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIID6TCCA1KgAwIBAgIBGjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQGEwJVUzEY\n"
+				+ "MBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50MQwwCgYDVQQLEwNEb0QxDDAKBgNVBAsT\n"
+				+ "A1BLSTEcMBoGA1UEAxMTRG9EIFBLSSBNZWQgUm9vdCBDQTAeFw05ODA4MDIxNjQ1\n"
+				+ "MzhaFw0wMzA4MDIxNjQ1MzhaMFYxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9VLlMu\n"
+				+ "IEdvdmVybm1lbnQxDDAKBgNVBAsTA0RvRDEMMAoGA1UECxMDUEtJMREwDwYDVQQD\n"
+				+ "EwhNZWQgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyUcrw1k6QKdB\n"
+				+ "WjgtGOk1AVaqJNI8acDGglhqQQ94QYfqZKuo1wwdnYehrgo5QcGkw9XcjBYegLFs\n"
+				+ "v4NCCwZ2pgsfYJlvHcSGPhT/wROUYEpXKelfXiEeaGhFl8zGcqteI2+EBbOZnFpj\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3\n"
+				+ "DQEBBQUAA4GBAEg7AC9bad2KZzyX4cqLU/mv2cbVg6tES2PIeST7nk8CQcv9a8IO\n"
+				+ "3K4uhrKoTsQfqs9p6+6s0VbgH3PKvOAIF4DAp5Yq1zz3fB+hsaFleHqtDNuldm1+\n"
+				+ "3XA2Oqa5aRFkb6Krut0EEOV4c/GEAPOrRGUTzYmOp4SEc8TEaD/75A7R\n"
+				+ "-----END CERTIFICATE-----\n";
+
+		CERTIFICATES_ENCODED_X509[4] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIIDXDCCAsWgAwIBAgIBSjANBgkqhkiG9w0BAQUFADBWMQswCQYDVQQGEwJVUzEY\n"
+				+ "MBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50MQwwCgYDVQQLEwNEb0QxDDAKBgNVBAsT\n"
+				+ "A1BLSTERMA8GA1UEAxMITWVkIENBLTEwHhcNOTgwODAyMTgwMjQwWhcNMDEwODAy\n"
+				+ "MTgwMjQwWjB0MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50\n"
+				+ "MQwwCgYDVQQLEwNEb0QxDDAKBgNVBAsTA1BLSTENMAsGA1UECxMEVVNBRjEgMB4G\n"
+				+ "A1UEAxMXR3VtYnkuSm9zZXBoLjAwMDAwMDUwNDQwgZ8wDQYJKoZIhvcNAQEBBQAD\n"
+				+ "gY0AMIGJAoGBALT/R7bPqs1c1YqXAg5HNpZLgW2HuAc7RCaP06cE4R44GBLw/fQc\n"
+				+ "VRNLn5pgbTXsDnjiZVd8qEgYqjKFQka4/tNhaF7No2tBZB+oYL/eP0IWtP+h/W6D\n"
+				+ "KR5+UvIIdgmx7k3t9jp2Q51JpHhhKEb9WN54trCO9Yu7PYU+LI85jEIBAgMBAAGj\n"
+				+ "ggEaMIIBFjAWBgNVHSAEDzANMAsGCWCGSAFlAgELAzAfBgNVHSMEGDAWgBQzOhTo\n"
+				+ "CWdhiGUkIOx5cELXppMe9jAdBgNVH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RFbnJvbGwvTWljcm9zb2Z0IENlcnRpZmljYXRl\n"
+				+ "IFNlcnZlciBUZXN0IEdyb3VwIENBLmNybDBYoFagVIZSZmlsZTovL1xcQ0VSVFNS\n"
+				+ "VlxDZXJ0U3J2XENlcnRFbnJvbGxcTWljcm9zb2Z0IENlcnRpZmljYXRlIFNlcnZl\n"
+				+ "ciBUZXN0IEdyb3VwIENBLmNybDAJBgNVHRMEAjAAMHQGCCsGAQUFBwEBBGgwZjBk\n"
+				+ "BggrBgEFBQcwAoZYaHR0cDovL0NFUlRTUlYvQ2VydFNydi9DZXJ0RW5yb2xsL0NF\n"
+				+ "UlRTUlZfTWljcm9zb2Z0IENlcnRpZmljYXRlIFNlcnZlciBUZXN0IEdyb3VwIENB\n"
+				+ "LmNydDANBgkqhkiG9w0BAQQFAANBAFbEj4j/3Nv6WcAvq24C7yw8L0FcyE4dtLLX\n"
+				+ "U+04P0POe/doyTT6UngXNXp9RXpqDSiIHBRTshpvR+N2vweR5qA=\n"
+				+ "-----END CERTIFICATE-----\n";
+
+		CERTIFICATES_ENCODED_X509[7] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIIEYTCCBAugAwIBAgIIFViWmwAAAlowDQYJKoZIhvcNAQEEBQAwgZMxCzAJBgNV\n"
+				+ "BAYTAlVTMQswCQYDVQQIEwJXQTEQMA4GA1UEBxMHUmVkbW9uZDETMBEGA1UEChMK\n"
+				+ "V2luZG93cyBOVDEbMBkGA1UECxMSRGlzdHJpYnV0ZWQgU3lzdGVtMTMwMQYDVQQD\n"
+				+ "EypNaWNyb3NvZnQgQ2VydGlmaWNhdGUgU2VydmVyIFRlc3QgR3JvdXAgQ0EwHhcN\n"
+				+ "OTcxMTI2MDYzNzE4WhcNOTgxMDE0MTgxMTI4WjCBmjEjMCEGCSqGSIb3DQEJARYU\n"
+				+ "YWxsYW5jQG1pY3Jvc29mdC5jb20xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJXQTEQ\n"
+				+ "MA4G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ATE-----\n";
+
+		CERTIFICATES_ENCODED_X509[11] = null;
+
+		CERTIFICATES_ENCODED_X509[12] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIICWDCCAgICAQAwDQYJKoZIhvcNAQEEBQAwgbYxCzAJBgNVBAYTAlpBMRUwEwYD\n"
+				+ "VQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU\n"
+				+ "VGhhd3RlIENvbnN1bHRpbmcgY2MxHzAdBgNVBAsTFkNlcnRpZmljYXRpb24gU2Vy\n"
+				+ "dmljZXMxFzAVBgNVBAMTDnd3dy50aGF3dGUuY29tMSMwIQYJKoZIhvcNAQkBFhR3\n"
+				+ "ZWJtYXN0ZXJAdGhhd3RlLmNvbTAeFw05NjExMTQxNzE1MjVaFw05NjEyMTQxNzE1\n"
+				+ "MjVaMIG2MQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYD\n"
+				+ "VQQHEwlDYXBlIFRvd24xHTAbBgNVBAoTFFRoYXd0ZSBDb25zdWx0aW5nIGNjMR8w\n"
+				+ "HQYDVQQLExZDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzMRcwFQYDVQQDEw53d3cudGhh\n"
+				+ "d3RlLmNvbTEjMCEGCSqGSIb3DQEJARYUd2VibWFzdGVyQHRoYXd0ZS5jb20wXDAN\n"
+				+ "BgkqhkiG9w0BAQEFAANLADBIAkEAmpIl7aR3aSPUUwUrHzpVMrsm3gpI2PzIwMh3\n"
+				+ "9l1h/RszI0/0qC2WRMlfwm5FapohoyjTJ6ZyGUUenICllKyKZwIDAQABMA0GCSqG\n"
+				+ "SIb3DQEBBAUAA0EAfI57WLkOKEyQqyCDYZ6reCukVDmAe7nZSbOyKv6KUvTCiQ5c\n"
+				+ "e5L4y3c/ViKdlou5BcQYAbxA7rwO/vz4m51w4w==\n"
+				+ "-----END CERTIFICATE-----\n";
+
+		CERTIFICATES_ENCODED_X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+ "Px7drfbFAFt8mFE1mjYCuj21ePHhs1DlZKJwu2ElC6GaRwtBk3+oCMDAnLuySd0+fAohdDALBgcq\n"
+				+ "hkjOOAQDBQADLwAwLAIUddbqC3woMcABg/r1GPW9eVNStGwCFCBGySvdXK0i4aLVC4Ptbc3PQFjp\n"
+				+ "-----END CERTIFICATE-----\n";
+
+		CERTIFICATES_ENCODED_X509[14] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIICyzCCAjQCAQAwDQYJKoZIhvcNAQEEBQAwga0xCzAJBgNVBAYTAlVTMREwDwYD\n"
+				+ "VQQIEwhOZXcgWW9yazEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTEcMBoGA1UEChMT\n"
+				+ "Q29sdW1iaWEgVW5pdmVyc2l0eTENMAsGA1UECxMEQWNJUzEfMB0GA1UEAxMWQ29s\n"
+				+ "dW1iaWEgVW5pdmVyc2l0eSBDQTElMCMGCSqGSIb3DQEJARYWY2VydC1hdXRoQGNv\n"
+				+ "bHVtYmlhLmVkdTAeFw05NzA0MjgxNDQxMDNaFw0wMDA0MjgxNDQxMDNaMIGtMQsw\n"
+				+ "CQYDVQQGEwJVUzERMA8GA1UECBMITmV3IFlvcmsxFjAUBgNVBAcTDU5ldyBZb3Jr\n"
+				+ "IENpdHkxHDAaBgNVBAoTE0NvbHVtYmlhIFVuaXZlcnNpdHkxDTALBgNVBAsTBEFj\n"
+				+ "SVMxHzAdBgNVBAMTFkNvbHVtYmlhIFVuaXZlcnNpdHkgQ0ExJTAjBgkqhkiG9w0B\n"
+				+ "CQEWFmNlcnQtYXV0aEBjb2x1bWJpYS5lZHUwgZ8wDQYJKoZIhvcNAQEBBQADgY0A\n"
+				+ "MIGJAoGBANiod6flzM72CbsK/3gzHzcdjpoozRDD/wgq31jEeDdfKY+ljAwxaZS9\n"
+				+ "mt7S1g7lL+55fx7FjfJxvJRXvS9UbDU46PDDyJloWYobg84bK5ZcV5UnIPZmGHW/\n"
+				+ "/xVDUtIGhc4T+Xm5p4F+4AcgewF2s4TbKWxfC98FJfepc31KjkGbAgMBAAEwDQYJ\n"
+				+ "KoZIhvcNAQEEBQADgYEAI/e6xC+osVM4eMkSUUWgihuocQlRL9ixTlGqW9fvNlI1\n"
+				+ "q58fELU5bcFko7d02S9Egac/9ckkt/sbHMv9zQhfnvpol8BN+LivGu+09IiOW4yq\n"
+				+ "c9xT58Pv9gwZ/Ei5VS+FXvzHIr91yWIlwLsnKfgYDrmQowG5FkHSG1ZotUdl7Oo=\n"
+				+ "-----END CERTIFICATE-----\n";
+
+		CERTIFICATES_ENCODED_X509[15] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIICnjCCAgcCAQMwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAklUMR4wHAYD\n"
+				+ "VQQKExVQb2xpdGVjbmljbyBkaSBUb3Jpbm8xIzAhBgNVBAsTGklDRS1URUwgSXRh\n"
+				+ "bGlhbiBDQSBmb3IgV1dXMSAwHgYDVQQDExdDZXJ0aWZpY2F0aW9uIEF1dGhvcml0\n"
+				+ "eTEqMCgGCSqGSIb3DQEJARYbd3d3LWNhLWl0QGljZS10ZWwucG9saXRvLml0MB4X\n"
+				+ "DTk2MTAwMjExNDQ0NFoXDTk3MTIwMTExNDQ0NFowgY0xCzAJBgNVBAYTAklUMQ8w\n"
+				+ "DQYDVQQHEwZUb3Jpbm8xHjAcBgNVBAoTFVBvbGl0ZWNuaWNvIGRpIFRvcmlubzEO\n"
+				+ "MAwGA1UECxMFQ2VTSVQxGTAXBgNVBAMTEHVsaXNzZS5wb2xpdG8uaXQxIjAgBgkq\n"
+				+ "hkiG9w0BCQEWE3dlYm1hc3RlckBwb2xpdG8uaXQwgZ8wDQYJKoZIhvcNAQEBBQAD\n"
+				+ "gY0AMIGJAoGBAMUq/FdrxbSfGtGZq/FTTgC1JqxO4iiHiyxtgRT1oEvJIUjajVRN\n"
+				+ "dtBVUhW6JmhHje/qnMop09XcF7b89a9ahtG9jM70S03biXVmg66pWOpy6P7znAQj\n"
+				+ "VFPoCRR7BqUiGq0419a101Acaqkxi/4DdqiTPee4H7mcDZYu+fDPNQaHAgMBAAEw\n"
+				+ "DQYJKoZIhvcNAQEEBQADgYEAt15bzk0XO+ZM+Q6275VTQIon6KQQHnv9NflIFOoW\n"
+				+ "fgGRmoyiJFrjU1sIS8ctF03DH2xR20CuKd98fBpKnoOLd7eTKAGzGFPml36TPVj+\n"
+				+ "YYWdrWqnIzQn6F0OKR/U3Y+ot5fUNuqN36Q1wsVvpPJlOMx8D8OQy8ainHgG3YYA\n"
+				+ "TJk=\n" + "-----END CERTIFICATE-----\n";
+
+		CERTIFICATES_ENCODED_X509[16] =
+		"-----BEGIN CERTIFICATE-----\n"
+				+ "MIIC1TCCAj6gAwIBAgIBBDANBgkqhkiG9w0BAQQFADBZMQswCQYDVQQGEwJVUzEf\n"
+				+ "MB0GA1UEChMWVW5pdmVyc2l0eSBvZiBDb2xvcmFkbzEWMBQGA1UECxMNU3lzdGVt\n"
+				+ "IE9mZmljZTERMA8GA1UEAxMIVU1TIENBLTEwHhcNOTgwNTExMjEwMjU0WhcNMDgw\n"
+				+ "NTEwMjEwMjU0WjBZMQswCQYDVQQGEwJVUzEfMB0GA1UEChMWVW5pdmVyc2l0eSBv\n"
+				+ "ZiBDb2xvcmFkbzEWMBQGA1UECxMNU3lzdGVtIE9mZmljZTERMA8GA1UEAxMIVU1T\n"
+				+ "IENBLTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALGf8Ny+kHlXqLTi3uIf\n"
+				+ "mkxxwDJd14sOg+hv85pxsqzCRJEgOx5YDUt05hJ7N0s4rJ/gNUcJaKR6ul+qLGbW\n"
+				+ "+Zb4S1YFbnKaO16zggvgckwpLGYRBbmee9+E47W8VEOZWrJXUkpJ/ZV8GAnesrvn\n"
+				+ "XTEKfm7bX9s6R7FQfDoHNnQfAgMBAAGjgawwgakwEQYJYIZIAYb4QgEBBAQDAgD2\n"
+				+ "MB8GA1UdIwQYMBaAFOqlID9Er6dI09n9Lvnby+FISi7oMFQGCWCGSAGG+EIBDQRH\n"
+				+ "FkVFeHRlbmRlZCBDQSBDZXJ0aWZpY2F0ZSBmcm9tIDI0IE1vbnRocyB0byAxMjAg\n"
+				+ "TW9udGhzLiAgRFRHID0gMDUxMTE5OTgwHQYDVR0OBBYEFOqlID9Er6dI09n9Lvnb\n"
+				+ "y+FISi7oMA0GCSqGSIb3DQEBBAUAA4GBAFNFo27JeeIgsMqS7Na//6gJQRilxwVS\n"
+				+ "Bfx6J43YX47EgNDLn4J7B9Tst+2bDZDAk1lZyu4y2WCLrnfg/e6B1KYBhCt/Srsc\n"
+				+ "r+WomFcw19k1jBtBaYxVwh/9N4ppZGdKILACciXbxfoLbbNgSDx5+KbE2c2m9is7\n"
+				+ "MIZgRexTvnJa\n" + "-----END CERTIFICATE-----\n";
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CRLEntryTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CRLEntryTest.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CRLEntryTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CRLEntryTest.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,73 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.api.java.security.cert;
+
+import java.io.InputStream;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Iterator;
+import java.util.Vector;
+
+import tests.support.resource.Support_Resources;
+
+public class X509CRLEntryTest extends junit.framework.TestCase {
+
+	private X509Certificate pemCert = null;
+
+	protected void setUp() {
+		try {
+			InputStream is = Support_Resources
+					.getStream("hyts_certificate_PEM.txt");
+			if (is != null) {
+				CertificateFactory certFact = CertificateFactory
+						.getInstance("X509");
+				pemCert = (X509Certificate) certFact.generateCertificate(is);
+			} else {
+				fail("Problem occurred opening hyts_certificate_PEM.txt");
+			}
+		} catch (CertificateException e) {
+			fail("Unexpected CertificateException : " + e);
+		}
+	}
+
+	protected void tearDown() {
+	}
+
+	/**
+	 * @tests java.security.cert.X509CRLEntry#getExtensionValue(java.lang.String)
+	 */
+	public void test_getExtensionValueLjava_lang_String() {
+		if (pemCert != null) {
+			Vector extensionOids = new Vector();
+			extensionOids.addAll(pemCert.getCriticalExtensionOIDs());
+			extensionOids.addAll(pemCert.getNonCriticalExtensionOIDs());
+			Iterator i = extensionOids.iterator();
+			while (i.hasNext()) {
+				String oid = (String) i.next();
+				byte[] value = pemCert.getExtensionValue(oid);
+				if (value != null && value.length > 0) {
+					// check that it is an encoded as a OCTET STRING
+					assertTrue("The extension value for the oid " + oid
+							+ " was not encoded as an OCTET STRING",
+							value[0] == 0x04);
+				}
+			}// end while
+		} else {
+			fail("Unable to obtain X509Certificate");
+		}
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CRLTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CRLTest.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CRLTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CRLTest.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,73 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.api.java.security.cert;
+
+import java.io.InputStream;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Iterator;
+import java.util.Vector;
+
+import tests.support.resource.Support_Resources;
+
+public class X509CRLTest extends junit.framework.TestCase {
+
+	private X509Certificate pemCert = null;
+
+	protected void setUp() {
+		try {
+			InputStream is = Support_Resources
+					.getStream("hyts_certificate_PEM.txt");
+			if (is != null) {
+				CertificateFactory certFact = CertificateFactory
+						.getInstance("X509");
+				pemCert = (X509Certificate) certFact.generateCertificate(is);
+			} else {
+				fail("Problem occurred opening hyts_certificate_PEM.txt");
+			}
+		} catch (CertificateException e) {
+			fail("Unexpected CertificateException : " + e);
+		}
+	}
+
+	protected void tearDown() {
+	}
+
+	/**
+	 * @tests java.security.cert.X509CRL#getExtensionValue(java.lang.String)
+	 */
+	public void test_getExtensionValueLjava_lang_String() {
+		if (pemCert != null) {
+			Vector extensionOids = new Vector();
+			extensionOids.addAll(pemCert.getCriticalExtensionOIDs());
+			extensionOids.addAll(pemCert.getNonCriticalExtensionOIDs());
+			Iterator i = extensionOids.iterator();
+			while (i.hasNext()) {
+				String oid = (String) i.next();
+				byte[] value = pemCert.getExtensionValue(oid);
+				if (value != null && value.length > 0) {
+					// check that it is an encoded as a OCTET STRING
+					assertTrue("The extension value for the oid " + oid
+							+ " was not encoded as an OCTET STRING",
+							value[0] == 0x04);
+				}
+			}// end while
+		} else {
+			fail("Unable to obtain X509Certificate");
+		}
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CertificateTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CertificateTest.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CertificateTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/cert/X509CertificateTest.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,72 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.api.java.security.cert;
+
+import java.io.InputStream;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Iterator;
+import java.util.Vector;
+
+import tests.support.resource.Support_Resources;
+
+public class X509CertificateTest extends junit.framework.TestCase {
+	private X509Certificate pemCert = null;
+
+	protected void setUp() {
+		try {
+			InputStream is = Support_Resources
+					.getStream("hyts_certificate_PEM.txt");
+			if (is != null) {
+				CertificateFactory certFact = CertificateFactory
+						.getInstance("X509");
+				pemCert = (X509Certificate) certFact.generateCertificate(is);
+			} else {
+				fail("Problem occurred opening hyts_certificate_PEM.txt");
+			}
+		} catch (CertificateException e) {
+			fail("Unexpected CertificateException : " + e);
+		}
+	}
+
+	protected void tearDown() {
+	}
+
+	/**
+	 * @tests java.security.cert.X509Certificate#getExtensionValue(java.lang.String)
+	 */
+	public void test_getExtensionValueLjava_lang_String() {
+		if (pemCert != null) {
+			Vector extensionOids = new Vector();
+			extensionOids.addAll(pemCert.getCriticalExtensionOIDs());
+			extensionOids.addAll(pemCert.getNonCriticalExtensionOIDs());
+			Iterator i = extensionOids.iterator();
+			while (i.hasNext()) {
+				String oid = (String) i.next();
+				byte[] value = pemCert.getExtensionValue(oid);
+				if (value != null && value.length > 0) {
+					// check that it is an encoded as a OCTET STRING
+					assertTrue("The extension value for the oid " + oid
+							+ " was not encoded as an OCTET STRING",
+							value[0] == 0x04);
+				}
+			}
+		} else {
+			fail("Unable to obtain X509Certificate");
+		}
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/spec/EncodedKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/spec/EncodedKeySpecTest.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/spec/EncodedKeySpecTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/tests/api/java/security/spec/EncodedKeySpecTest.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,180 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.api.java.security.spec;
+
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.interfaces.DSAPrivateKey;
+import java.security.interfaces.DSAPublicKey;
+import java.security.interfaces.RSAPrivateCrtKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import junit.framework.TestCase;
+
+public class EncodedKeySpecTest extends TestCase {
+
+	private static final String KEYFACTORY_ID = "KeyFactory.";
+
+	/**
+	 * @tests java.security.spec.EncodedKeySpec#getEncoded()
+	 */
+	public void test_getEncoded() {
+		
+		fail("Takes ages. Problem with SecureRandom and stub math ?");
+		
+		Provider[] providers = Security.getProviders();
+		if (providers == null) {
+			fail("No providers found");
+		}
+
+		boolean atLeastOneProviderFound = false;
+		
+		// Loop through each of the providers that support KeyFactory algorithms
+		for (int j = 0; j < providers.length; j++) {
+			String providerName = providers[j].getName();
+			String[] keyfactAlgs = getKeyFactoryAlgorithms(providerName);
+			
+			// Loop through each of the KeyFactory algorithms supported by 
+			// the current provider
+			for (int i = 0; i < keyfactAlgs.length; i++) {
+				// If we reach here then at least one of the installed providers
+				// must support one of the KeyFactory algorithms
+				atLeastOneProviderFound = true;
+				try {
+					KeyFactory fact = KeyFactory.getInstance(keyfactAlgs[i],
+							providerName);
+					KeyPairGenerator keyGen = KeyPairGenerator
+							.getInstance(keyfactAlgs[i]);
+					// We don't use getInstance
+					SecureRandom random = new SecureRandom();
+					keyGen.initialize(1024, random);
+					KeyPair keys = keyGen.generateKeyPair();
+
+					// check public key encoding
+					byte[] encoded = keys.getPublic().getEncoded();
+					Key key = fact.generatePublic(new X509EncodedKeySpec(
+							encoded));
+					assertTrue(
+							"public key encodings were different for algorithm "
+									+ keyfactAlgs[i], isEqual(key, keys
+									.getPublic()));
+
+					// check private key encoding
+					encoded = keys.getPrivate().getEncoded();
+					key = fact
+							.generatePrivate(new PKCS8EncodedKeySpec(encoded));
+					assertTrue(
+							"private key encodings were different for algorithm "
+									+ keyfactAlgs[i], isEqual(key, keys
+									.getPrivate()));
+				} catch (NoSuchAlgorithmException e) {
+					fail("getInstance did not find expected algorithm "
+							+ keyfactAlgs[i]);
+				} catch (NoSuchProviderException e) {
+					fail("getInstance did not find provider " + providerName);
+				} catch (InvalidKeySpecException e) {
+					fail("invalid key spec for algorithm " + keyfactAlgs[i]);
+				}
+			}// end for
+		}// end for each provider supporting KeyFactory algorithms
+		
+		if (!atLeastOneProviderFound) {
+			fail("No providers supported KeyFactory algorithms");
+		}
+	}
+
+	/*
+	 * Returns the key algorithms that the given provider supports.
+	 */
+	private String[] getKeyFactoryAlgorithms(String providerName) {
+		Vector algs = new Vector();
+
+		Provider provider = Security.getProvider(providerName);
+		if (provider == null)
+			return new String[0];
+		Enumeration e = provider.keys();
+		while (e.hasMoreElements()) {
+			String algorithm = (String) e.nextElement();
+			if (algorithm.startsWith(KEYFACTORY_ID)) {
+				algs.addElement(algorithm.substring(KEYFACTORY_ID.length()));
+			}
+		}
+		return (String[]) algs.toArray(new String[algs.size()]);
+	}
+
+	protected void setUp() {
+	}
+	
+	protected void tearDown() {
+	}
+
+	private boolean isEqual(Key key1, Key key2) {
+		if (key1 instanceof RSAPublicKey && key2 instanceof RSAPublicKey) {
+			RSAPublicKey rsa1 = ((RSAPublicKey) key1);
+			RSAPublicKey rsa2 = ((RSAPublicKey) key2);
+			return rsa1.getModulus().equals(rsa2.getModulus())
+					&& rsa1.getPublicExponent()
+							.equals(rsa2.getPublicExponent());
+		} else if (key1 instanceof RSAPrivateCrtKey
+				&& key2 instanceof RSAPrivateCrtKey) {
+			RSAPrivateCrtKey rsa1 = ((RSAPrivateCrtKey) key1);
+			RSAPrivateCrtKey rsa2 = ((RSAPrivateCrtKey) key2);
+			return rsa1.getModulus().equals(rsa2.getModulus())
+					&& rsa1.getPublicExponent()
+							.equals(rsa2.getPublicExponent())
+					&& rsa1.getPrivateExponent().equals(
+							rsa2.getPrivateExponent())
+					&& rsa1.getPrimeP().equals(rsa2.getPrimeP())
+					&& rsa1.getPrimeQ().equals(rsa2.getPrimeQ())
+					&& rsa1.getPrimeExponentP()
+							.equals(rsa2.getPrimeExponentP())
+					&& rsa1.getPrimeExponentQ()
+							.equals(rsa2.getPrimeExponentQ())
+					&& rsa1.getCrtCoefficient()
+							.equals(rsa2.getCrtCoefficient());
+		} else if (key1 instanceof DSAPublicKey && key2 instanceof DSAPublicKey) {
+			DSAPublicKey dsa1 = ((DSAPublicKey) key1);
+			DSAPublicKey dsa2 = ((DSAPublicKey) key2);
+			return dsa1.getY().equals(dsa2.getY())
+					&& dsa1.getParams().getG().equals(dsa2.getParams().getG())
+					&& dsa1.getParams().getP().equals(dsa2.getParams().getP())
+					&& dsa1.getParams().getQ().equals(dsa2.getParams().getQ());
+
+		} else if (key1 instanceof DSAPrivateKey
+				&& key2 instanceof DSAPrivateKey) {
+			DSAPrivateKey dsa1 = ((DSAPrivateKey) key1);
+			DSAPrivateKey dsa2 = ((DSAPrivateKey) key2);
+			return dsa1.getX().equals(dsa2.getX())
+					&& dsa1.getParams().getG().equals(dsa2.getParams().getG())
+					&& dsa1.getParams().getP().equals(dsa2.getParams().getP())
+					&& dsa1.getParams().getQ().equals(dsa2.getParams().getQ());
+		} else {
+			return false;
+		}
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/keystore.bks
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/keystore.bks?rev=392891&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/keystore.bks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/mypermissionBKS.jar
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/mypermissionBKS.jar?rev=392891&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/mypermissionBKS.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/signedBKS.jar
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/signedBKS.jar?rev=392891&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/PermissionCollection/signedBKS.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_badpem.cer
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_badpem.cer?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_badpem.cer (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_badpem.cer Sun Apr  9 22:38:31 2006
@@ -0,0 +1,31 @@
+-----BEGIN CERTIFICATE-----
+MIIFATCCA+mg^wIBAgIBADANBgkqhkiG9w0BAQQFADB/MQswCQYDVQQGEwJkZTEg
+MB4GA1UEChMXSW5zZWN1cmVUZXN0Q2VydGlmaWNhdGUxJzAlBgNVBAMTHkZvciBU
+ZXN0cyBPbmx5IG5leHQgZ2VuZXJhdGlvbjElMCMGCSqGSIb3DQEJARYWaW5zZWN1
+cmVAdGVzdC5pbnNlY3VyZTAeFw0wMjA2MjcxMjE2M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VyZTARBglghkgBhvhCAQEEBAMCAAcwPAYJYIZIAYb4QgEN
+BC8WLVRoaXMgY2VydGlmaWNhdGUgd2FzIGlzc3VlZCBmb3IgdGVzdGluZyBvbmx5
+ITANBgkqhkiG9w0BAQQFAAOCAQEAKG4CjdQ60pskcVVS9batPkOr3HR+20jgxtaW
+Cul+QmepJCZTj2XjmspLlw00ZVcjxTuxsBVKQoSPA0V7xrNU6GVYQtfnYWoQ1Lw+
+c2+J6XZ5iV58uyz4IJVgdq+kyXjopMiJV/cHqDX5fPeLT35L3UNZy8TdhHW+tj7X
+sZelbK6kig9mzOBV2g0Pa86DwctHxL/eRDqX0+Mkvy9YAsBVhHDhVRWBpVMmQFMd
+NbEiGRB0FEKTM+ztlb0QyBrhrjHI9a+P2Q5iap7HuiUrD7BRQ8YWEOUWI8jEdRaI
+kC/K0U+WTB6e32XidjR7GCqFULLCE45of5JWJ/eV9gL5znhbEg==
+-----END CERTIFICATE-----
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_certificate_PEM.txt
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_certificate_PEM.txt?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_certificate_PEM.txt (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_certificate_PEM.txt Sun Apr  9 22:38:31 2006
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICpjCCAmSgAwIBAgIBKjALBgcqhkjOOAQDBQAwFDESMBAGA1UEAxMJbW9zdEJvZ3Vz
+MB4XDTAyMDkxMjA1MTQxNFoXDTEyMDkwOTA1MTQxNFowFDESMBAGA1UEAxMJbW9zdEJv
+Z3VzMIIBtjCCASsGByqGSM44BAEwggEeAoGBAJ1FcaWl9WQueeB6znF2UwCLpUUWd4Bx
+sUQMa3gKlac9Aa8CzWZQfv/GHzVByCoqZDgsNlYtdvYtDHyyh6aXwSL3ffFPawdOzSBz
+NsbyLP7DBECvhXp1sYy9LbotnI6J2hIGZxg6D0LY87AZTGWtlxZwiZ4fjYpWeWcNLhC9
+LyZ1AhUAyimlZ8Iyr4ePL8bxaDbrCixlDb8CgYA0xqckl79n0IaYtcbN7SqNA/kUkjVG
+9LjLpUMOTBiOPMWjKbgiZ1jnmINgFy9ZZEvq/F1hjqdE2hAI2arBczmZXD9L2p5LX7sJ
+f+Dqf5jpzwhLFMdFJoANylHCGsUW13rEP+Rr5RYsl4N6WreaKipZIofpZEk8Alqj3qxc
+OWPXmgOBhAACgYAeDfo0hMcW4uUpBRfbhq4CAxDQQeanE6K1bdF9+CqQhkFRPj0Mdso5
+T06WxfqdoMCruHR6BaRprX5TDuxv/EGkK3FgxTxjBOTuCD4+8+pYiycrWjrDFS4rpx5P
+c5wKq2E4AnJ15j7QI6vE0GMDrP5GbDe6+UrGYkvaIfJ9afefvKNHMEUwEgYDVR0TAQH/
+BAgwBgEB/wIBAjAPBgNVHQ8BAf8EBQMDB/4AMB4GA1UdDgQXBBVhbiBvY3RldC1zdHJp
+bmcgdmFsdWUwCwYHKoZIzjgEAwUAAy8AMCwCFDvuHX267Kg6zbIUOeIFsWDFWQnzAhRM
+Nlv0ZVWhYxlyK4iVS2WCw2SV6A==
+-----END CERTIFICATE-----

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_ks.bks
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_ks.bks?rev=392891&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/hyts_ks.bks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,211 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.Key;
+import java.security.KeyStoreException;
+import java.security.KeyStoreSpi;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.util.Date;
+import java.util.Enumeration;
+
+/**
+ * Empty implementation used to enable unit tests to run.
+ */
+public class Support_DummyPKCS12Keystore extends KeyStoreSpi {
+
+	/**
+	 * 
+	 */
+	public Support_DummyPKCS12Keystore() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetKey(java.lang.String, char[])
+	 */
+	public Key engineGetKey(String arg0, char[] arg1)
+			throws NoSuchAlgorithmException, UnrecoverableKeyException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetCertificateChain(java.lang.String)
+	 */
+	public Certificate[] engineGetCertificateChain(String arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetCertificate(java.lang.String)
+	 */
+	public Certificate engineGetCertificate(String arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetCreationDate(java.lang.String)
+	 */
+	public Date engineGetCreationDate(String arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineSetKeyEntry(java.lang.String,
+	 *      java.security.Key, char[], java.security.cert.Certificate[])
+	 */
+	public void engineSetKeyEntry(String arg0, Key arg1, char[] arg2,
+			Certificate[] arg3) throws KeyStoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineSetKeyEntry(java.lang.String,
+	 *      byte[], java.security.cert.Certificate[])
+	 */
+	public void engineSetKeyEntry(String arg0, byte[] arg1, Certificate[] arg2)
+			throws KeyStoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineSetCertificateEntry(java.lang.String,
+	 *      java.security.cert.Certificate)
+	 */
+	public void engineSetCertificateEntry(String arg0, Certificate arg1)
+			throws KeyStoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineDeleteEntry(java.lang.String)
+	 */
+	public void engineDeleteEntry(String arg0) throws KeyStoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineAliases()
+	 */
+	public Enumeration engineAliases() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineContainsAlias(java.lang.String)
+	 */
+	public boolean engineContainsAlias(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineSize()
+	 */
+	public int engineSize() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineIsKeyEntry(java.lang.String)
+	 */
+	public boolean engineIsKeyEntry(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineIsCertificateEntry(java.lang.String)
+	 */
+	public boolean engineIsCertificateEntry(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetCertificateAlias(java.security.cert.Certificate)
+	 */
+	public String engineGetCertificateAlias(Certificate arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineStore(java.io.OutputStream, char[])
+	 */
+	public void engineStore(OutputStream arg0, char[] arg1) throws IOException,
+			NoSuchAlgorithmException, CertificateException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineLoad(java.io.InputStream, char[])
+	 */
+	public void engineLoad(InputStream arg0, char[] arg1) throws IOException,
+			NoSuchAlgorithmException, CertificateException {
+		// TODO Auto-generated method stub
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,96 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Hashtable;
+
+import tests.support.resource.Support_Resources;
+
+public class Support_GetLocal {
+
+	static Hashtable cache = new Hashtable(20);
+
+	public static File getLocalFile(String url) throws IOException,
+			MalformedURLException {
+		url = Support_Resources.RESOURCE_PACKAGE + url;
+		File temp = (File) cache.get(url);
+		if (temp == null) {
+			InputStream in = Support_GetLocal.class.getResourceAsStream(url);
+			temp = File.createTempFile("hyts_local", ".tmp", null);
+			temp.deleteOnExit();
+			FileOutputStream out = new FileOutputStream(temp);
+			int result;
+			byte[] buf = new byte[4096];
+			while ((result = in.read(buf)) != -1)
+				out.write(buf, 0, result);
+			in.close();
+			out.close();
+			cache.put(url, temp);
+		}
+		return temp;
+	}
+
+	public static File getExternalLocalFile(String url) throws IOException,
+			MalformedURLException {
+		File temp = (File) cache.get(url);
+		if (temp == null) {
+			InputStream in = new URL(url).openStream();
+			temp = File.createTempFile("hyts_local", ".tmp", null);
+			temp.deleteOnExit();
+			FileOutputStream out = new FileOutputStream(temp);
+			int result;
+			byte[] buf = new byte[4096];
+			while ((result = in.read(buf)) != -1)
+				out.write(buf, 0, result);
+			in.close();
+			out.close();
+			cache.put(url, temp);
+		}
+		return temp;
+	}
+
+	static ByteArrayInputStream getStream(String url) throws IOException,
+			MalformedURLException {
+		InputStream in = new URL(url).openStream();
+		ByteArrayOutputStream out = new ByteArrayOutputStream(256);
+		int result;
+		byte[] buf = new byte[256];
+		while ((result = in.read(buf)) != -1)
+			out.write(buf, 0, result);
+		return new ByteArrayInputStream(out.toByteArray());
+	}
+
+	public static File createTempFile(String suffix) throws IOException {
+		return File.createTempFile("hyts_", suffix, null);
+	}
+
+	public static JarURLConnection getJarURLConnection() throws IOException {
+		JarURLConnection con1 = null;
+		File file = getLocalFile("hyts_att.jar");
+		URL fUrl1 = new URL("jar:file:" + file.getPath() + "!/");
+		con1 = (JarURLConnection) fUrl1.openConnection();
+		return con1;
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetResource.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetResource.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetResource.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetResource.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,23 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_GetResource {
+
+	public static String getResourceURL(String resource) {
+		return "http://" + Support_Configuration.TestResources + resource;
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PermissionCollection.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PermissionCollection.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PermissionCollection.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PermissionCollection.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,53 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.BasicPermission;
+import java.security.PermissionCollection;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+
+public class Support_PermissionCollection {
+
+	public static void main(String[] args) throws Exception {
+		System.setSecurityManager(new SecurityManager());
+		java.net.URL[] urls = new java.net.URL[1];
+		Class c = null;
+		java.net.URLClassLoader ucl = null;
+		try {
+			URL url = new URL(args[0]);
+			urls[0] = url;
+			ucl = URLClassLoader.newInstance(urls, null);
+			c = Class.forName("coucou.FileAccess", true, ucl);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		ProtectionDomain pd = c.getProtectionDomain();
+		PermissionCollection coll = Policy.getPolicy().getPermissions(pd);
+		Class myPermission = Class.forName("mypackage.MyPermission");
+		BasicPermission myperm = (BasicPermission) myPermission.newInstance();
+		System.out.println(coll.implies(new java.io.FilePermission("test1.txt",
+				"write"))
+				+ ","
+				+ coll.implies(myperm)
+				+ ","
+				+ coll
+						.implies(new java.io.FilePermission("test2.txt",
+								"write")) + ",");
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderJCE.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderJCE.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderJCE.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderJCE.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,86 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+
+/**
+ * This class implements a dummy security provider
+ */
+public class Support_ProviderJCE extends Provider {
+	// Provider name
+	private static final String NAME = "ProviderJCE";
+
+	// Version of the services
+	private static final double VERSION = 1.0;
+
+	private static final String INFO = NAME
+			+ " DSA key, parameter generation and signing; SHA-1 digest";
+
+	/**
+	 * Constructs a new instance of the dummy provider.
+	 */
+	public Support_ProviderJCE() {
+		super(NAME, VERSION, INFO);
+		registerServices();
+	}
+
+	/**
+	 * Register the services the receiver provides.
+	 */
+	private void registerServices() {
+		AccessController.doPrivileged(new PrivilegedAction() {
+			public Object run() {
+				// Digest engine
+				put("MessageDigest.SHA",
+						"made.up.provider.name.MessageDigestSHA");
+				put("MessageDigest.MD5",
+						"made.up.provider.name.MessageDigestMD5");
+
+				// Algorithm parameter generator
+				put("AlgorithmParameterGenerator.DSA",
+						"made.up.provider.name.AlgorithmParameterGeneratorDSA");
+
+				// Algorithm parameters
+				put("AlgorithmParameters.DSA",
+						"made.up.provider.name.AlgorithmParametersDSA");
+
+				// Key pair generator
+				put("KeyPairGenerator.DSA",
+						"made.up.provider.name.KeyPairGeneratorDSA");
+
+				// Key factory
+				put("KeyFactory.DSA", "made.up.provider.name.KeyFactoryDSA");
+				put("KeyFactory.RSA", "made.up.provider.name.KeyFactoryRSA");
+
+				// Signature algorithm
+				put("Signature.SHA1withDSA",
+						"made.up.provider.name.SignatureDSA");
+
+				// KeyStore
+				put("KeyStore.PKCS#12/Netscape",
+						"made.up.provider.name.KeyStore");
+
+				// Certificate
+				put("CertificateFactory.X509",
+						"made.up.provider.name.CertificateFactoryX509");
+				return null;
+			}
+		});
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderRSA.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderRSA.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderRSA.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderRSA.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,92 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+
+/**
+ * This class implements a dummy provider.
+ */
+public class Support_ProviderRSA extends Provider {
+	// Provider name 
+	private static final String NAME = "ProviderRSA";
+
+	// Version of the services provided
+	private static final double VERSION = 1.0;
+
+	private static final String INFO = NAME
+			+ " DSA key, parameter generation and signing; SHA-1 digest"; 
+
+	/**
+	 * Constructs a new instance of the dummy provider.
+	 */
+	public Support_ProviderRSA() {
+		super(NAME, VERSION, INFO);
+		registerServices();
+	}
+
+	/**
+	 * Register the services the receiver provides.
+	 */
+	private void registerServices() {
+		AccessController.doPrivileged(new PrivilegedAction() {
+			public Object run() {
+				// Digest engine
+				put("MessageDigest.SHA",
+						"made.up.provider.name.MessageDigestSHA");
+				put("MessageDigest.MD5",
+						"made.up.provider.name.MessageDigestMD5");
+
+				// Secure Random
+				put("SecureRandom.SHA1PRNG",
+						"made.up.provider.name.SecureRandomImpl");
+
+				// Algorithm parameter generator
+				put("AlgorithmParameterGenerator.DSA",
+						"made.up.provider.name.AlgorithmParameterGeneratorDSA");
+
+				// Algorithm parameters
+				put("AlgorithmParameters.DSA",
+						"made.up.provider.name.AlgorithmParametersDSA");
+
+				// Key pair generator
+				put("KeyPairGenerator.DSA",
+						"made.up.provider.name.KeyPairGeneratorDSA");
+
+				// Key factory
+				put("KeyFactory.DSA",
+						"made.up.provider.name.KeyFactoryDSA");
+				put("KeyFactory.RSA",
+						"made.up.provider.name.KeyFactoryRSA");
+
+				// Signature algorithm
+				put("Signature.SHA1withDSA",
+						"made.up.provider.name.SignatureDSA");
+
+				// KeyStore
+				put("KeyStore.PKCS#12/Netscape",
+						"made.up.provider.name.KeyStore");
+
+				// Certificate
+				put("CertificateFactory.X509",
+						"made.up.provider.name.CertificateFactoryX509");
+				return null;
+			}
+		});
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderTrust.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderTrust.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderTrust.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProviderTrust.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,89 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+
+/**
+ * This class implements a dummy provider.
+ * 
+ */
+public class Support_ProviderTrust extends Provider {
+	// Provider name
+	private static final String NAME = "ProviderTrust";
+
+	// Version of the services
+	private static final double VERSION = 1.0;
+
+	private static final String INFO = NAME
+			+ " DSA key, parameter generation and signing; SHA-1 digest; SHA1PRNG SecureRandom";
+
+	/**
+	 * Constructs a new instance of the dummy provider.
+	 * 
+	 */
+	public Support_ProviderTrust() {
+		super(NAME, VERSION, INFO);
+		registerServices();
+	}
+
+	/**
+	 * Register the services the receiver provides.
+	 */
+	private void registerServices() {
+		AccessController.doPrivileged(new PrivilegedAction() {
+			public Object run() {
+				// Digest engine
+				put("MessageDigest.SHA",
+						"made.up.provider.name.MessageDigestSHA");
+				put("MessageDigest.MD5",
+						"made.up.provider.name.MessageDigestMD5");
+
+				// Algorithm parameter generator
+				put("AlgorithmParameterGenerator.DSA",
+						"made.up.provider.name.AlgorithmParameterGeneratorDSA");
+
+				// Algorithm parameters
+				put("AlgorithmParameters.DSA",
+						"made.up.provider.name.AlgorithmParametersDSA");
+
+				// Key pair generator
+				put("KeyPairGenerator.DSA",
+						"made.up.provider.name.KeyPairGeneratorDSA");
+
+				// Key factory
+				put("KeyFactory.DSA", "made.up.provider.name.KeyFactoryDSA");
+				put("KeyFactory.RSA", "made.up.provider.name.KeyFactoryRSA");
+
+				// Signature algorithm
+				put("Signature.SHA1withDSA",
+						"made.up.provider.name.SignatureDSA");
+
+				// KeyStore
+				put("KeyStore.PKCS#12/Netscape",
+						"made.up.provider.name.KeyStore");
+
+				// Certificate
+				put("CertificateFactory.X509",
+						"made.up.provider.name.CertificateFactoryX509");
+
+				return null;
+			}
+		});
+	}
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java?rev=392891&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java Sun Apr  9 22:38:31 2006
@@ -0,0 +1,121 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+
+/**
+ * This class implements a dummy provider.
+ */
+public class Support_TestProvider extends Provider {
+	// Provider name
+	private static final String NAME = "TestProvider";
+
+	// Version of the services provided
+	private static final double VERSION = 1.0;
+
+	private static final String INFO = NAME
+			+ " DSA key, parameter generation and signing; SHA-1 digest; "
+			+ "SHA1PRNG SecureRandom; PKCS#12/Netscape KeyStore";
+
+	/**
+	 * Constructs a new instance of the dummy provider.
+	 */
+	public Support_TestProvider() {
+		super(NAME, VERSION, INFO);
+		registerServices();
+	}
+
+	/**
+	 * Register the services the receiver provides.
+	 */
+	private void registerServices() {
+		AccessController.doPrivileged(new PrivilegedAction() {
+			public Object run() {
+				// Digest engine
+				put("MessageDigest.SHA",
+						"made.up.provider.name.MessageDigestSHA");
+				put("MessageDigest.MD2",
+						"made.up.provider.name.MessageDigestMD2");
+				// aliases
+				put("Alg.Alias.MessageDigest.SHA1", "SHA");
+				put("Alg.Alias.MessageDigest.SHA-1", "SHA");
+				put("Alg.Alias.MessageDigest.OID.1.3.14.3.2.26", "SHA");
+				put("Alg.Alias.MessageDigest.1.3.14.3.2.26", "SHA");
+
+				// Algorithm parameter generator
+				put("AlgorithmParameterGenerator.DSA",
+						"made.up.provider.name.AlgorithmParameterGeneratorDSA");
+
+				// Algorithm parameters
+				put("AlgorithmParameters.DSA",
+						"made.up.provider.name.AlgorithmParametersDSA");
+				// aliases
+				put("Alg.Alias.AlgorithmParameters.1.2.840.10040.4.1", "DSA");
+				put("Alg.Alias.AlgorithmParameters.1.3.14.3.2.12", "DSA");
+
+				// Key pair generator
+				put("KeyPairGenerator.DSA",
+						"made.up.provider.name.KeyPairGeneratorDSA");
+				// aliases
+				put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA");
+				put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
+				put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
+
+				// Key factory
+				put("KeyFactory.DSA", "made.up.provider.name.KeyFactoryDSA");
+				put("KeyFactory.RSA", "made.up.provider.name.KeyFactoryRSA");
+				// aliases
+				put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
+				put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
+
+				// Signature algorithm
+				put("Signature.SHA1withDSA",
+						"made.up.provider.name.SignatureDSA");
+
+				// aliases
+				put("Alg.Alias.Signature.DSA", "SHA1withDSA");
+				put("Alg.Alias.Signature.DSS", "SHA1withDSA");
+				put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA");
+				put("Alg.Alias.Signature.SHA1/DSA", "SHA1withDSA");
+				put("Alg.Alias.Signature.SHA-1/DSA", "SHA1withDSA");
+				put("Alg.Alias.Signature.SHAwithDSA", "SHA1withDSA");
+				put("Alg.Alias.Signature.DSAwithSHA1", "SHA1withDSA");
+				put("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA");
+				put("Alg.Alias.Signature.SHA-1withDSA", "SHA1withDSA");
+				put("Alg.Alias.Signature.OID.1.2.840.10040.4.3", "SHA1withDSA");
+				put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA");
+				put("Alg.Alias.Signature.1.3.14.3.2.13", "SHA1withDSA");
+				put("Alg.Alias.Signature.1.3.14.3.2.27", "SHA1withDSA");
+				put("Alg.Alias.Signature.OID.1.3.14.3.2.13", "SHA1withDSA");
+				put("Alg.Alias.Signature.OID.1.3.14.3.2.27", "SHA1withDSA");
+
+				put("KeyStore.PKCS#12/Netscape",
+						"tests.support.Support_DummyPKCS12Keystore");
+
+				// Certificate
+				put("CertificateFactory.X509",
+						"made.up.provider.name.CertificateFactoryX509");
+				// aliases
+				put("Alg.Alias.CertificateFactory.X.509", "X509");
+
+				return null;
+			}
+		});
+	}
+}
\ No newline at end of file



Mime
View raw message