Commit 0b3543ee42f3c7edb3eb95d125969235d7e40a01
- Diff rendering mode:
- inline
- side by side
felix/src/main/java/org/springframework/roo/felix/pgp/PgpServiceImpl.java
(8 / 3)
|   | |||
| 32 | 32 | import org.bouncycastle.openpgp.PGPSignature; | |
| 33 | 33 | import org.bouncycastle.openpgp.PGPSignatureList; | |
| 34 | 34 | import org.bouncycastle.openpgp.PGPUtil; | |
| 35 | import org.osgi.framework.BundleContext; | ||
| 35 | 36 | import org.osgi.service.component.ComponentContext; | |
| 36 | 37 | import org.springframework.roo.support.osgi.UrlFindingUtils; | |
| 37 | 38 | import org.springframework.roo.support.util.Assert; | |
| … | … | ||
| 59 | 59 | public class PgpServiceImpl implements PgpService { | |
| 60 | 60 | @Reference private UrlInputStreamService urlInputStreamService; | |
| 61 | 61 | private boolean automaticTrust = false; | |
| 62 | private ComponentContext context; | ||
| 62 | private BundleContext context; | ||
| 63 | 63 | private static final File ROO_PGP_FILE = new File(System.getProperty("user.home") + File.separatorChar + ".spring_roo_pgp.bpg"); | |
| 64 | 64 | // private static final String DEFAULT_KEYSERVER_URL = "http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search="; | |
| 65 | 65 | private static final String DEFAULT_KEYSERVER_URL = "http://pgp.mit.edu:11371/pks/lookup?op=get&search="; | |
| … | … | ||
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | 73 | protected void activate(ComponentContext context) { | |
| 74 | this.context = context; | ||
| 74 | this.context = context.getBundleContext(); | ||
| 75 | trustDefaultKeysIfRequired(); | ||
| 76 | } | ||
| 77 | |||
| 78 | protected void trustDefaultKeysIfRequired() { | ||
| 75 | 79 | // Setup default keys we trust automatically if the user doesn't have a PGP file already | |
| 76 | 80 | if (!ROO_PGP_FILE.exists()) { | |
| 77 | 81 | trustDefaultKeys(); | |
| … | … | ||
| 83 | 83 | } | |
| 84 | 84 | ||
| 85 | 85 | private void trustDefaultKeys() { | |
| 86 | Set<URL> urls = UrlFindingUtils.findMatchingClasspathResources(context.getBundleContext(), "/org/springframework/roo/felix/pgp/*.asc"); | ||
| 86 | Set<URL> urls = UrlFindingUtils.findMatchingClasspathResources(context, "/org/springframework/roo/felix/pgp/*.asc"); | ||
| 87 | 87 | ||
| 88 | 88 | SortedSet<URL> sortedUrls = new TreeSet<URL>(new Comparator<URL>() { | |
| 89 | 89 | public int compare(URL o1, URL o2) { |
Comments
Add your comment
Please log in to comment



Add a new comment:
Login or create an account to post a comment