Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2010-04-30 17:54:18 +0000
committerThomas Watson2010-04-30 17:54:18 +0000
commit62f6775b2075a6bcf2aab46f84da917a5003549c (patch)
treeac7ebc92651e60b9f9c3d7958f11aef6c1578eaf
parenta3cbee8c1fb3832d9b23d9a1162eae3813b62a32 (diff)
downloadrt.equinox.framework-62f6775b2075a6bcf2aab46f84da917a5003549c.tar.gz
rt.equinox.framework-62f6775b2075a6bcf2aab46f84da917a5003549c.tar.xz
rt.equinox.framework-62f6775b2075a6bcf2aab46f84da917a5003549c.zip
Bug 310474 - Security exception for corrupted bundle signature doesn't tell me which bundle
-rw-r--r--bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java17
-rw-r--r--bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.java4
-rw-r--r--bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.properties5
3 files changed, 22 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java
index 993d9b824..5b9045376 100644
--- a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java
+++ b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 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
@@ -33,6 +33,7 @@ import org.eclipse.osgi.service.security.TrustEngine;
import org.eclipse.osgi.signedcontent.SignedContent;
import org.eclipse.osgi.signedcontent.SignedContentFactory;
import org.eclipse.osgi.util.ManifestElement;
+import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
import org.osgi.framework.Constants;
import org.osgi.util.tracker.ServiceTracker;
@@ -242,7 +243,19 @@ public class SignedBundleHook implements AdaptorHook, BundleFileWrapperFactoryHo
else
contentBundleFile = new ZipBundleFile(content, null);
SignedBundleFile result = new SignedBundleFile(null, VERIFY_ALL);
- result.setBundleFile(contentBundleFile);
+ try {
+ result.setBundleFile(contentBundleFile);
+ } catch (InvalidKeyException e) {
+ throw (InvalidKeyException) new InvalidKeyException(NLS.bind(SignedContentMessages.Factory_SignedContent_Error, content)).initCause(e);
+ } catch (SignatureException e) {
+ throw (SignatureException) new SignatureException(NLS.bind(SignedContentMessages.Factory_SignedContent_Error, content)).initCause(e);
+ } catch (CertificateException e) {
+ throw (CertificateException) new CertificateException(NLS.bind(SignedContentMessages.Factory_SignedContent_Error, content)).initCause(e);
+ } catch (NoSuchAlgorithmException e) {
+ throw (NoSuchAlgorithmException) new NoSuchAlgorithmException(NLS.bind(SignedContentMessages.Factory_SignedContent_Error, content)).initCause(e);
+ } catch (NoSuchProviderException e) {
+ throw (NoSuchProviderException) new NoSuchProviderException(NLS.bind(SignedContentMessages.Factory_SignedContent_Error, content)).initCause(e);
+ }
return new SignedContentFile(result.getSignedContent());
}
diff --git a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.java b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.java
index 6fdccd973..28cab184d 100644
--- a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.java
+++ b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 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
@@ -32,6 +32,8 @@ public class SignedContentMessages extends NLS {
// Security Exceptions
public static String Algorithm_Not_Supported;
+ public static String Factory_SignedContent_Error;
+
public static String Default_Trust_Keystore_Load_Failed;
public static String Default_Trust_Read_Only;
public static String Default_Trust_Cert_Not_Found;
diff --git a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.properties b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.properties
index d0d9d984d..47dace892 100644
--- a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.properties
+++ b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2006, 2008 IBM Corporation and others.
+# Copyright (c) 2006, 2010 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
@@ -26,6 +26,9 @@ PKCS7_Parse_Signing_Time = The time stamp in the pkcs7 file cannot be parsed pro
# Security Exceptions
Algorithm_Not_Supported = {0} digest algorithm is not supported!
+# SignedContentFactory exception
+Factory_SignedContent_Error = An error occurred while processing the signatures for the file: {0}
+
# Default Trust Engine
Default_Trust_Keystore_Load_Failed = Failed to load the keystore from: {0}
Default_Trust_Read_Only=This trust engine is read only.

Back to the top