public SignedContent getSignedContent(Bundle bundle) throws IOException, InvalidKeyException, SignatureException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, IllegalArgumentException { final Generation generation = (Generation) ((EquinoxBundle) bundle).getModule().getCurrentRevision().getRevisionInfo(); StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); SignedContent result = hook != null ? hook.signedContent : null; if (result != null)
public SignedContent getSignedContent(Bundle bundle) throws IOException, InvalidKeyException, SignatureException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, IllegalArgumentException { final Generation generation = (Generation) ((EquinoxBundle) bundle).getModule().getCurrentRevision().getRevisionInfo(); StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); SignedContent result = hook != null ? hook.signedContent : null; if (result != null)
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) { try { if (bundleFile != null) { StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); SignedBundleFile signedBaseFile; if (base && hook != null) { signedBaseFile = new SignedBundleFile(bundleFile, hook.signedContent, supportSignedBundles, this); if (hook.signedContent == null) { signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); hook.signedContent = signedContent != null && signedContent.isSigned() ? signedContent : null; } } else signedBaseFile = new SignedBundleFile(bundleFile, null, supportSignedBundles, this); signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); if (signedContent != null && signedContent.isSigned()) { // only use the signed file if there are certs signedContent.setContent(signedBaseFile); return new BundleFileWrapper(signedBaseFile); } } } catch (IOException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } catch (GeneralSecurityException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } return null; }
public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) { try { if (bundleFile != null) { StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); SignedBundleFile signedBaseFile; if (base && hook != null) { signedBaseFile = new SignedBundleFile(bundleFile, hook.signedContent, supportSignedBundles, this); if (hook.signedContent == null) { signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); hook.signedContent = signedContent != null && signedContent.isSigned() ? signedContent : null; } } else signedBaseFile = new SignedBundleFile(bundleFile, null, supportSignedBundles, this); signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); if (signedContent != null && signedContent.isSigned()) { // only use the signed file if there are certs signedContent.setContent(signedBaseFile); return new BundleFileWrapper(signedBaseFile); } } } catch (IOException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } catch (GeneralSecurityException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } return null; }
public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) { try { if (bundleFile != null) { StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); SignedBundleFile signedBaseFile; if (base && hook != null) { signedBaseFile = new SignedBundleFile(bundleFile, hook.signedContent, supportSignedBundles, this); if (hook.signedContent == null) { signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); hook.signedContent = signedContent != null && signedContent.isSigned() ? signedContent : null; } } else signedBaseFile = new SignedBundleFile(bundleFile, null, supportSignedBundles, this); signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); if (signedContent != null && signedContent.isSigned()) { // only use the signed file if there are certs signedContent.setContent(signedBaseFile); return new BundleFileWrapper(signedBaseFile); } } } catch (IOException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } catch (GeneralSecurityException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } return null; }
public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) { try { if (bundleFile != null) { StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); SignedBundleFile signedBaseFile; if (base && hook != null) { signedBaseFile = new SignedBundleFile(bundleFile, hook.signedContent, supportSignedBundles, this); if (hook.signedContent == null) { signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); hook.signedContent = signedContent != null && signedContent.isSigned() ? signedContent : null; } } else signedBaseFile = new SignedBundleFile(bundleFile, null, supportSignedBundles, this); signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); if (signedContent != null && signedContent.isSigned()) { // only use the signed file if there are certs signedContent.setContent(signedBaseFile); return new BundleFileWrapper(signedBaseFile); } } } catch (IOException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } catch (GeneralSecurityException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } return null; }
public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) { try { if (bundleFile != null) { StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); SignedBundleFile signedBaseFile; if (base && hook != null) { signedBaseFile = new SignedBundleFile(bundleFile, hook.signedContent, supportSignedBundles, this); if (hook.signedContent == null) { signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); hook.signedContent = signedContent != null && signedContent.isSigned() ? signedContent : null; } } else signedBaseFile = new SignedBundleFile(bundleFile, null, supportSignedBundles, this); signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); if (signedContent != null && signedContent.isSigned()) { // only use the signed file if there are certs signedContent.setContent(signedBaseFile); return new BundleFileWrapper(signedBaseFile); } } } catch (IOException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } catch (GeneralSecurityException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } return null; }
public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) { try { if (bundleFile != null) { StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); SignedBundleFile signedBaseFile; if (base && hook != null) { signedBaseFile = new SignedBundleFile(bundleFile, hook.signedContent, supportSignedBundles, this); if (hook.signedContent == null) { signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); hook.signedContent = signedContent != null && signedContent.isSigned() ? signedContent : null; } } else signedBaseFile = new SignedBundleFile(bundleFile, null, supportSignedBundles, this); signedBaseFile.initializeSignedContent(); SignedContentImpl signedContent = signedBaseFile.getSignedContent(); if (signedContent != null && signedContent.isSigned()) { // only use the signed file if there are certs signedContent.setContent(signedBaseFile); return new BundleFileWrapper(signedBaseFile); } } } catch (IOException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } catch (GeneralSecurityException e) { log("Bad bundle file: " + bundleFile.getBaseFile(), FrameworkLogEntry.WARNING, e); //$NON-NLS-1$ } return null; }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private SignedContentImpl getSignedContent(Bundle bundle) { Generation generation = (Generation) ((EquinoxBundle) bundle).getModule().getCurrentRevision().getRevisionInfo(); StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); return hook != null ? hook.signedContent : null; } }
private SignedContentImpl getSignedContent(Bundle bundle) { Generation generation = (Generation) ((EquinoxBundle) bundle).getModule().getCurrentRevision().getRevisionInfo(); StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); return hook != null ? hook.signedContent : null; } }
private SignedContentImpl getSignedContent(Bundle bundle) { Generation generation = (Generation) ((EquinoxBundle) bundle).getModule().getCurrentRevision().getRevisionInfo(); StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); return hook != null ? hook.signedContent : null; } }
private SignedContentImpl getSignedContent(Bundle bundle) { Generation generation = (Generation) ((EquinoxBundle) bundle).getModule().getCurrentRevision().getRevisionInfo(); StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); return hook != null ? hook.signedContent : null; } }
private SignedContentImpl getSignedContent(Bundle bundle) { Generation generation = (Generation) ((EquinoxBundle) bundle).getModule().getCurrentRevision().getRevisionInfo(); StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); return hook != null ? hook.signedContent : null; } }
private SignedContentImpl getSignedContent(Bundle bundle) { Generation generation = (Generation) ((EquinoxBundle) bundle).getModule().getCurrentRevision().getRevisionInfo(); StorageHookImpl hook = generation.getStorageHook(SignedStorageHook.class); return hook != null ? hook.signedContent : null; } }