Java examples for Security:RSA
decrypt Data with RSA private key
//package com.java2s; import java.security.PrivateKey; import javax.crypto.Cipher; public class Main { private static final String RSA = "RSA"; public static byte[] decryptData(byte[] encryptedData, PrivateKey privateKey) { try {/*from www .ja v a 2 s. c om*/ Cipher cipher = Cipher.getInstance(RSA); cipher.init(Cipher.DECRYPT_MODE, privateKey); return cipher.doFinal(encryptedData); } catch (Exception e) { return null; } } }