Last active
April 9, 2021 23:44
-
-
Save kategray/9a6b4ed81820998087ec79d9b2593606 to your computer and use it in GitHub Desktop.
Convert a cisco PKCS12 (PEM/text format) to a binary P12 for OpenSSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Opens up keypair.txt and writes to keypair.p12 | |
# | |
# Skip the first and last lines, and trim any whitespace | |
$text = (Get-Content keypair.txt | Select-Object -skip 1 | Select-Object -skiplast 1).Trim() | |
# Convert from Base64 to Bytes | |
$bytes = [System.Convert]::FromBase64String($text) | |
# Write the content to keypair.p12 | |
Set-Content keypair.p12 -Value $bytes -Encoding Byte |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment