0

As art.exe (the artifactory CLI interface) hangs whenever I call it from my build script, I am rewriting the bash script from their page on the topic in powershell 2.0. I'm using this code to generate my checksum:

$sha1 = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider
$path = Resolve-Path "CatVideos.zip"
$bytes = [System.IO.File]::ReadAllBytes($path.Path)
$sha1.ComputeHash($bytes) | foreach { $hash = $hash + $_.ToString("X2") }

$wc=new-object System.Net.WebClient
$wc.Credentials= new-object System.Net.NetworkCredential("svnintegration","orange#5")
$wc.Headers.Add("X-Checksum-Deploy", "true")
$wc.Headers.Add("X-Checksum-Sha1", $hash)

The problem is it consistently produces a different checksum on my local than artifactory generates. It's not a 'corruption during transmission' error because I'm generating the checksum on my local and I've manually deployed several times.

How can I generate a checksum in the same manner as artifactory (2.6.5) so our checksums will match when I send mine and the deploy won't fail? Am I doing something obviously wrong when generating my checksum?

Thanks!

sirdank
  • 3,351
  • 3
  • 25
  • 58

1 Answers1

0

You have to use

$wc.Headers.Add("X-Checksum-Sha1", $hash.ToLower())
Andy
  • 49,085
  • 60
  • 166
  • 233
sirdank
  • 3,351
  • 3
  • 25
  • 58