in.s8.rsa.utility.ReadPrivateKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of RSA-Encryption-Decryption Show documentation
Show all versions of RSA-Encryption-Decryption Show documentation
Project to RSA-encrypt-decrypt
The newest version!
package in.s8.rsa.utility;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.ObjectInputStream;
import java.security.PrivateKey;
/**
* Read the private key from file location.
*
* Created by Sourabh_Sethi on 5/17/2016.
*
* @author sourabh Sethi
*/
public class ReadPrivateKey {
public PrivateKey readPrivateKeyPath(String privateKeyLocation) throws FileNotFoundException {
ObjectInputStream inputStream = null;
PrivateKey privateKey = null;
try {
inputStream = new ObjectInputStream(new FileInputStream(privateKeyLocation));
privateKey = (PrivateKey) inputStream.readObject();
} catch (FileNotFoundException e) {
System.out.println("Please check the public key and Private Key Path");
System.out.println("please provide the private key path");
} catch (Exception e) {
e.printStackTrace();
}
return privateKey;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy