Examples of SignedContent


Examples of org.eclipse.osgi.signedcontent.SignedContent

  public SignedContent getSignedContent(Bundle bundle) throws IOException, InvalidKeyException, SignatureException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, IllegalArgumentException {
    final BundleData data = ((AbstractBundle) bundle).getBundleData();
    if (!(data instanceof BaseData))
      throw new IllegalArgumentException("Invalid bundle object.  No BaseData found."); //$NON-NLS-1$
    SignedStorageHook hook = (SignedStorageHook) ((BaseData) data).getStorageHook(SignedStorageHook.KEY);
    SignedContent result = hook != null ? hook.signedContent : null;
    if (result != null)
      return result; // just reuse the signed content the storage hook
    // must create a new signed content using the raw file
    if (System.getSecurityManager() == null)
      return getSignedContent(((BaseData) data).getBundleFile().getBaseFile());
View Full Code Here

Examples of org.eclipse.osgi.signedcontent.SignedContent

      else
        // no domain specified.  Better use a collection that has all permissions
        // this is done just incase someone sets the security manager later
        permissions = ALLPERMISSIONS;
      Certificate[] certs = null;
      SignedContent signedContent = null;
      if (bundlefile instanceof BundleFileWrapperChain) {
        BundleFileWrapperChain wrapper = (BundleFileWrapperChain) bundlefile;
        while (wrapper != null && (!(wrapper.getWrapped() instanceof SignedContent)))
          wrapper = wrapper.getNext();
        signedContent = wrapper == null ? null : (SignedContent) wrapper.getWrapped();
      }
      if (CLASS_CERTIFICATE && signedContent != null && signedContent.isSigned()) {
        SignerInfo[] signers = signedContent.getSignerInfos();
        if (signers.length > 0)
          certs = signers[0].getCertificateChain();
      }
      return new BundleProtectionDomain(permissions, new CodeSource(bundlefile.getBaseFile().toURL(), certs), null);
    } catch (MalformedURLException e) {
View Full Code Here

Examples of org.eclipse.osgi.signedcontent.SignedContent

        TrustEngineListener listener = TrustEngineListener.getInstance();
        AuthorizationEngine authEngine = listener == null ? null : listener.getAuthorizationEngine();
        if (authEngine != null) {
          BaseData baseData = (BaseData) ((AbstractBundle) bundle).getBundleData();
          SignedStorageHook hook = (SignedStorageHook) baseData.getStorageHook(SignedStorageHook.KEY);
          SignedContent signedContent = hook != null ? hook.signedContent : null;
          authEngine.authorize(signedContent, bundle);
        }
        break;
      default :
        break;
View Full Code Here

Examples of org.eclipse.osgi.signedcontent.SignedContent

  public void processInstalledBundles() {
    Bundle[] bundles = bundleContext.getBundles();
    for (int i = 0; i < bundles.length; i++) {
      BaseData baseData = (BaseData) ((AbstractBundle) bundles[i]).getBundleData();
      SignedStorageHook hook = (SignedStorageHook) baseData.getStorageHook(SignedStorageHook.KEY);
      SignedContent signedContent = hook != null ? hook.getSignedContent() : null;
      authorize(signedContent, bundles[i]);
    }
  }
View Full Code Here

Examples of org.eclipse.osgi.signedcontent.SignedContent

  public SignedContent getSignedContent(Bundle bundle) throws IOException, InvalidKeyException, SignatureException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, IllegalArgumentException {
    final BundleData data = ((AbstractBundle) bundle).getBundleData();
    if (!(data instanceof BaseData))
      throw new IllegalArgumentException("Invalid bundle object.  No BaseData found."); //$NON-NLS-1$
    SignedStorageHook hook = (SignedStorageHook) ((BaseData) data).getStorageHook(SignedStorageHook.KEY);
    SignedContent result = hook != null ? hook.signedContent : null;
    if (result != null)
      return result; // just reuse the signed content the storage hook
    // must create a new signed content using the raw file
    if (System.getSecurityManager() == null)
      return getSignedContent(((BaseData) data).getBundleFile().getBaseFile());
View Full Code Here

Examples of org.eclipse.osgi.signedcontent.SignedContent

      else
        // no domain specified.  Better use a collection that has all permissions
        // this is done just incase someone sets the security manager later
        permissions = ALLPERMISSIONS;
      Certificate[] certs = null;
      SignedContent signedContent = null;
      if (bundlefile instanceof BundleFileWrapperChain) {
        BundleFileWrapperChain wrapper = (BundleFileWrapperChain) bundlefile;
        while (wrapper != null && (!(wrapper.getWrapped() instanceof SignedContent)))
          wrapper = wrapper.getNext();
        signedContent = wrapper == null ? null : (SignedContent) wrapper.getWrapped();
      }
      if (CLASS_CERTIFICATE && signedContent != null && signedContent.isSigned()) {
        SignerInfo[] signers = signedContent.getSignerInfos();
        if (signers.length > 0)
          certs = signers[0].getCertificateChain();
      }
      return new BundleProtectionDomain(permissions, new CodeSource(bundlefile.getBaseFile().toURL(), certs), null);
    } catch (MalformedURLException e) {
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.