Examples of readPemObject()


Examples of org.bouncycastle.util.io.pem.PemReader.readPemObject()

  public static PrivateKey loadPrivateKey(InputStream in) throws Exception {
    Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    final KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    final PemReader reader = new PemReader(new InputStreamReader(in));
    final byte[] pubKey = reader.readPemObject().getContent();
   
    reader.close();
    PKCS8EncodedKeySpec publicKeySpec = new PKCS8EncodedKeySpec(pubKey);
    PrivateKey publicKey = keyFactory.generatePrivate(publicKeySpec);
    return publicKey;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.