From 7ac7974ef53719c1b22ba9fa7da28cc07db017f1 Mon Sep 17 00:00:00 2001 From: Ghufz <18732053+Ghufz@users.noreply.github.com> Date: Mon, 7 Sep 2020 12:54:36 +0530 Subject: [PATCH] RSACng class is not supported on linux replacing it by RSA (#7349) * RSACng class is not supported on linux replacing it by RSA * update PS samples Co-authored-by: William Cheng --- .../src/main/resources/powershell/http_signature_auth.mustache | 2 +- .../powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/powershell/http_signature_auth.mustache b/modules/openapi-generator/src/main/resources/powershell/http_signature_auth.mustache index fe6a3dc8ec6..698f9b248f4 100644 --- a/modules/openapi-generator/src/main/resources/powershell/http_signature_auth.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/http_signature_auth.mustache @@ -174,7 +174,7 @@ function Get-{{{apiNamePrefix}}}RSASignature { $keyStr = Get-Content -Path $PrivateKeyFilePath -Raw $ecKeyBase64String = $keyStr.Replace($ecKeyHeader, "").Replace($ecKeyFooter, "").Trim() $keyBytes = [System.Convert]::FromBase64String($ecKeyBase64String) - $rsa = [System.Security.Cryptography.RSACng]::new() + $rsa = [System.Security.Cryptography.RSA]::Create() [int]$bytCount = 0 $rsa.ImportRSAPrivateKey($keyBytes, [ref] $bytCount) diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 index 6cb2087ccf1..e3333ae336f 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/PSHttpSignatureAuth.ps1 @@ -180,7 +180,7 @@ function Get-PSRSASignature { $keyStr = Get-Content -Path $PrivateKeyFilePath -Raw $ecKeyBase64String = $keyStr.Replace($ecKeyHeader, "").Replace($ecKeyFooter, "").Trim() $keyBytes = [System.Convert]::FromBase64String($ecKeyBase64String) - $rsa = [System.Security.Cryptography.RSACng]::new() + $rsa = [System.Security.Cryptography.RSA]::Create() [int]$bytCount = 0 $rsa.ImportRSAPrivateKey($keyBytes, [ref] $bytCount)