PGPKeyHelper { public static PGPPublicKey readPublicKeyFromString( String key ) throws IOException, PGPException { if ( StringUtils.isBlank( key ) ) { throw new IllegalArgumentException( "Public key string is null" ); } return readPublicKey( IOUtils.toInputStream( key ) ); } private  PGPKeyHelper(); static PGPPublicKey readPublicKey( InputStream is ); static PGPPublicKey readPublicKey( String filePath ); static PGPPublicKey readPublicKeyFromString( String key ); static PGPPrivateKey readPrivateKey( InputStream is, String password ); static PGPPrivateKey readPrivateKey( String filePath, String password ); static String getFingerprint( PGPPublicKey publicKey ); static String getOwnerString( PGPPublicKey publicKey );  }
@Test( expected = IllegalArgumentException.class ) public void testReadPublicKeyFromString_emptyString() throws IOException, PGPException { PGPKeyHelper.readPublicKeyFromString( "" ); }
@Test public void testReadPublicKeyFromString_success() throws IOException, PGPException { String str = FileUtils.readFileToString( new File( PGPTestDataFactory.PUBLIC_KEY_PATH ) ); PGPPublicKey publicKey = PGPKeyHelper.readPublicKeyFromString( str ); assertNotNull( publicKey ); }