public static RSAPrivateKey buildPrivateKey ( final byte [ ] keyData ) throws NoSuchAlgorithmException , InvalidKeySpecException { PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec ( keyData ) ; KeyFactory keyFactory = KeyFactory . getInstance ( CIPHER_ALGORITHM ) ; PrivateKey generatePrivate = keyFactory . generatePrivate ( privateKeySpec ) ; return ( RSAPrivateKey ) generatePrivate ; }
Construct the RSA private key from a key binary data .