Home > Back-end >  How to get the fingerprint of a base64 encoded pfx certificate in windows powershell
How to get the fingerprint of a base64 encoded pfx certificate in windows powershell

Time:05-11

I have a base64 encoded .pfx certificate that was encoded in linux using:
cat $my_pfx_cert | base64 -w 0

In windows Powershell, I'm unable to decode this string and produce a meaningful fingerprint however. Below is is my attempt...

$output = "MIIM9QIBAzCCDL8GCSqGSIb3DQEHAaCCDLAEggysMIIMqDCCB2cGCSqGSIb3DQEHBqCCB1gwggdUAgEAMIIHTQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQMwDgQIj35zcxzJVBoCAggAgIIHIF8836BfDMhX4P3F7rCuewfAdX8hb3K2ce71q5iHUriSr9xOJVI/5Ygg59afM6ZIGF7TQ0CZ9BlxwenDGxs4ADuLFmDnLsb0F TCG49xW3ptZW075tx9eNzyZv7rm6d8of6Y8YV/tCvK3meh6herZu2tNvHluTz7ugMyWSaeGWJx/fDBcSQPDkTdCKIuFaLscDZEhu3L9er8sVzIke/uywEW7gJ65pcLyUabeLhdR4APFEJO95ECceM Di8OH3SQJ9KIE7wxDZ6s9/Fjpe/f89mPTzSJtB9EGg7Vo9cR1V64ZI1WPxu3rOoM7TuUmBvGO4lVLSq9TqJLHsBfv7wmb9CSbD22kfVUAxoXTkSQg5ntlUirvP6AUxjIstb1V8GnH9E/pE7bg6Qbt3RWTndkq j38oU2yC1QrVLNlaTzE9TYKhlWBqF5DvS4GPR4z5XI5zWn K1wF6ZFPEB LrphJMZcBV3rVSH9VCPoUXFZAk9EhWQey9NxS nqN ZbMEdp87j yvedBq13dG3gpF4Iw8Wv7tZQOpBdtDLUv8reL5LkkX7mYCFWIklIlj5CIr9 GzHgq2m6b80vEqpq uaTPOFF6rC Q7TNMrs54kKADsKnYE5Rbk2Ou22JrpTbcVY/DTPxrdbzPTGO9c2DwscI8U6yBYnPVPUgtoG7WsjKIedGGR1IMvPrP2OxSaMBhDL0G9Kg3Cc/DzDdqXiVE0XYIWSy7HTNQhBo0oJGHMic 4JVPc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/o/weJiY1yYFxXFC6upDlPrYVYRhvLyEOQjPhhehf1XMBVwigivdx12nycW5KdZ3zm5Y1a9frM2hvotEwQB/JS5WbCmyxmJl0PBHuoWntPkMWFef3gdn04IYoWLT9AJ5/kjElMCMGCSqGSIb3DQEJFTEWBBR8oiIpvEV1kCYaMSHAuUiccuPByTAtMCEwCQYFKw4DAhoFAAQUtMtsYrBKFFPXy2r/trU6Z7ATHa8ECDdubqX8 95J"
$converted = $([System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($output)))
$converted | Out-File -FilePath "$HOME\.ssh\Deadline10RemoteClient_from_bash.pfx"
$cert_password = ""
New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("$HOME\.ssh\Deadline10RemoteClient_from_bash.pfx", $cert_password)

The equivalent in bash however does work:

output="MIIM9QIBAzCCDL8GCSqGSIb3DQEHAaCCDLAEggysMIIMqDCCB2cGCSqGSIb3DQEHBqCCB1gwggdUAgEAMIIHTQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQMwDgQIj35zcxzJVBoCAggAgIIHIF8836BfDMhX4P3F7rCuewfAdX8hb3K2ce71q5iHUriSr9xOJVI/5Ygg59afM6ZIGF7TQ0CZ9BlxwenDGxs4ADuLFmDnLsb0F TCG49xW3ptZW075tx9eNzyZv7rm6d8of6Y8YV/tCvK3meh6herZu2tNvHluTz7ugMyWSaeGWJx/fDBcSQPDkTdCKIuFaLscDZEhu3L9er8sVzIke/uywEW7gJ65pcLyUabeLhdR4APFEJO95ECceM Di8OH3SQJ9KIE7wxDZ6s9/Fjpe/f89mPTzSJtB9EGg7Vo9cR1V64ZI1WPxu3rOoM7TuUmBvGO4lVLSq9TqJLHsBfv7wmb9CSbD22kfVUAxoXTkSQg5ntlUirvP6AUxjIstb1V8GnH9E/pE7bg6Qbt3RWTndkq j38oU2yC1QrVLNlaTzE9TYKhlWBqF5DvS4GPR4z5XI5zWn K1wF6ZFPEB LrphJMZcBV3rVSH9VCPoUXFZAk9EhWQ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yOsTl2BB4tzy3oUstoDTUK 51ejI7 a/zMY3CRcmnMR1VTE24zoKD/Aq4kLKs3VDq9kVLIK/jlQljYRhyPtGmuVr1LUEKWxYy2I1Cvnd9Dpa08/DkPhpq1 BUc7oWjarVSp vDM5uJ0ZGI2RcauSuu1OvD9MqnFjqVr92myjDB zmrkjE89U36gqHlLuRmewogEFIMw0dCyFnHJ oaSryzn5swVaY1BSwZ4mCnL8Djc75Jk7fonWxIWa14Ujvnt/I/o/weJiY1yYFxXFC6upDlPrYVYRhvLyEOQjPhhehf1XMBVwigivdx12nycW5KdZ3zm5Y1a9frM2hvotEwQB/JS5WbCmyxmJl0PBHuoWntPkMWFef3gdn04IYoWLT9AJ5/kjElMCMGCSqGSIb3DQEJFTEWBBR8oiIpvEV1kCYaMSHAuUiccuPByTAtMCEwCQYFKw4DAhoFAAQUtMtsYrBKFFPXy2r/trU6Z7ATHa8ECDdubqX8 95J"
echo "$output" | base64 --decode > "$HOME/.ssh/Deadline10RemoteClient_from_bash.pfx"
openssl pkcs12 -in "$HOME/.ssh/Deadline10RemoteClient_from_bash.pfx" -nodes -passin pass: |openssl x509 -noout -fingerprint

