获取私钥 @param privateKey 私钥字符串 @return
(String privateKey)
| 54 | * @return |
| 55 | */ |
| 56 | public static PrivateKey getPrivateKey(String privateKey) throws Exception { |
| 57 | KeyFactory keyFactory = KeyFactory.getInstance("RSA"); |
| 58 | byte[] decodedKey = Base64.decode(privateKey.getBytes(),Base64.NO_WRAP); |
| 59 | PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(decodedKey); |
| 60 | return keyFactory.generatePrivate(keySpec); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** |