EN
Bash - read *.p12 keystore info
3 points
In this short article, we would like to show how to read information about *.p12 keystore file using openssl
command.
Quick solution:
xxxxxxxxxx
1
openssl pkcs12 -info -in /path/to/keystore_file.p12
Run the following command:
xxxxxxxxxx
1
openssl pkcs12 -info -in /path/to/keystore_file.p12
Where: /path/to/keystore_file.p12
should be changed into keystore file that we want to read.
Note: it is necessary to type password to read file (do it after
Enter Import Password:
message appeard).
Example output:
xxxxxxxxxx
1
Enter Import Password:
2
MAC: sha1, Iteration 2048
3
MAC length: 20, salt length: 8
4
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048
5
Certificate bag
6
Bag Attributes
7
localKeyID: 45 12 22 14 8A F0 84 1F 9B FD 0A F4 B7 36 42 48 29 B3 7B 8E
8
subject=O = "CloudFlare, Inc.", OU = CloudFlare Origin CA, CN = CloudFlare Origin Certificate
9
10
issuer=C = US, O = "CloudFlare, Inc.", OU = CloudFlare Origin SSL Certificate Authority, L = San Francisco, ST = California
11
12
-----BEGIN CERTIFICATE-----
13
MIIEoDCCA4m9rA3Xr7ISvGhawOYO4wDQYJKoZIigAwIBAgIURCoe1iJ3hvcNAQEL
14
BQAwgYsxCzAJBgNVBAYTAlVTMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMTQw
15
MgYDVQQLE2VydGlmaWNhdGUgQXVytDbG91ZEZsYXJlIE9yaWdpbiBTU0wgQ0aG9y
16
...
17
m6uDTG1iDPRzRpwlhyLG3xxV5Bm4rdb0a6lQyrMuG/WHGBlMVaw3csfM5KHrVwz/
18
W9nvxbAJfjIUNttPfJyZM+5l9lCMgOIhr2jhjRepgfyT2cljeab1Gn5dHocuG/Ig
19
MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECCsEIHead7OfBIIEyAESSwbs4mXU
20
9Vb3OehP7nSjyPrgb6jHM8w8CWnB06wuDAyZwGaWYe6JHDLJ
21
-----END CERTIFICATE-----
22
PKCS7 Data
23
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2048
24
Bag Attributes
25
localKeyID: 45 12 22 14 8A F0 84 1F 9B FD 0A F4 B7 36 42 48 29 B3 7B 8E
26
Key Attributes: <No Attributes>
27
Enter PEM pass phrase:
28
Verifying - Enter PEM pass phrase:
29
-----BEGIN ENCRYPTED PRIVATE KEY-----
30
MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIDwd95onkExYCAggA
31
kzl1Xx59Fm+84ByxwMz7JwLFy/LI5hvhTK85Id+Uff1lVAL+K6hAPGRJgPP0XCse
32
y2+butmmB1wDrTb7UMHqX6yCe4ODZARZmH7lEE0KK8DUF0duev9e8jGupFeX7x82
33
...
34
pWNvFzbRizAMv5bjP0YOL3yxpnIPDPrpyVD0wCpj/DEWEIB9nxyTdvbrH5crRitJ
35
41teOi4X9IyqQuB9YobIAkeeuwEtsUkcJ9Gm7x7Csi7oVeV+PFc2cKPbJcBQLixE
36
aXRNvMRMwEQYDVQQIEwpDYWxpZm9yb5MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2mlh
37
E2565aVqP7g5gL9F/xXP/A==
38
-----END ENCRYPTED PRIVATE KEY-----