Tag Archives: convert pkcs12 to bks

Convert pkcs12 key to bks format for Android

Dear Reader,

If you ever want to convert a pkcs12 format key to bks format for Android follow the below instructions.

First of all downlaod bcprov-jdk16-1.46.jar file

[root@itpings certs]# wget http://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk16/1.46/bcprov-jdk16-1.46.jar
–2017-06-30 17:05:40– http://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk16/1.46/bcprov-jdk16-1.46.jar
Resolving repo1.maven.org (repo1.maven.org)… 151.101.32.209
Connecting to repo1.maven.org (repo1.maven.org)|151.101.32.209|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1876535 (1.8M) [application/java-archive]
Saving to: ‘bcprov-jdk16-1.46.jar’

bcprov-jdk16-1.46.j 100%[===================>] 1.79M –.-KB/s in 0.02s

2017-06-30 17:05:40 (89.3 MB/s) – ‘bcprov-jdk16-1.46.jar’ saved [1876535/1876535]

Now Convert the File as follow with keytool

[root@itpings certs]# keytool –importkeystore –srckeystore user.P12 -srcstoretype pkcs12 –destkeystore user.bks –deststoretype bks –provider org.bouncycastle.jce.provider.BouncyCastleProvider -–providerpath bcprov-jdk16-1.46.jar
Enter destination keystore password:
Re-enter new password:
Enter source keystore password:
Entry for alias 1 successfully imported.
Import command completed: 1 entries successfully imported, 0 entries failed or cancelled
[root@itpings certs]# ls
user.bks

Done.

Thanks,
Salman Aftab
ITpings
YouTube: LinuxKing
FaceBook: LZHProject