update
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
|
||||
function Test-SectigoCertificateRequest {
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param (
|
||||
[string]$FilePath,
|
||||
[string]$csr
|
||||
)
|
||||
|
||||
if ($FilePath) {
|
||||
[string]$csr = (Get-Content -Path $FilePath -Raw)
|
||||
}
|
||||
|
||||
[string]$dcvUrl = "https://certificates.nd.gov/api/csr/validate/string"
|
||||
|
||||
|
||||
$headers = @{
|
||||
"accept" = "application/json"
|
||||
"Content-Type" = "application/json" # <-- Cleaned up syntax
|
||||
}
|
||||
|
||||
$Body = @{
|
||||
"csr" = $csr
|
||||
}
|
||||
|
||||
$jsonBody = $body | ConvertTo-Json
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
# --- API Call ---
|
||||
Write-Verbose "Attempting to retrieve certificate for Order ID: $OrderId"
|
||||
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri $dcvUrl -Method Post -Headers $headers -Body $jsonBody
|
||||
$response
|
||||
} catch {
|
||||
Write-Error "API Request Failed: $($_.Exception.Message)"|convertfrom-json
|
||||
return $null
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user