Created
November 21, 2015 14:35
-
-
Save canhnt/61603df13dbee49a83de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final InputStream pubKeyStream = getClass().getClassLoader().getResourceAsStream("pubkey.asc"); | |
assertNotNull(pubKeyStream); | |
PGPPublicKeyRingCollection pubRingCollection = new PGPPublicKeyRingCollection( | |
PGPUtil.getDecoderStream(pubKeyStream), | |
new JcaKeyFingerprintCalculator()); | |
final PGPPublicKeyRing pgpPublicKeyRing = pubRingCollection.getKeyRings().next(); | |
assertNotNull(pgpPublicKeyRing); | |
final PGPPublicKey pgpPublicKey = pgpPublicKeyRing.getPublicKey(); | |
final JcaPGPKeyConverter converter = new JcaPGPKeyConverter(); | |
PublicKey publicKey = converter.getPublicKey(pgpPublicKey); | |
assertNotNull(publicKey); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment