diff options
Diffstat (limited to 'bundles/org.eclipse.osgi.tests')
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java | 52 | ||||
-rwxr-xr-x | bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA1withRSA.jar | bin | 0 -> 4300 bytes | |||
-rwxr-xr-x | bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA256withRSA.jar | bin | 0 -> 4308 bytes | |||
-rwxr-xr-x | bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA384withRSA.jar | bin | 0 -> 4312 bytes | |||
-rwxr-xr-x | bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA512withRSA.jar | bin | 0 -> 4309 bytes | |||
-rwxr-xr-x | bundles/org.eclipse.osgi.tests/test_files/security/bundles/test.bug378155.jar | bin | 0 -> 2917 bytes |
6 files changed, 51 insertions, 1 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java index 95c64a2f5..2b84502a2 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 IBM Corporation and others. + * Copyright (c) 2007, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -859,4 +859,54 @@ public class SignedBundleTest extends BaseSecurityTest { } } } + + public void testBug378155() { + doTestBug378155("SHA1withRSA"); + doTestBug378155("SHA256withRSA"); + doTestBug378155("SHA384withRSA"); + doTestBug378155("SHA512withRSA"); + } + + private void doTestBug378155(String bundleName) { + + Bundle testBundle = null; + try { + testBundle = installBundle(getTestJarPath(bundleName)); + assertNotNull("Test bundle not installed!", testBundle); + // get the signed content for the bundle + SignedContent signedContent = getSignedContentFactory().getSignedContent(testBundle); + assertNotNull("SignedContent is null", signedContent); + // check if it is signed + assertTrue("Should be signed", signedContent.isSigned()); + // get the signer infos + SignerInfo[] infos = signedContent.getSignerInfos(); + assertNotNull("SignerInfo is null", infos); + assertEquals("wrong number of signers", 1, infos.length); + // check the signer validity + signedContent.checkValidity(infos[0]); + // check the signer trust (it is NOT trusted) + assertFalse("Signer is trusted", infos[0].isTrusted()); + // check the trust anchor + assertNull("Trust anchor is not null", infos[0].getTrustAnchor()); + // verify and validate the entries + SignedContentEntry[] entries = signedContent.getSignedEntries(); + assertNotNull("Entries is null", entries); + for (int i = 0; i < entries.length; i++) { + entries[i].verify(); + SignerInfo[] entryInfos = entries[i].getSignerInfos(); + assertNotNull("SignerInfo is null", entryInfos); + assertEquals("wrong number of entry signers", 1, entryInfos.length); + assertEquals("Entry signer does not equal content signer", infos[0], entryInfos[0]); + } + } catch (Exception e) { + fail("Unexpected exception", e); + } finally { + try { + if (testBundle != null) + testBundle.uninstall(); + } catch (BundleException e) { + fail("Failed to uninstall bundle", e); + } + } + } } diff --git a/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA1withRSA.jar b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA1withRSA.jar Binary files differnew file mode 100755 index 000000000..b82c29ca3 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA1withRSA.jar diff --git a/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA256withRSA.jar b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA256withRSA.jar Binary files differnew file mode 100755 index 000000000..e26678903 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA256withRSA.jar diff --git a/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA384withRSA.jar b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA384withRSA.jar Binary files differnew file mode 100755 index 000000000..d8bf7e4c4 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA384withRSA.jar diff --git a/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA512withRSA.jar b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA512withRSA.jar Binary files differnew file mode 100755 index 000000000..c9eac0d57 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/SHA512withRSA.jar diff --git a/bundles/org.eclipse.osgi.tests/test_files/security/bundles/test.bug378155.jar b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/test.bug378155.jar Binary files differnew file mode 100755 index 000000000..b716290dd --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/test_files/security/bundles/test.bug378155.jar |