SignPath.psm1

#Requires -Version 3.0
# Also requires .NET Version 4.7.2 or above

$ServiceUnavailableRetryTimeoutInSeconds = 30
$WaitForCompletionRetryTimeoutInSeconds = 5
$DefaultHttpClientTimeoutInSeconds = 100

<#
.SYNOPSIS
  Submits a new signing request or resubmits an existing one via the SignPath REST API.
.DESCRIPTION
  The Submit-SigningRequest cmdlet creates a new signing request. The signing request will be processed by SignPath according to authorization and policy rules.
 
  CREATING A NEW SIGNING REQUEST VS. RE-SIGNING
 
  When using the -InputArtifact parameter, the specified file will be uploaded for processing.
 
  When using the -Resubmit parameter, the specified signing request will be processed again using the specified signing policy. This is especially useful for conditional signing of release candidates. See Resubmit an existing signing request for more information.
 
  DOWNLOADING THE SIGNED ARTIFACT
 
  Processing a signing request may take several minutes, or even longer if manual approval is required. You can either
 
  * your own logic to wait for processing to complete and
    download the signed artifact using the Get-SignedArtifact
    cmdlet afterwards,
  * or use the -WaitForCompletion parameter of this cmdlet
    to wait for processing and then download the
    signed artifact in a single call.
 
.EXAMPLE
  Submit-SigningRequest `
    -OrganizationId $ORGANIZATION_ID -CIUserToken $CI_USER_TOKEN `
    -ProjectSlug $PROJECT -SigningPolicySlug $SIGNING_POLICY `
    -ArtifactConfigurationSlug $ARTIFACT_CONFIGURATION `
    -InputArtifactPath $PATH_TO_INPUT_ARTIFACT `
    -WaitForCompletion `
    -OutputArtifactPath $PATH_TO_OUTPUT_ARTIFACT
.EXAMPLE
  Submit-SigningRequest `
    -OrganizationId $ORGANIZATION_ID -CIUserToken $CI_USER_TOKEN `
    -ProjectSlug $PROJECT -SigningPolicySlug $SIGNING_POLICY `
    -ArtifactConfigurationSlug $ARTIFACT_CONFIGURATION `
    -ArtifactRetrievalLink $URL_TO_INPUT_ARTIFACT `
    -ArtifactRetrievalLinkFileName $FILE_NAME_OF_INPUT_ARTIFACT `
    -ArtifactRetrievalLinkSha256Hash $SHA256_HASH_OF_INPUT_ARTIFACT_IN_HEX_STRING_FORMAT `
    -ArtifactRetrievalLinkHttpHeaders @{
      "$ARTIFACT_RETRIEVAL_LINK_HTTP_HEADER_KEY1" = "$ARTIFACT_RETRIEVAL_LINK_HTTP_HEADER_VALUE1"
      "$ARTIFACT_RETRIEVAL_LINK_HTTP_HEADER_KEY2" = "$ARTIFACT_RETRIEVAL_LINK_HTTP_HEADER_VALUE2"
    } `
    -WaitForCompletion `
    -OutputArtifactPath $PATH_TO_OUTPUT_ARTIFACT
.EXAMPLE
  $signingRequestID = Submit-SigningRequest `
    -OrganizationId $ORGANIZATION_ID `-CIUserToken $CI_USER_TOKEN `
    -ProjectSlug $PROJECT -SigningPolicySlug $SIGNING_POLICY `
    -ArtifactConfigurationSlug $ARTIFACT_CONFIGURATION `
    -InputArtifactPath $PATH_TO_INPUT_ARTIFACT
 
 Submit a signing request and get a signing request ID withoput waiting for completion and download the signed artifact later
 
PS > Get-SignedArtifact `
    -OrganizationId $ORGANIZATION_ID -CIUserToken $CI_USER_TOKEN `
    -SigningRequestId $signingRequestID `
    -OutputArtifactPath $PATH_TO_OUTPUT_ARTIFACT
 
.EXAMPLE
  Submit-SigningRequestResubmit `
    -CIUserToken $CI_USER_TOKEN -OrganizationId $ORGANIZATION_ID `
    -OriginalSigningRequestId $ORIGINAL_SIGNING_REQUEST_ID `
    -SigningPolicySlug $SIGNING_POLICY `
    -WaitForCompletion `
    -OutputArtifactPath $PATH_TO_OUTPUT_ARTIFACT
.OUTPUTS
  Returns the SigningRequestId which can be used with Get-SignedArtifact.
.NOTES
  Author: SignPath GmbH
.LINK
  https://about.signpath.io/documentation/powershell/Submit-SigningRequest
#>

