Ejemplo n.º 1
0
 public PrivateKey readKey(String name) throws IOException {
   RSAPrivateCrtKeySpec sp = readKeyFile(name);
   KeyFactory kf;
   try {
     kf = KeyFactory.getInstance("RSA");
   } catch (NoSuchAlgorithmException e) {
     throw new IOException("RSA: " + e.toString());
   }
   PrivateKey pk;
   try {
     pk = kf.generatePrivate(sp);
   } catch (InvalidKeySpecException e) {
     throw new IOException(e.toString());
   }
   return pk;
 }