示例#1
0
 public function completeMultipartUploadSecurely($args = array())
 {
     $uploadId = $args["Options"]["uploadId"];
     $exists = EncryptionUtil::multipartUploadContextExists($uploadId);
     if (!$exists) {
         throw new Ks3ClientException("no such upload in cache/encryption/");
     }
     $context = EncryptionUtil::getMultipartUploadContext($uploadId);
     if (!$context["lastPart"]) {
         throw new Ks3ClientException("Unable to complete an encrypted multipart upload without being told which part was the last. when upload part you can add item in args like args[\"LastPart\"]=TRUE");
     }
     $result = $this->ks3client->completeMultipartUpload($args);
     if (ENCRYPTPTION_STORAGE_MODE == "InstructionFile") {
         $req = EncryptionUtil::createInstructionFile($args["Bucket"], $args["Key"], $context["encryptedCek"], $context["firstIv"], $context["matdesc"]);
         $this->ks3client->putObjectByContent($req);
     }
     EncryptionUtil::deleteMultipartUploadContext($uploadId);
     return $result;
 }