protected PGPPublicKey retrievePublicKey ( PGPPublicKeyRing publicKeyRing , KeyFilter < PGPPublicKey > keyFilter ) { LOGGER . trace ( "retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)" ) ; PGPPublicKey result = null ; Iterator < PGPPublicKey > publicKeyIterator = publicKeyRing . getPublicKeys ( ) ; LOGGER . debug ( "Iterating through public keys in public key ring" ) ; while ( result == null && publicKeyIterator . hasNext ( ) ) { PGPPublicKey key = publicKeyIterator . next ( ) ; LOGGER . info ( "Found secret key: {}" , key . getKeyID ( ) ) ; LOGGER . debug ( "Checking public key with filter" ) ; if ( keyFilter . accept ( key ) ) { LOGGER . info ( "Public key {} selected from key ring" , key . getKeyID ( ) ) ; result = key ; } } return result ; }
reads the PGP public key from a PublicKeyRing