protected PGPPublicKeyRing readPublicKeyRing ( InputStream publicKey ) { LOGGER . trace ( "readPublicKeyRing(InputStream)" ) ; PGPPublicKeyRing result = null ; LOGGER . debug ( "Wrapping public key stream in decoder stream" ) ; try ( InputStream decoderStream = PGPUtil . getDecoderStream ( publicKey ) ) { LOGGER . debug ( "Creating PGP Object Factory" ) ; PGPObjectFactory pgpObjectFactory = new PGPObjectFactory ( decoderStream , new BcKeyFingerprintCalculator ( ) ) ; Object o = null ; LOGGER . debug ( "Looking up PGP Public KeyRing" ) ; while ( ( o = pgpObjectFactory . nextObject ( ) ) != null && result == null ) { if ( o instanceof PGPPublicKeyRing ) { LOGGER . info ( "PGP Public KeyRing retrieved" ) ; result = ( PGPPublicKeyRing ) o ; } } } catch ( IOException e ) { LOGGER . error ( "{}" , e . getMessage ( ) ) ; } return result ; }
reads the public key ring from the input stream