Skip to content

Commit

Permalink
Removed key conversion code in Azure plugin when key not detected as …
Browse files Browse the repository at this point in the history
…RSACryptoServiceProvider (#599)
  • Loading branch information
rmbolger committed Feb 8, 2025
1 parent 87ce1d6 commit 00ba556
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions Posh-ACME/Plugins/Azure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -635,17 +635,7 @@ function Connect-AZTenant {
throw "Private key invalid for certificate with thumbprint $($cert.Thumbprint)."
}
$privKey = $cert.PrivateKey
Write-Debug "private key is type $($privKey.GetType().FullName)"
if ($privKey -isnot [Security.Cryptography.RSACryptoServiceProvider]) {
# On non-Windows, the private key ends up being of type RSAOpenSsl
# which for some reason doesn't allow reading of the KeySize attribute
# which then breaks New-Jws's internal validation checks. So we need
# to convert it to an RSACryptoServiceProvider object instead.
Write-Debug "Converting privatekey to RSACryptoServiceProvider"
$keyParams = $privKey.ExportParameters($true)
$privKey = [Security.Cryptography.RSACryptoServiceProvider]::new()
$privKey.ImportParameters($keyParams)
}
Write-Debug "Private key is type $($privKey.GetType().FullName)"

Write-Verbose "Authenticating with certificate based credential"
$clientId = [uri]::EscapeDataString($AZAppUsername)
Expand Down

0 comments on commit 00ba556

Please sign in to comment.