Skip to content

Commit

Permalink
fix not windows issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mdaneri committed Feb 12, 2025
1 parent e98748a commit 2bc4d84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 117 deletions.
12 changes: 7 additions & 5 deletions src/Private/Cryptography.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -856,11 +856,13 @@ function Get-PodeJwtSigningAlgorithm {
[ValidateSet('Pkcs1V15', 'Pss')]
[string]$RsaPaddingScheme = 'Pkcs1V15' # Default to PKCS#1 v1.5 unless specified
)

# Convert SecureString to plain text
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($PrivateKey)
$privateKeyContent = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)

#if (Test-PodeIsPSCore) {
# $privateKeyContent = ConvertFrom-SecureString $PrivateKey -AsPlainTex
# }
# else {
# Convert SecureString to plain text
$privateKeyContent = [Runtime.InteropServices.Marshal]::PtrToStringUni([Runtime.InteropServices.Marshal]::SecureStringToGlobalAllocUnicode($PrivateKey))
# }
if ($privateKeyContent -match 'BEGIN RSA PRIVATE KEY|BEGIN PRIVATE KEY') {
# RSA Algorithm Detected

Expand Down
112 changes: 0 additions & 112 deletions temp-file-for-testing.ps1

This file was deleted.

0 comments on commit 2bc4d84

Please sign in to comment.