Java tutorial
//package com.java2s; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.interfaces.RSAPrivateKey; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; public class Main { /** * RSA decryption * @param priKey * @param message * @return * @throws IllegalBlockSizeException * @throws BadPaddingException * @throws NoSuchPaddingException * @throws NoSuchAlgorithmException * @throws InvalidKeyException */ public static byte[] decryptRSA(RSAPrivateKey priKey, byte[] message) throws IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException { Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, priKey); return cipher.doFinal(message); } }