我加载私有(private.pem)我的代码是:
FileReader fileReader = new FileReader(new File(private.pem));
PEMReader r = new PEMReader(fileReader, new DefaultPasswordFinder("mypass".toCharArray()));
try {
KeyPair kp = (KeyPair) r.readObject();
} catch (IOException ex) {
throw new IOException("The private key could not be decrypted", ex);
} finally {
r.close();
fileReader.close();
}
错误是: 引起:
java.io.IOException: problem creating RSA private key: java.security.NoSuchProviderException: No such provider: BC at org.bouncycastle.openssl.PEMReader.readObject(Unknown Source)
谢谢。