src/main/java/com/webank/wecross/account/service/utils/RSAUtility.java
/**
     * @param content
     * @return
     * @throws NoSuchAlgorithmException
     * @throws InvalidKeySpecException
     */
@param content
@return
@throws NoSuchAlgorithmException
@throws InvalidKeySpecException
@param content @return @throws NoSuchAlgorithmException @throws InvalidKeySpecException
public static PublicKey createPublicKey(String content)
            throws NoSuchAlgorithmException, InvalidKeySpecException, IOException {
        PemReader pemReader = new PemReader(new StringReader(content));
        PemObject pemObject = pemReader.readPemObject();
        byte[] pemContent = pemObject.getContent();
        X509EncodedKeySpec spec = new X509EncodedKeySpec(pemContent);
        KeyFactory kf = KeyFactory.getInstance("RSA");
        return kf.generatePublic(spec);
    }
public static PublicKey createPublicKey ( String content ) throws NoSuchAlgorithmException , InvalidKeySpecException , IOException { PemReader pemReader = new PemReader ( new StringReader ( content ) ) ; PemObject pemObject = pemReader . readPemObject ( ) ; byte [ ] pemContent = pemObject . getContent ( ) ; X509EncodedKeySpec spec = new X509EncodedKeySpec ( pemContent ) ; KeyFactory kf = KeyFactory . getInstance ( "RSA" ) ; return kf . generatePublic ( spec ) ; }
@param content
 @return
 @throws NoSuchAlgorithmException
 @throws InvalidKeySpecException
@param content @return @throws NoSuchAlgorithmException @throws InvalidKeySpecException