2022-08-03 00:30:03 +02:00
|
|
|
# OpenSSL Cheatsheet
|
|
|
|
|
|
|
|
## Extract keys from PFX Cert
|
|
|
|
|
|
|
|
* Key and cert form PFX
|
|
|
|
```sh
|
|
|
|
openssl pkcs12 -in cert.pfx -nocerts -out key.pem -nodes
|
|
|
|
openssl pkcs12 -in cert.pfx -out cert.pem -clcerts -nokeys
|
|
|
|
```
|
|
|
|
|
|
|
|
## Extract & Repack PFX Cert
|
|
|
|
|
|
|
|
* Extract & Repack with another password, e.g. from `mimikatz` to `cqure`
|
|
|
|
```sh
|
|
|
|
openssl pkcs12 -in *.pfx -out temp.pem -nodes
|
|
|
|
openssl pkcs12 -export -out *.pfx -in temp.pem
|
|
|
|
```
|
2022-09-05 23:30:48 +02:00
|
|
|
|
|
|
|
## Generate Certificate
|
|
|
|
|
|
|
|
```sh
|
|
|
|
openssl req -new -x509 -keyout cert.pem -out cert.pem -days 365 -nodes
|
|
|
|
```
|