Skip to content

Commit 00ba556

Browse files
committed
Removed key conversion code in Azure plugin when key not detected as RSACryptoServiceProvider (#599)
1 parent 87ce1d6 commit 00ba556

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

Posh-ACME/Plugins/Azure.ps1

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -635,17 +635,7 @@ function Connect-AZTenant {
635635
throw "Private key invalid for certificate with thumbprint $($cert.Thumbprint)."
636636
}
637637
$privKey = $cert.PrivateKey
638-
Write-Debug "private key is type $($privKey.GetType().FullName)"
639-
if ($privKey -isnot [Security.Cryptography.RSACryptoServiceProvider]) {
640-
# On non-Windows, the private key ends up being of type RSAOpenSsl
641-
# which for some reason doesn't allow reading of the KeySize attribute
642-
# which then breaks New-Jws's internal validation checks. So we need
643-
# to convert it to an RSACryptoServiceProvider object instead.
644-
Write-Debug "Converting privatekey to RSACryptoServiceProvider"
645-
$keyParams = $privKey.ExportParameters($true)
646-
$privKey = [Security.Cryptography.RSACryptoServiceProvider]::new()
647-
$privKey.ImportParameters($keyParams)
648-
}
638+
Write-Debug "Private key is type $($privKey.GetType().FullName)"
649639

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

0 commit comments

Comments
 (0)