PGPKeyUtil { public static PGPPublicKey readPublicKey( String armoredKey ) throws PGPException { return readPublicKey( new ByteArrayInputStream( armoredKey.getBytes( StandardCharsets.UTF_8 ) ) ); }  static String encodeNumericKeyId( long keyId ); static String getKeyId( String fingerprint ); static String getFingerprint( byte[] fingerprint ); static String getShortKeyId( String fingerprint ); static boolean isFingerprint( String keyId ); static boolean isLongKeyId( String keyId ); static boolean isShortKeyId( String keyId ); static boolean isValidKeyId( String keyId ); static String exportAscii( PGPPublicKey pgpKey ); static PGPPublicKey readPublicKey( String armoredKey ); static PGPPublicKey readPublicKey( InputStream instr ); static PGPPublicKeyRing readPublicKeyRing( byte[] keyMaterial ); PGPPublicKeyRing getPublicKeyRing( byte[] keyMaterial ); static PGPPublicKeyRing readPublicKeyRing( String armoredKey ); static PGPPublicKeyRing readPublicKeyRing( InputStream instr ); static boolean isValidPublicKeyring( String publicKey ); static PGPSecretKeyRing readSecretKeyRing( byte[] keyMaterial ); PGPSecretKeyRing getSecretKeyRing( byte[] keyMaterial ); static ByteArrayInputStream readSecretKeyRingInputStream( byte[] keyMaterial ); static PGPSecretKeyRing readSecretKeyRing( InputStream instr ); static PGPPublicKey readPublicKey( PGPPublicKeyRing keyRing ); static PGPSecretKey readSecretKey( PGPSecretKeyRing keyRing ); static final int HEX_SHORT_KEY_ID_LENGTH; static final int HEX_LONG_KEY_ID_LENGTH; static final int HEX_V3_FINGERPRINT_LENGTH; static final int HEX_V4_FINGERPRINT_LENGTH; }
@Test public void testReadPublicKey() throws Exception { assertNotNull( PGPKeyUtil.readPublicKey( PGPEncryptionUtilTest.findFile( PGPEncryptionUtilTest.PUBLIC_KEYRING ) ) ); }
@Test public void testReadPublicKey2() throws Exception { assertNotNull( PGPKeyUtil.readPublicKey( PGPEncryptionUtil.armorByteArrayToString( IOUtils.toByteArray( PGPEncryptionUtilTest.findFile( PGPEncryptionUtilTest.PUBLIC_KEYRING ) ) ) ) ); }