CodePudding user response:

You're likely messing up the encoding when converting it to a string and writing to file with Out-File, so skip that part entirely - the X509Certificate2 constructor takes a raw byte array as input anyway:

$output = "MIIM9QIBAzCCDL8GCSqGSIb3DQEHAaCCDLAEggysMIIMqDCCB2cGCSqGSIb3DQEHBqCCB1gwggdUAgEAMIIHTQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQMwDgQIj35zcxzJVBoCAggAgIIHIF8836BfDMhX4P3F7rCuewfAdX8hb3K2ce71q5iHUriSr9xOJVI/5Ygg59afM6ZIGF7TQ0CZ9BlxwenDGxs4ADuLFmDnLsb0F TCG49xW3ptZW075tx9eNzyZv7rm6d8of6Y8YV/tCvK3meh6herZu2tNvHluTz7ugMyWSaeGWJx/fDBcSQPDkTdCKIuFaLscDZEhu3L9er8sVzIke/uywEW7gJ65pcLyUabe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b0qd  DiQPnN8jem4VCY5GJvZUVWER1t8JKOFQhyjpA k2MHaBaUAMHuDjQGQl7REL80THoSZCjNT67uWzrKqOVDx1IPA/h7a1w7nyLsYGt87g3RJUpdrBfTKE5 PleG170zXxW67SQjwqjIlljfecOK4ays6ZZcMlpyf uJw37nA1RSx162fIHEqEj071VyhE5uMW5sdKLhsC4JO0RDXAMkeen JHahtft3IOkxehVZL0YpTKwsMmo2f61erlbD4frfCxlwC8 YjO7SwxmMPzp3s47YEqpNyOsTl2BB4tzy3oUstoDTUK 51ejI7 a/zMY3CRcmnMR1VTE24zoKD/Aq4kLKs3VDq9kVLIK/jlQljYRhyPtGmuVr1LUEKWxYy2I1Cvnd9Dpa08/DkPhpq1 BUc7oWjarVSp vDM5uJ0ZGI2RcauSuu1OvD9MqnFjqVr92myjDB zmrkjE89U36gqHlLuRmewogEFIMw0dCyFnHJ oaSryzn5swVaY1BSwZ4mCnL8Djc75Jk7fonWxIWa14Ujvnt/I/o/weJiY1yYFxXFC6upDlPrYVYRhvLyEOQjPhhehf1XMBVwigivdx12nycW5KdZ3zm5Y1a9frM2hvotEwQB/JS5WbCmyxmJl0PBHuoWntPkMWFef3gdn04IYoWLT9AJ5/kjElMCMGCSqGSIb3DQEJFTEWBBR8oiIpvEV1kCYaMSHAuUiccuPByTAtMCEwCQYFKw4DAhoFAAQUtMtsYrBKFFPXy2r/trU6Z7ATHa8ECDdubqX8 95J"
$rawCertBytes = [Convert]::FromBase64String($output)
$certificate = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($rawCertBytes)

Now that you have a [X509Certificate2] object, either read the thumbprint via the API:

$certificate.Thumbprint

Or, if you want to analyze the certificate file on disk (with openssl for example), export it:

# Create a new file
$certFile = New-Item certificate.cer -ItemType File

# Open a writable file stream
$fileStream = $certFile.OpenWrite()

try {
    # Write cert bytes to disk
    $certBytes = $certificate.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert)
    $fileStream.Write($certBytes, 0, $certBytes.Length)
    $fileStream.Flush($true)
    $fileStream.Close()
}
finally {
    # Clean up open file stream
    $fileStream |ForEach-Object Dispose
}
  • Related