Category Archives: Programming

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

Python for Linux Admins – IV

Simple Python Script which will show linux logs (dmesg and lastlog) from selection.

#!/usr/bin/env python

import os

os.system (‘clear’)

print “Pylog Created by Hyp3ri0n”

print “Version 0.1”

print “Respect Linux…………….”

print “=” * 50

print ” ”

value = 1

value2 = 2

answer = int(input (“Enter the Value 1 or 2: “)

if answer == value:

os.system (‘tail -20 /var/log/dmesg’)

if anwer == value2:

os.system (‘lastlog -u 0 && lastlog -u 1001-10000’)

#End