I’m trying to Sign a String with Private Key (From pfx Certificate) and with Algorithm RSA-SHA512
in Powershell.
Here is what i have now:
$x_request_id = New-Guid
$x_request_id_Final = "x-request-id: $x_request_id"
$string = ""
$bytes = [System.Text.Encoding]::UTF8.GetBytes($string)
$sha512 = [System.Security.Cryptography.SHA512]::Create()
$hash = $sha512.ComputeHash($bytes)
$Digest = [System.Convert]::ToBase64String($hash)
$Digest_Final = "digest: SHA512=$Digest"
$SignString = $Digest_Final + "`n" + $x_request_id_Final
my output looks like this:
digest: SHA512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg== x-request-id: f1856125-24bd-47c1-a1af-1ab6bd507634
so far everything is ok.
now i have a private key which i pulled from PFX Certificate, lets called it “Certificate.pfx”
and it’s content looks like this:
-----BEGIN PRIVATE KEY-----
Base64ContentHere
-----END PRIVATE KEY-----
Does anyone knows had any experience signing String with private key with the Algorithm RSA-SHA512 in powershell?
2