0
我想通過程序從BKS商店獲得私鑰,但是我發現它與我的解析和pem文件是不同的。爲什麼在BKS和PEM之間的私鑰是不同的
任何機構都知道這是爲什麼?
這裏是我的代碼:
KeyStore testkeyStore = KeyStore.getInstance("bks");
testkeyStore.load(inputstream, keystorepass);
PrivateKey key = (PrivateKey)testkeyStore .getKey("xxxxx",keypassword);
byte[] bas = key.getEncoded();
bas = Base64.encode(bas, Base64.DEFAULT);
String keys = new String(bas);
Log.d("XXX","keys " + keys);
這裏是我BKS轉移到PEM:
keytool -importkeystore -srckeystore xxx.bks -srcstoretype BKS -destkeystore xx.p12 -deststoretype PKCS12 -provider org.bouncycastle.jce.provider.BouncyCastleProvider
openssl pkcs12 -in xxx.p12 -out xxx.pem