我将键存储为byte []到sqlite数据库。 当我想获得私钥时:
ResultSet rs = pstmt.executeQuery();
while(rs.next()){
KeyFactory rsaKeyFac = KeyFactory.getInstance("RSA");
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(rs.getBytes(1));
RSAPrivateCrtKey privKey;
privKey = (RSAPrivateCrtKey) rsaKeyFac.generatePrivate(keySpec);
result = privKey;
}
我只得到:
sun.security.rsa.RSAPrivateCrtKeyImpl@fffd1339
我的公钥检索有效!但是使用私钥和证书我不明白。
有人可以帮忙吗?