内容-MD5为AWS S3签名UploadPart部首

问题描述 投票:0回答:1

当使用AWS MultipartUpload上传部分,它如果我添加了MD5标头失败。谁能告诉我,如果我正确地计算校验?

现在,我只是用CryptoSwift,抓住这样说

data.md5().base64EncodedString()

当数据是什么,我在上传

Alamofire.upload(
  data, 
  to: presignedMultipartLink, 
  method: Alamofire.HTTPMethod.put, 
  headers: [
    "Content-Length": sizeOfPart, 
    "Content-MD5": data.md5().base64EncodedString()
  ])
  .uploadProgress{...}
  .response{...}

如果我拿出的Content-MD5头它作为期望。

XML响应是,让我怎么加MD5标头?

<Error><Code>AccessDenied</Code><Message>There were headers present in the request which were not signed</Message><HeadersNotSigned>content-md5</HeadersNotSigned><RequestId>requestid</RequestId><HostId>hostid</HostId></Error>
swift amazon-web-services amazon-s3 alamofire
1个回答
0
投票

我需要在getPresignedUrl呼叫作为参数去包括。否则不能包括在内。呸......那些日子之一。

© www.soinside.com 2019 - 2024. All rights reserved.