diff --git a/Scissors.ps1 b/Scissors.ps1 new file mode 100644 index 0000000..719542e --- /dev/null +++ b/Scissors.ps1 @@ -0,0 +1,26 @@ +#Scissors - Quick and Dirty Script for extracting private key and certificate from an exported PFX. +cls + +#Get Cert path +$path = Read-Host "Where is the pfx?" +$pass = Read-Host "What is the pfx Password?" + +#Create function Open-Explorer to open the location of the cert - Strips cert.pfx from the $path variable leaving you the folder path. - I know there is easier ways to do this but I just want someone to love me. +function Open-Explorer { + param( + [string]$FilePath + ) + + $Folder = Split-Path $FilePath -Parent + explorer.exe $Folder +} + + +#Seperate certs +openssl pkcs12 -in $path -nocerts -out private_key.pem -nodes -password pass:$pass +openssl pkcs12 -in $path -clcerts -nokeys -out public_cert.pem -password pass:$pass +openssl pkcs12 -in $path -cacerts -nokeys -out cert_chain.pem -password pass:$pass + +Write-host "Jobs done" + +Open-Explorer $path \ No newline at end of file