Examples of KeyStoreTrustEngine


Examples of org.eclipse.osgi.internal.service.security.KeyStoreTrustEngine

    // always register the trust engine
    Hashtable trustEngineProps = new Hashtable(7);
    trustEngineProps.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE));
    trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, SignedContentConstants.DEFAULT_TRUST_ENGINE);
    KeyStoreTrustEngine systemTrustEngine = new KeyStoreTrustEngine(CACERTS_PATH, CACERTS_TYPE, null, "System"); //$NON-NLS-1$
    systemTrustEngineReg = context.registerService(TrustEngine.class.getName(), systemTrustEngine, trustEngineProps);
    String osgiTrustPath = context.getProperty(OSGI_KEYSTORE);
    if (osgiTrustPath != null) {
      try {
        URL url = new URL(osgiTrustPath);
        if ("file".equals(url.getProtocol())) { //$NON-NLS-1$
          trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, OSGI_KEYSTORE);
          String path = url.getPath();
          osgiTrustEngineReg = new ArrayList(1);
          osgiTrustEngineReg.add(context.registerService(TrustEngine.class.getName(), new KeyStoreTrustEngine(path, CACERTS_TYPE, null, OSGI_KEYSTORE), trustEngineProps));
        }
      } catch (MalformedURLException e) {
        SignedBundleHook.log("Invalid setting for " + OSGI_KEYSTORE, FrameworkLogEntry.WARNING, e); //$NON-NLS-1$
      }
    } else {
      String osgiTrustRepoPaths = context.getProperty(Constants.FRAMEWORK_TRUST_REPOSITORIES);
      if (osgiTrustRepoPaths != null) {
        trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, Constants.FRAMEWORK_TRUST_REPOSITORIES);
        StringTokenizer st = new StringTokenizer(osgiTrustRepoPaths, File.pathSeparator);
        osgiTrustEngineReg = new ArrayList(1);
        while (st.hasMoreTokens()) {
          String trustRepoPath = st.nextToken();
          osgiTrustEngineReg.add(context.registerService(TrustEngine.class.getName(), new KeyStoreTrustEngine(trustRepoPath, CACERTS_TYPE, null, OSGI_KEYSTORE), trustEngineProps));
        }
      }
    }
    if ((supportSignedBundles & VERIFY_TRUST) != 0)
      // initialize the trust engine listener only if trust is being established with a trust engine
View Full Code Here

Examples of org.eclipse.osgi.internal.service.security.KeyStoreTrustEngine

    // always register the trust engine
    Dictionary<String, Object> trustEngineProps = new Hashtable<String, Object>(7);
    trustEngineProps.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE));
    trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, SignedContentConstants.DEFAULT_TRUST_ENGINE);
    KeyStoreTrustEngine systemTrustEngine = new KeyStoreTrustEngine(CACERTS_PATH, CACERTS_TYPE, null, "System"); //$NON-NLS-1$
    systemTrustEngineReg = context.registerService(TrustEngine.class.getName(), systemTrustEngine, trustEngineProps);
    String osgiTrustPath = context.getProperty(OSGI_KEYSTORE);
    if (osgiTrustPath != null) {
      try {
        URL url = new URL(osgiTrustPath);
        if ("file".equals(url.getProtocol())) { //$NON-NLS-1$
          trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, OSGI_KEYSTORE);
          String path = url.getPath();
          osgiTrustEngineReg = new ArrayList<ServiceRegistration<?>>(1);
          osgiTrustEngineReg.add(context.registerService(TrustEngine.class.getName(), new KeyStoreTrustEngine(path, CACERTS_TYPE, null, OSGI_KEYSTORE), trustEngineProps));
        }
      } catch (MalformedURLException e) {
        SignedBundleHook.log("Invalid setting for " + OSGI_KEYSTORE, FrameworkLogEntry.WARNING, e); //$NON-NLS-1$
      }
    } else {
      String osgiTrustRepoPaths = context.getProperty(Constants.FRAMEWORK_TRUST_REPOSITORIES);
      if (osgiTrustRepoPaths != null) {
        trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, Constants.FRAMEWORK_TRUST_REPOSITORIES);
        StringTokenizer st = new StringTokenizer(osgiTrustRepoPaths, File.pathSeparator);
        osgiTrustEngineReg = new ArrayList<ServiceRegistration<?>>(1);
        while (st.hasMoreTokens()) {
          String trustRepoPath = st.nextToken();
          osgiTrustEngineReg.add(context.registerService(TrustEngine.class.getName(), new KeyStoreTrustEngine(trustRepoPath, CACERTS_TYPE, null, OSGI_KEYSTORE), trustEngineProps));
        }
      }
    }
    if ((supportSignedBundles & VERIFY_TRUST) != 0)
      // initialize the trust engine listener only if trust is being established with a trust engine
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.