private PublicKeyImpl convert(final PGPPublicKey pgpPublicKey) {
    PublicKeyImpl key = new PublicKeyImpl();
    key.setUserIds(new ArrayList<UserIdImpl>());

    key.setKeyId(Long.toHexString(pgpPublicKey.getKeyID()).toUpperCase());
    key.setAlgo(pgpPublicKey.getAlgorithm());
    key.setKeyLen(pgpPublicKey.getBitStrength());
    key.setCreationDate(pgpPublicKey.getCreationTime());

    key.setMaster(pgpPublicKey.isMasterKey());
    key.setRevoked(pgpPublicKey.isRevoked());
    Iterator userIDs = pgpPublicKey.getUserIDs();

    while (userIDs.hasNext()) {
      String userUd = (String) userIDs.next();
      UserIdImpl userId = convert(userUd);
      userId.setCreationDate(pgpPublicKey.getCreationTime());
      key.addUserId(userId);
    }

    return key;
  }
 private UserIdImpl convert(final String strUserId) {
   UserIdImpl userId = new UserIdImpl();
   userId.setUserId(strUserId);
   return userId;
 }