function Submit-SigningRequest {
  [CmdletBinding(DefaultParameterSetName = 'Submit')]
  Param(
    # URL to the SignPath REST API, e.g. 'https://app.signpath.io/api/'.
    [Parameter()]
    [ValidateNotNullOrEmpty()]
    [string] $ApiUrl = "https://app.signpath.io/api/",

    # API token you receive when adding a new CI user.
    [Parameter(Mandatory)]
    [ValidateNotNullOrEmpty()]
    [string] $CIUserToken,

    # ID of your SignPath organization.
    [Parameter(Mandatory)]
    [ValidateNotNullOrEmpty()]
    [string] $OrganizationId,

    # ID of one of the project's artifact configurations.
    [Parameter(ParameterSetName = 'SubmitWithArtifact')]
    [Parameter(ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [string] $ArtifactConfigurationId,

    # ID of a project's signing policy.
    [Parameter()]
    [string] $SigningPolicyId,

    # Slug of the project.
    [Parameter(ParameterSetName = 'SubmitWithArtifact')]
    [Parameter(ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [Alias("ProjectKey")]
    [string] $ProjectSlug,

    # Slug of one of the project's artifact configurations.
    # If not given, the default artifact configuration will be used instead.
    [Parameter(ParameterSetName = 'SubmitWithArtifact')]
    [Parameter(ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [Alias("ArtifactConfigurationKey")]
    [string] $ArtifactConfigurationSlug,

    # Slug of one of the project's signing policies.
    [Parameter()]
    [Alias("SigningPolicyKey")]
    [string] $SigningPolicySlug,

    # Path of the artifact that you want to be signed.
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifact')]
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [ValidateNotNullOrEmpty()]
    [string] $InputArtifactPath,

    # URL where the artifact that you want to be signed will be downloaded from.
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [ValidateNotNullOrEmpty()]
    [string] $ArtifactRetrievalLink,

    # File name of the artifact to be signed.
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [ValidateNotNullOrEmpty()]
    [string] $ArtifactRetrievalLinkFileName,

    # Optional file hash (in hex string format) of the artifact to sign (used to verify the artifact download).
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [ValidateNotNullOrEmpty()]
    [string] $ArtifactRetrievalLinkSha256Hash,

    # Optional HTTP headers that will be used when downloading the artifact to sign.
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [ValidateNotNullOrEmpty()]
    [Hashtable] $ArtifactRetrievalLinkHttpHeaders,

    # Optional description of the signing request.
    [Parameter()]
    [string] $Description,

    # Information about the origin of the artifact, see https://about.signpath.io/documentation/powershell#submit-signingrequest
    [Parameter(ParameterSetName = 'SubmitWithArtifact')]
    [Parameter(ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [Hashtable] $Origin,

    # Values for parameters defined in the artifact configuration. See https://about.signpath.io/documentation/artifact-configuration#user-defined-parameters
    [Parameter(ParameterSetName = 'SubmitWithArtifact')]
    [Parameter(ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [Hashtable] $Parameters,

    # Client certificate used for a secure Web API request. Not supported by SignPath.io directly, use for proxies.
    [Parameter()]
    [System.Security.Cryptography.X509Certificates.X509Certificate2] $ClientCertificate,

    # Total time in seconds that the cmdlet will wait for a single service call to succeed (across several retries). Defaults to 600 seconds.
    [Parameter()]
    [int] $ServiceUnavailableTimeoutInSeconds = 600,

    # HTTP timeout used for upload and download HTTP requests. Defaults to 300 seconds.
    [Parameter()]
    [int] $UploadAndDownloadRequestTimeoutInSeconds = 300,

    # Re-sign an existing signing request. SigningPolicySlug or SigningPolicyId reference the original project's signing policy.
    [Parameter(Mandatory, ParameterSetName = 'Resubmit')]
    [Parameter(Mandatory, ParameterSetName = 'Resubmit_WaitForCompletion')]
    [switch] $Resubmit,

    # ID of the signing request that should be resubmitted.
    [Parameter(Mandatory, ParameterSetName = 'Resubmit')]
    [Parameter(Mandatory, ParameterSetName = 'Resubmit_WaitForCompletion')]
    [ValidateNotNullOrEmpty()]
    [string] $OriginalSigningRequestId,

    # Wait for the signing request to complete.
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [Parameter(Mandatory, ParameterSetName = 'Resubmit_WaitForCompletion')]
    [switch] $WaitForCompletion,

    # Specifies the target path for the downloaded signed artifact. Defaults to InputArtifactPath with an added .signed extension (e.g. "Input.dll" => "Input.signed.dll").
    [Parameter(ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(Mandatory, ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [Parameter(Mandatory, ParameterSetName = 'Resubmit_WaitForCompletion')]
    [ValidateNotNullOrEmpty()]
    [string] $OutputArtifactPath,

    # Maximum time in seconds that the cmdlet will wait for the signing request to complete (upload and download have no specific timeouts). Defaults to 600 seconds.
    [Parameter(ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [Parameter(ParameterSetName = 'Resubmit_WaitForCompletion')]
    [int] $WaitForCompletionTimeoutInSeconds = 600,

    # Allows the cmdlet to overwrite the file at OutputArtifactPath.
    [Parameter(ParameterSetName = 'SubmitWithArtifact_WaitForCompletion')]
    [Parameter(ParameterSetName = 'SubmitWithArtifactRetrievalLink_WaitForCompletion')]
    [Parameter(ParameterSetName = 'Resubmit_WaitForCompletion')]
    [switch] $Force
  )

  Set-StrictMode -Version 2.0

  $ApiUrl = GetVersionedApiUrl $ApiUrl
  Write-Verbose "Using versioned API URL: $ApiUrl"

  if($Resubmit.IsPresent) {
    $resubmitUrl = [string]::Join("/", @($ApiUrl.Trim("/"), $OrganizationId, "SigningRequests", "Resubmit"))
    $requestFactory = CreateResubmitRequestFactory `
      -url $resubmitUrl `
      -originalSigningRequestId $OriginalSigningRequestId `
      -signingPolicySlug $SigningPolicySlug `
      -description $Description

    return SubmitHelper "Resubmit" "Resubmitted" $requestFactory `
      -ciUserToken $CIUserToken `
      -clientCertificate $ClientCertificate `
      -defaultHttpClientTimeoutInSeconds $DefaultHttpClientTimeoutInSeconds `
      -uploadAndDownloadRequestTimeoutInSeconds $UploadAndDownloadRequestTimeoutInSeconds `
      -waitForCompletionTimeoutInSeconds $WaitForCompletionTimeoutInSeconds `
      -waitForCompletion $WaitForCompletion.IsPresent `
      -outputArtifactPath $OutputArtifactPath `
      -force $Force.IsPresent
  } else {
    if ($InputArtifactPath) {
      if (-not $OutputArtifactPath) {
        $extension = [System.IO.Path]::GetExtension($InputArtifactPath)
        $OutputArtifactPath = [System.IO.Path]::ChangeExtension($InputArtifactPath, "signed$extension")
      }

      $InputArtifactPath = PrepareInputArtifactPath $InputArtifactPath
      Write-Verbose "Using input artifact: $InputArtifactPath"

      $hash = (Get-FileHash -Path $InputArtifactPath -Algorithm "SHA256").Hash
      Write-Host "SHA256 hash: $hash"

      $submitUrl = [string]::Join("/", @($ApiUrl.Trim("/"), $OrganizationId, "SigningRequests"))
      $requestFactory = CreateSubmitWithArtifactRequestFactory `
        -Url $submitUrl `
        -ArtifactConfigurationId $ArtifactConfigurationId `
        -SigningPolicyId $SigningPolicyId `
        -ProjectSlug $ProjectSlug `
        -ArtifactConfigurationSlug $ArtifactConfigurationSlug `
        -SigningPolicySlug $SigningPolicySlug `
        -Description $Description `
        -InputArtifactPath $InputArtifactPath `
        -Origin $Origin `
        -Parameters $Parameters
    } else {
      $submitUrl = [string]::Join("/", @($ApiUrl.Trim("/"), $OrganizationId, "SigningRequests", "SubmitWithArtifactRetrievalLink"))
      $requestFactory = CreateSubmitWithArtifactRetrievalLinkRequestFactory `
        -Url $submitUrl `
        -ArtifactConfigurationId $ArtifactConfigurationId `
        -SigningPolicyId $SigningPolicyId `
        -ProjectSlug $ProjectSlug `
        -ArtifactConfigurationSlug $ArtifactConfigurationSlug `
        -SigningPolicySlug $SigningPolicySlug `
        -Description $Description `
        -ArtifactRetrievalLink $ArtifactRetrievalLink `
        -ArtifactRetrievalLinkFileName $ArtifactRetrievalLinkFileName `
        -ArtifactRetrievalLinkSha256Hash $ArtifactRetrievalLinkSha256Hash `
        -ArtifactRetrievalLinkHttpHeaders $ArtifactRetrievalLinkHttpHeaders `
        -Origin $Origin `
        -Parameters $Parameters
    }

    return SubmitHelper "Submit" "Submitted" $requestFactory `
        -ciUserToken $CIUserToken `
        -clientCertificate $ClientCertificate `
        -defaultHttpClientTimeoutInSeconds $DefaultHttpClientTimeoutInSeconds `
        -uploadAndDownloadRequestTimeoutInSeconds $UploadAndDownloadRequestTimeoutInSeconds `
        -waitForCompletionTimeoutInSeconds $WaitForCompletionTimeoutInSeconds `
        -waitForCompletion $WaitForCompletion.IsPresent `
        -outputArtifactPath $OutputArtifactPath `
        -force $Force.IsPresent
  }
}

<#
.SYNOPSIS
    Downloads a signed artifact based on a signing request ID.
.DESCRIPTION
    The Get-SignedArtifact cmdlet waits for a given signing request to finish and downloads the resultiung artifact.
 
    If the request couldn't be downloaded in time, because the processing took to long or the request is invalid, this cmdlet will throw exceptions.
.EXAMPLE
  Get-SignedArtifact `
    -OutputArtifactPath Program.exe `
    -CIUserToken /Joe3s2m7hkhVyoba4H4weqj9UxIk6nKRXGhGbH7nv4= `
    -OrganizationId 1c0ab26c-12f3-4c6e-a043-2568e133d2de `
    -SigningRequestId 711960ed-bdb8-41cd-a6bf-a10d0ae3cfcd
.EXAMPLE
  $signingRequestID = Submit-SigningRequest `
    -OrganizationId $ORGANIZATION_ID `-CIUserToken $CI_USER_TOKEN `
    -ProjectSlug $PROJECT -SigningPolicySlug $SIGNING_POLICY `
    -ArtifactConfigurationSlug $ARTIFACT_CONFIGURATION `
    -InputArtifactPath $PATH_TO_INPUT_ARTIFACT
 
PS > Get-SignedArtifact `
    -OrganizationId $ORGANIZATION_ID -CIUserToken $CI_USER_TOKEN `
    -SigningRequestId $signingRequestID `
    -OutputArtifactPath $PATH_TO_OUTPUT_ARTIFACT
.OUTPUTS
    Returns void but creates a file in the given OutputArtifactPath on success.
.NOTES
  Author: SignPath GmbH
.LINK
  https://about.signpath.io/documentation/powershell/Get-SignedArtifact
#>

function Get-SignedArtifact {
  [CmdletBinding()]
  Param(
    # URL to the SignPath REST API, e.g. https://app.signpath.io/api/.
    [Parameter()]
    [ValidateNotNullOrEmpty()]
    [string] $ApiUrl = "https://app.signpath.io/api/",

    # API token you receive when adding a new CI user.
    [Parameter(Mandatory)]
    [ValidateNotNullOrEmpty()]
    [string] $CIUserToken,

    # ID of your SignPath organization.
    [Parameter(Mandatory)]
    [ValidateNotNullOrEmpty()]
    [string] $OrganizationId,

    # ID of the siging request.
    [Parameter(Mandatory)]
    [ValidateNotNullOrEmpty()]
    [string] $SigningRequestId,

    # Specifies the target path for the downloaded signed artifact.
    [Parameter(Mandatory)]
    [ValidateNotNullOrEmpty()]
    [string] $OutputArtifactPath,

    # Client certificate used for a secure Web API request. Not supported by SignPath.io directly, use for proxies.
    [Parameter()]
    [System.Security.Cryptography.X509Certificates.X509Certificate2] $ClientCertificate,

    # Total time in seconds that the cmdlet will wait for a single service call to succeed (across several retries). Defaults to 600 seconds.
    [Parameter()]
    [int] $ServiceUnavailableTimeoutInSeconds = 600,

    # HTTP timeout used for upload and download HTTP requests. Defaults to 300 seconds.
    [Parameter()]
    [int] $UploadAndDownloadRequestTimeoutInSeconds = 300,

    # Maximum time in seconds that the cmdlet will wait for the signing request to complete (upload and download have no specific timeouts). Defaults to 600 seconds.
    [Parameter()]
    [int] $WaitForCompletionTimeoutInSeconds = 600,

    # Allows the cmdlet to overwrite the file at OutputArtifactPath.
    [Parameter()]
    [switch] $Force
  )

  Set-StrictMode -Version 2.0

  $ApiUrl = GetVersionedApiUrl $ApiUrl
  Write-Verbose "Using versioned API URL: $ApiUrl"

  $OutputArtifactPath = PrepareOutputArtifactPath $Force $OutputArtifactPath
  Write-Verbose "Will write signed artifact to: $OutputArtifactPath"

  CreateAndUseAuthorizedHttpClient $CIUserToken -ClientCertificate $ClientCertificate -Timeout $DefaultHttpClientTimeoutInSeconds {
    Param ([System.Net.Http.HttpClient] $defaultHttpClient)

    CreateAndUseAuthorizedHttpClient $CIUserToken -Timeout $UploadAndDownloadRequestTimeoutInSeconds {
      Param ([System.Net.Http.HttpClient] $uploadAndDownloadHttpClient)

      $expectedSigningRequestUrl = [string]::Join("/", @($ApiUrl.Trim("/"), $OrganizationId, "SigningRequests", $SigningRequestId))

      $downloadUrl = WaitForCompletionAndRetrieveSignedArtifactDownloadLink `
        -httpClient $defaultHttpClient `
        -url $expectedSigningRequestUrl `
        -WaitForCompletionTimeoutInSeconds $WaitForCompletionTimeoutInSeconds `
        -WaitForCompletionRetryTimeoutInSeconds $WaitForCompletionRetryTimeoutInSeconds `
        -ServiceUnavailableRetryTimeoutInSeconds $ServiceUnavailableRetryTimeoutInSeconds

      DownloadArtifact `
        -HttpClient $uploadAndDownloadHttpClient `
        -Url $downloadUrl `
        -Path $OutputArtifactPath `
        -ServiceUnavailableRetryTimeoutInSeconds $ServiceUnavailableRetryTimeoutInSeconds
    }
  }
}

function GetVersionedApiUrl ([string] $apiUrl) {
  $supportedApiVersion = "v1"
  return [string]::Join("/", @($apiUrl.Trim("/"), $supportedApiVersion))
}

function SubmitHelper ([string] $verb,
                       [string] $verbPastTense,
                       [ScriptBlock] $requestFactory,
                       [string] $ciUserToken,
                       [System.Security.Cryptography.X509Certificates.X509Certificate2] $clientCertificate,
                       [int] $defaultHttpClientTimeoutInSeconds,
                       [int] $uploadAndDownloadRequestTimeoutInSeconds,
                       [int] $waitForCompletionTimeoutInSeconds,
                       [bool] $waitForCompletion,
                       [string] $outputArtifactPath,
                       [bool] $force) {
  CreateAndUseAuthorizedHttpClient $ciUserToken -ClientCertificate $clientCertificate -Timeout $defaultHttpClientTimeoutInSeconds {
    Param ([System.Net.Http.HttpClient] $defaultHttpClient)

    CreateAndUseAuthorizedHttpClient $ciUserToken -ClientCertificate $clientCertificate -Timeout $uploadAndDownloadRequestTimeoutInSeconds {
      Param ([System.Net.Http.HttpClient] $uploadAndDownloadHttpClient)

      if ($waitForCompletion) {
        $outputArtifactPath = PrepareOutputArtifactPath $force $outputArtifactPath
        Write-Verbose "Will write output artifact to: $outputArtifactPath"
      }

      $response = $null
      try {
        Write-Verbose "$verb signing request..."
        $response = SendWithRetry `
          -HttpClient $HttpClient `
          -RequestFactory $requestFactory `
          -ServiceUnavailableRetryTimeoutInSeconds $ServiceUnavailableRetryTimeoutInSeconds
        CheckResponse $response

        $getUrl = $response.Headers.Location.AbsoluteUri
        Write-Host "$verbPastTense signing request at '$getUrl'"
      } finally {
        if ((Test-Path variable:response) -and $null -ne $response) {
          $response.Dispose()
        }
      }

      if ($waitForCompletion) {
        $downloadUrl = WaitForCompletionAndRetrieveSignedArtifactDownloadLink `
          -HttpClient $defaultHttpClient `
          -Url $getUrl `
          -WaitForCompletionTimeoutInSeconds $waitForCompletionTimeoutInSeconds `
          -WaitForCompletionRetryTimeoutInSeconds $WaitForCompletionRetryTimeoutInSeconds `
          -ServiceUnavailableRetryTimeoutInSeconds $ServiceUnavailableRetryTimeoutInSeconds

        DownloadArtifact `
          -HttpClient $uploadAndDownloadHttpClient `
          -Url $downloadUrl `
          -Path $outputArtifactPath `
          -ServiceUnavailableRetryTimeoutInSeconds $ServiceUnavailableRetryTimeoutInSeconds
      }

      $guidRegex = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
      $pattern = [regex]"SigningRequests/($guidRegex)"
      $getUrl -match $pattern | Out-Null
      $signingRequestId = $matches[1]
      Write-Verbose "Parsed signing request ID: $signingRequestId"
      return $signingRequestId
    }
  }
}

function CreateSubmitWithArtifactRequestFactory (
  [string] $url,
  [string] $artifactConfigurationId,
  [string] $signingPolicyId,
  [string] $projectSlug,
  [string] $artifactConfigurationSlug,
  [string] $signingPolicySlug,
  [string] $description,
  [string] $inputArtifactPath,
  [Hashtable] $origin,
  [Hashtable] $parameters
) {
  return CreateSubmitRequestFactory `
    -Url $url `
    -ArtifactConfigurationId $artifactConfigurationId `
    -SigningPolicyId $signingPolicyId `
    -ProjectSlug $projectSlug `
    -ArtifactConfigurationSlug $artifactConfigurationSlug `
    -SigningPolicySlug $signingPolicySlug `
    -Description $description `
    -Origin $origin `
    -Parameters $parameters `
    -AddAdditionalContent {
      Param ($content)

      $packageFileStream = New-Object System.IO.FileStream ($inputArtifactPath, [System.IO.FileMode]::Open)
      $streamContent = New-Object System.Net.Http.StreamContent $packageFileStream
      # PLANNED SIGN-988 This shouldn't be needed anymore
      $streamContent.Headers.ContentType = New-Object System.Net.Http.Headers.MediaTypeHeaderValue "application/octet-stream"
      $fileName = [System.IO.Path]::GetFileName($inputArtifactPath)
      $content.Add($streamContent, "Artifact", $fileName)
      Write-Verbose "Artifact: $fileName"
    }
}

function CreateSubmitWithArtifactRetrievalLinkRequestFactory (
  [string] $url,
  [string] $artifactConfigurationId,
  [string] $signingPolicyId,
  [string] $projectSlug,
  [string] $artifactConfigurationSlug,
  [string] $signingPolicySlug,
  [string] $description,
  [string] $artifactRetrievalLink,
  [string] $artifactRetrievalLinkFileName,
  [string] $artifactRetrievalLinkSha256Hash,
  [HashTable] $artifactRetrievalLinkHttpHeaders,
  [Hashtable] $origin,
  [Hashtable] $parameters
) {
  return CreateSubmitRequestFactory `
    -Url $url `
    -ArtifactConfigurationId $artifactConfigurationId `
    -SigningPolicyId $signingPolicyId `
    -ProjectSlug $projectSlug `
    -ArtifactConfigurationSlug $artifactConfigurationSlug `
    -SigningPolicySlug $signingPolicySlug `
    -Description $description `
    -Origin $origin `
    -Parameters $parameters `
    -AddAdditionalContent {
      Param ($content, $addHashTableToHttpContent)

      $content.Add((New-Object System.Net.Http.StringContent $artifactRetrievalLink), "ArtifactRetrievalLink.Url")
      Write-Verbose "ArtifactRetrievalLink: $artifactRetrievalLink"

      $content.Add((New-Object System.Net.Http.StringContent $artifactRetrievalLinkFileName), "ArtifactRetrievalLink.FileName")
      Write-Verbose "ArtifactRetrievalLinkFileName: $artifactRetrievalLinkFileName"

      $content.Add((New-Object System.Net.Http.StringContent $artifactRetrievalLinkSha256Hash), "ArtifactRetrievalLink.Sha256Hash")
      Write-Verbose "ArtifactRetrievalLinkSha256Hash: $artifactRetrievalLinkSha256Hash"

      if ($artifactRetrievalLinkHttpHeaders) {
        & $addHashTableToHttpContent $content $artifactRetrievalLinkHttpHeaders "ArtifactRetrievalLink.HttpHeaders"
      }
    }
}

function CreateSubmitRequestFactory (
  [string] $url,
  [string] $artifactConfigurationId,
  [string] $signingPolicyId,
  [string] $projectSlug,
  [string] $artifactConfigurationSlug,
  [string] $signingPolicySlug,
  [string] $description,
  [Hashtable] $origin,
  [Hashtable] $parameters,
  [ScriptBlock] $addAdditionalContent) {
  $local:IsVerboseEnabled = $null -ne $PSCmdlet.MyInvocation.BoundParameters["Verbose"] -and $PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent

  return {
    function AddHashTableToHttpContent ($content, $hashtable, $baseKey) {
      function AddToHttpContent ($content, $baseKey, $key, $value) {
        # All parameters ending in "File" are interpreted as streams
        if ( $key.ToLower().EndsWith("file")) {
          if ( $value.StartsWith("@")) {
            $filePath = $value.Substring(1)
            $packageFileStream = New-Object System.IO.FileStream ($filePath, [System.IO.FileMode]::Open)
            $streamContent = New-Object System.Net.Http.StreamContent $packageFileStream
            # PLANNED SIGN-988 This shouldn't be needed anymore
            $streamContent.Headers.ContentType = New-Object System.Net.Http.Headers.MediaTypeHeaderValue "application/octet-stream"
            $fileName = [System.IO.Path]::GetFileName($filePath)
            $content.Add($streamContent, "$baseKey.$key", $fileName)
            Write-Verbose "Adding file content to origin: $baseKey.$key = $fileName"
          } else {
            # IDEA: We will later on support non-file parameter values here too, for now we throw
            throw "*File origin parameters must start with @ to indicate a file path"
          }
        } else {
          $stringContent = New-Object System.Net.Http.StringContent $value
          $content.Add($stringContent, "$baseKey.$key")
          Write-Verbose "Add normal content to origin: $baseKey.$key = $value"
        }
      }

      Write-Verbose "Recursive add base key: $baseKey"
      foreach ($kvp in $hashtable.GetEnumerator()) {
        if ($kvp.Value.GetType().Name -eq "Hashtable") {
          Write-Verbose "$($kvp.Key) is a Hashtable, enter next recursion level"
          AddHashTableToHttpContent $content $kvp.Value "$baseKey.$($kvp.Key)"
        }
        else {
          AddToHttpContent $content $baseKey $kvp.Key $kvp.Value
        }
      }
    }

    if ($IsVerboseEnabled) {
      $VerbosePreference = "Continue"
    }

    $content = New-Object System.Net.Http.MultipartFormDataContent

    try {
      if ($artifactConfigurationId) {
        Write-Verbose "ArtifactConfigurationId: $artifactConfigurationId"
        $artifactConfigurationIdContent = New-Object System.Net.Http.StringContent $artifactConfigurationId
        $content.Add($artifactConfigurationIdContent, "ArtifactConfigurationId")
      }

      if ($signingPolicyId) {
        Write-Verbose "SigningPolicyId: $signingPolicyId"
        $signingPolicyIdContent = New-Object System.Net.Http.StringContent $signingPolicyId
        $content.Add($signingPolicyIdContent, "SigningPolicyId")
      }

      if ($projectSlug) {
        Write-Verbose "ProjectSlug: $projectSlug"
        $projectSlugContent = New-Object System.Net.Http.StringContent $projectSlug
        $content.Add($projectSlugContent, "ProjectSlug")
      }

      if ($artifactConfigurationSlug) {
        Write-Verbose "ArtifactConfigurationSlug: $artifactConfigurationSlug"
        $artifactConfigurationSlugContent = New-Object System.Net.Http.StringContent $artifactConfigurationSlug
        $content.Add($artifactConfigurationSlugContent, "ArtifactConfigurationSlug")
      }

      if ($signingPolicySlug) {
        Write-Verbose "SigningPolicySlug: $signingPolicySlug"
        $signingPolicySlugContent = New-Object System.Net.Http.StringContent $signingPolicySlug
        $content.Add($signingPolicySlugContent, "SigningPolicySlug")
      }

      Write-Verbose "Description: $description"
      $descriptionContent = New-Object System.Net.Http.StringContent $description
      $content.Add($descriptionContent, "Description")

      $addHashTableToHttpContent = Get-Item Function:/AddHashTableToHttpContent

      . $addAdditionalContent $content $addHashTableToHttpContent

      if ($origin) {
        Write-Verbose "Adding all origin parameters..."
        AddHashTableToHttpContent $content $origin "Origin"
      }

      if ($parameters) {
        Write-Verbose "Adding all signing request parameters..."
        AddHashTableToHttpContent $content $parameters "Parameters"
      }

      $request = New-Object System.Net.Http.HttpRequestMessage Post, $url
      $request.Content = $content

      Write-Verbose "Request URL: $url"
      return $request
      # Only dispose the content in case of exceptions, otherwise the caller is responsible for disposing the whole request after it has been performed.
    } catch {
      $content.Dispose()
      throw
    }
  }.GetNewClosure()
}

function CreateResubmitRequestFactory (
  [string] $url,
  [string] $originalSigningRequestId,
  [string] $signingPolicySlug,
  [string] $description
) {
  $local:IsVerboseEnabled = $null -ne $PSCmdlet.MyInvocation.BoundParameters["Verbose"] -and $PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent

  return {
    if ($IsVerboseEnabled) {
      $VerbosePreference = "Continue"
    }

    $content = New-Object System.Net.Http.MultipartFormDataContent

    try {

      Write-Verbose "OriginalSigningRequestId: $originalSigningRequestId"
      $originalSigningRequestIdContent = New-Object System.Net.Http.StringContent $originalSigningRequestId
      $content.Add($originalSigningRequestIdContent, "OriginalSigningRequestId")

      Write-Verbose "SigningPolicySlug: $signingPolicySlug"
      $signingPolicySlugContent = New-Object System.Net.Http.StringContent $signingPolicySlug
      $content.Add($signingPolicySlugContent, "SigningPolicySlug")

      Write-Verbose "Description: $description"
      $descriptionContent = New-Object System.Net.Http.StringContent $description
      $content.Add($descriptionContent, "Description")

      $request = New-Object System.Net.Http.HttpRequestMessage Post, $url
      $request.Content = $content

      Write-Verbose "Request URL: $url"
      return $request
      # Only dispose the content in case of exceptions, otherwise the caller is responsible for disposing the whole request after it has been performed.
    } catch {
      $content.Dispose()
      throw
    }
  }.GetNewClosure()
}

function GetWithRetry ([System.Net.Http.HttpClient] $httpClient, [string] $url, [int] $serviceUnavailableRetryTimeoutInSeconds) {
  $response = SendWithRetry `
    -HttpClient $httpClient `
    -RequestFactory { New-Object System.Net.Http.HttpRequestMessage Get, $url }.GetNewClosure() `
    -ServiceUnavailableRetryTimeoutInSeconds $serviceUnavailableRetryTimeoutInSeconds
  return $response
}

function SendWithRetry (
  [System.Net.Http.HttpClient] $httpClient,
  [ScriptBlock] $requestFactory,
  [int] $serviceUnavailableRetryTimeoutInSeconds) {

  $sw = [System.Diagnostics.Stopwatch]::StartNew()
  $retry = 0

  while ($true) {
    $retryReason = $null

    if ($retry -gt 0) {
      Write-Host "Retry $retry..."
    }

    $request = $null
    try {
      Write-Verbose "Generating request..."
      $request = & $requestFactory

      Write-Verbose "HttpClient timeout: $($httpClient.Timeout)"
      Write-Verbose "Sending request..."
      $response = $httpClient.SendAsync($request, [System.Net.Http.HttpCompletionOption]::ResponseHeadersRead).GetAwaiter().GetResult()

      Write-Verbose "Response status code: $($response.StatusCode)"
      if (503 -eq $response.StatusCode) {
        $retryReason = "SignPath REST API is temporarily unavailable. Please try again in a few moments."
      } elseif(500 -le $response.StatusCode -and 600 -gt $response.StatusCode) {
        $retryReason = "SignPath REST API returned an unexpected status code ($($response.StatusCode))"
      } else {
        return $response
      }
    } catch [System.Net.Http.HttpRequestException] {
      Write-Verbose "Request failed with HttpRequestException"
      $retryReason = $_
      Write-Host "URL: " $request.RequestUri
      Write-Host "EXCEPTION: " $_.Exception
    } catch [System.Threading.Tasks.TaskCanceledException] {
      Write-Verbose "Request failed with TaskCanceledException"
      $retryReason = "SignPath REST API answer time exceeded the timeout ($($HttpClient.Timeout))"
      Write-Host "URL: " $request.RequestUri
      Write-Host "EXCEPTION: " $_.Exception
    } finally {
      Write-Verbose "Disposing request"
      if ($null -ne $request) {
        $request.Dispose()
      }
    }

    Write-Verbose "Retry reason: $retryReason"

    if (($sw.Elapsed.TotalSeconds + $serviceUnavailableRetryTimeoutInSeconds) -lt $ServiceUnavailableTimeoutInSeconds) {
      Write-Host "SignPath REST API call failed. Retrying in ${serviceUnavailableRetryTimeoutInSeconds}s..."
      Start-Sleep -Seconds $serviceUnavailableRetryTimeoutInSeconds
    } else {
      Write-Host "SignPath REST API could not be called successfully in $($retry + 1) tries. Aborting"
      throw $retryReason
    }

    $retry++
  }
}

function DownloadArtifact (
  [System.Net.Http.HttpClient] $httpClient,
  [string] $url,
  [string] $path,
  [int] $serviceUnavailableRetryTimeoutInSeconds) {

  $downloadResponse = $null
  $streamToWriteTo = $null
  try {
    Write-Host "Downloading signed artifact..."
    $downloadResponse = GetWithRetry `
      -HttpClient $httpClient `
      -Url $url `
      -ServiceUnavailableRetryTimeoutInSeconds $serviceUnavailableRetryTimeoutInSeconds
    CheckResponse $downloadResponse

    $pathWithoutFile = [System.IO.Path]::GetDirectoryName($path)
    [System.IO.Directory]::CreateDirectory($pathWithoutFile) | Out-Null

    $stream = $downloadResponse.Content.ReadAsStreamAsync().GetAwaiter().GetResult()
    $streamToWriteTo = [System.IO.File]::Open($path, 'Create')
    $stream.CopyToAsync($streamToWriteTo).GetAwaiter().GetResult() | Out-Null
    Write-Host "Downloaded signed artifact and saved at '$path'"
  } finally {
    if ((Test-Path variable:downloadResponse) -and $null -ne $downloadResponse) {
      $downloadResponse.Dispose()
    }

    if ((Test-Path variable:stream) -and $null -ne $stream) {
      $stream.Dispose()
    }

    if ((Test-Path variable:streamToWriteTo) -and $null -ne $streamToWriteTo) {
      $streamToWriteTo.Dispose()
    }
  }
}

function WaitForCompletionAndRetrieveSignedArtifactDownloadLink (
  [System.Net.Http.HttpClient] $httpClient,
  [string] $url,
  [int] $waitForCompletionTimeoutInSeconds,
  [int] $waitForCompletionRetryTimeoutInSeconds,
  [int] $serviceUnavailableRetryTimeoutInSeconds) {

  $StatusComplete = "Completed"
  $StatusFailed = "Failed"
  $StatusDenied = "Denied"
  $StatusCanceled = "Canceled"
  $WorkflowStatusArtifactRetrievalFailed = "ArtifactRetrievalFailed"

  $getResponse = $null
  try {
    $resultJson = $null
    $status = $null
    $sw = [System.Diagnostics.Stopwatch]::StartNew()
    do {
      Write-Host "Checking status... " -NoNewline

      $getResponse = GetWithRetry -HttpClient $httpClient -Url $url -ServiceUnavailableRetryTimeoutInSeconds $serviceUnavailableRetryTimeoutInSeconds

      CheckResponse $getResponse
      $resultJson = $getResponse.Content.ReadAsStringAsync().GetAwaiter().GetResult() | ConvertFrom-Json
      $status = $resultJson.status
      $workflowStatus = $resultJson.workflowStatus
      Write-Host $status

      if ($resultJson.isFinalStatus) {
        break
      }

      Write-Verbose "Waiting for $waitForCompletionRetryTimeoutInSeconds seconds until checking again..."
      Start-Sleep -Seconds $waitForCompletionRetryTimeoutInSeconds
    } while ($sw.Elapsed.TotalSeconds -lt $waitForCompletionTimeoutInSeconds)

    $timeoutExpired = $sw.Elapsed.TotalSeconds -ge $waitForCompletionTimeoutInSeconds
    if ($status -ne $StatusComplete) {
      if ($status -eq $StatusDenied) {
        throw "Terminating because signing request was denied"
      } elseif ($status -eq $StatusCanceled) {
        throw "Terminating because signing request was canceled"
      } elseif ($workflowStatus -eq $WorkflowStatusArtifactRetrievalFailed) {
        throw "Terminating because artifact retrieval failed"
      } elseif ($status -eq $StatusFailed) {
        throw "Terminating because signing request failed"
      } elseif ($timeoutExpired) {
        throw "Timeout expired while waiting for signing request to complete"
      } else {
        throw "Terminating because of unexpected signing request status: $status"
      }
    }

    if($resultJson.PSObject.Properties.Name -contains "signedArtifactLink") {
      return $resultJson.signedArtifactLink
    }

    throw "Downloading the signed artifact is not possible since the signing request's artifacts have been deleted."
  } finally {
    if ((Test-Path variable:getResponse) -and $null -ne $getResponse) {
      $getResponse.Dispose()
    }
  }
}

function CreateAndUseAuthorizedHttpClient ([string] $cIUserToken, [int] $timeout, [ScriptBlock] $scriptBlock, [System.Security.Cryptography.X509Certificates.X509Certificate2] $clientCertificate) {
  Add-Type -AssemblyName System.IO
  Add-Type -AssemblyName System.Net.Http

  $previousSecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol
  [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

  $httpClientHandler = New-Object System.Net.Http.HttpClientHandler
  if ($null -ne $clientCertificate) {
    if (-not $clientCertificate.HasPrivateKey) {
      throw "The given client certificate has not private key and therefore cannot be used as client certificate."
    }

    Write-Verbose "Adding HttpClient client certificate: $clientCertificate"
    $httpClientHandler.ClientCertificates.Add($clientCertificate) | Out-Null
  }

  $httpClient = New-Object System.Net.Http.HttpClient $httpClientHandler
  $httpClient.Timeout = [TimeSpan]::FromSeconds($timeout)
  $httpClient.DefaultRequestHeaders.Authorization = New-Object System.Net.Http.Headers.AuthenticationHeaderValue @("Bearer", $cIUserToken)

  try {
    & $scriptBlock $httpClient
  } finally {
    if ($null -ne $httpClient) {
      $httpClient.Dispose()
    }
    [System.Net.ServicePointManager]::SecurityProtocol = $previousSecurityProtocol
  }
}

function PrepareInputArtifactPath ([string] $inputArtifactPath) {
  $inputArtifactPath = NormalizePath $inputArtifactPath

  if (-not (Test-Path -Path $inputArtifactPath)) {
    throw "The input artifact path '$inputArtifactPath' does not exist"
  }
  return $inputArtifactPath
}

function PrepareOutputArtifactPath ([bool] $force, [string] $outputArtifactPath) {
  $outputArtifactPath = NormalizePath $outputArtifactPath

  if (-not $force -and (Test-Path -Path $outputArtifactPath)) {
    throw "There is already a file at '$outputArtifactPath'. If you want to overwrite it use the -Force switch"
  }
  return $outputArtifactPath
}

function NormalizePath ([string] $path) {
  if (-not [System.IO.Path]::IsPathRooted($path)) {
    return Join-Path $PWD $path
  }
  return $path
}

function CheckResponse ([System.Net.Http.HttpResponseMessage] $response) {
  Write-Verbose "Checking response: $response"
  if (-not $response.IsSuccessStatusCode) {
    Write-Verbose "No success response."
    $responseBody = $response.Content.ReadAsStringAsync().GetAwaiter().GetResult()

    $additionalReason = ""
    if (401 -eq $response.StatusCode) {
      $additionalReason = " Did you provide the correct CIUserToken?"
    }
    elseif(403 -eq $response.StatusCode -and -not $responseBody.Contains("feature is disabled")) {
      $additionalReason = " Did you add the CI user to the list of submitters in the specified signing policy? Did you provide the correct OrganizationId? In case you are using a trusted build system, did you link it to the specified project?"
    }

    $serverMessage = ""
    if ($responseBody -ne "") {
      $serverMessage = " (Server reported the following message: '" + $responseBody + "')"
    }

    $errorMessage = "Error {0} {1}.{2}{3}" -f $response.StatusCode.value__, $response.ReasonPhrase, $additionalReason, $serverMessage

    throw [System.Net.Http.HttpRequestException]$errorMessage
  }
}

Export-ModuleMember Submit-SigningRequest
Export-ModuleMember Get-SignedArtifact
# SIG # Begin signature block
# MIIvZAYJKoZIhvcNAQcCoIIvVTCCL1ECAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDypN9yOPSJPBdF
# e3JC42Y+JuJ6l409hPNsz0Sb6geYAqCCFDMwggWQMIIDeKADAgECAhAFmxtXno4h
# MuI5B72nd3VcMA0GCSqGSIb3DQEBDAUAMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQK
# EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNV
# BAMTGERpZ2lDZXJ0IFRydXN0ZWQgUm9vdCBHNDAeFw0xMzA4MDExMjAwMDB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