Skip to content

Commit

Permalink
sha256 check
Browse files Browse the repository at this point in the history
  • Loading branch information
le0pard committed Jun 27, 2019
1 parent d72b05f commit cfab032
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions aws/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ func (awsc *AWSConnection) DownloadFiles(bucket, certsKey, outDirectory, outName

certFilename := fmt.Sprintf("%s/%s.crt", outDirectory, outName)

if _, err := os.Stat(certFilename); !os.IsNotExist(err) {

if s3FileSha256 != "" {
if s3FileSha256 != "" {
if _, err := os.Stat(certFilename); !os.IsNotExist(err) {
crtShaSumCheckKey, err := os.Open(certFilename)
if err != nil {
log.Errorf("Unable to open file %v", err)
Expand All @@ -77,7 +76,7 @@ func (awsc *AWSConnection) DownloadFiles(bucket, certsKey, outDirectory, outName

hash := sha256.New()
if _, err := io.Copy(hash, crtShaSumCheckKey); err != nil {
log.Errorf("Unable to calculate file md5 %v", err)
log.Errorf("Unable to calculate file sha256 %v", err)
return false
}
//Convert the bytes to a string
Expand Down

0 comments on commit cfab032

Please sign in to comment.