List of usage examples for java.security.spec InvalidKeySpecException printStackTrace
public void printStackTrace()
From source file:se.leap.bitmaskclient.ConfigHelper.java
protected static RSAPrivateKey parseRsaKeyFromString(String RsaKeyString) { RSAPrivateKey key = null;/*from w ww . j a v a 2s . c om*/ try { KeyFactory kf = KeyFactory.getInstance("RSA", "BC"); RsaKeyString = RsaKeyString.replaceFirst("-----BEGIN RSA PRIVATE KEY-----", "") .replaceFirst("-----END RSA PRIVATE KEY-----", ""); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(Base64.decode(RsaKeyString, Base64.DEFAULT)); key = (RSAPrivateKey) kf.generatePrivate(keySpec); } catch (InvalidKeySpecException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (NoSuchProviderException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } return key; }