common_helper/src/main/java/com/xiongyingqi/util/RsaUtils.java
private static String decrypt(String cryptograph) throws Exception {
        Key privateKey;
        ObjectInputStream ois = null;
        try {
            /** 将文件中的私钥对象读出 */
            ois = new ObjectInputStream(new FileInputStream(
                    PRIVATE_KEY_FILE));
            privateKey = (Key) ois.readObject();
        } catch (Exception e) {
            throw e;
        } finally {
            ois.close();
        }

        /** 得到Cipher对象对已用公钥加密的数据进行RSA解密 */
        Cipher cipher = Cipher.getInstance(ALGORITHM);
        cipher.init(Cipher.DECRYPT_MODE, privateKey);
        BASE64Decoder decoder = new BASE64Decoder();
        byte[] b1 = decoder.decodeBuffer(cryptograph);

        /** 执行解密操作 */
        byte[] b = cipher.doFinal(b1);
        return new String(b);
    }
private static String decrypt(String cryptograph) throws Exception {
        Key privateKey;
        ObjectInputStream ois = null;
        try {
            /** 将文件中的私钥对象读出 */
            ois = new ObjectInputStream(new FileInputStream(
                    PRIVATE_KEY_FILE));
            privateKey = (Key) ois.readObject();
        } catch (Exception e) {
            throw e;
        } finally {
            ois.close();
        }

        /** 得到Cipher对象对已用公钥加密的数据进行RSA解密 */
        Cipher cipher = Cipher.getInstance(ALGORITHM);
        cipher.init(Cipher.DECRYPT_MODE, privateKey);
        BASE64Decoder decoder = new BASE64Decoder();
        byte[] b1 = decoder.decodeBuffer(cryptograph);

        /** 执行解密操作 */
        byte[] b = cipher.doFinal(b1);
        return new String(b);
    }
private static String decrypt ( String cryptograph ) throws Exception { Key privateKey ; ObjectInputStream ois = null ; try { /** 将文件中的私钥对象读出 */ ois = new ObjectInputStream ( new FileInputStream ( PRIVATE_KEY_FILE ) ) ; privateKey = ( Key ) ois . readObject ( ) ; } catch ( Exception e ) { throw e ; } finally { ois . close ( ) ; } /** 得到Cipher对象对已用公钥加密的数据进行RSA解密 */ Cipher cipher = Cipher . getInstance ( ALGORITHM ) ; cipher . init ( Cipher . DECRYPT_MODE , privateKey ) ; BASE64Decoder decoder = new BASE64Decoder ( ) ; byte [ ] b1 = decoder . decodeBuffer ( cryptograph ) ; /** 执行解密操作 */ byte [ ] b = cipher . doFinal ( b1 ) ; return new String ( b ) ; }
解密算法

@param cryptograph 密文
@return
@throws Exception
解密算法