code: 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;
    }
docs: reads the PGP public key from a PublicKeyRing
  
  @param publicKeyRing
  the source public key ring
  @param keyFilter
  the filter to apply
  @return the matching PGP public or null if none matches