Esempio n. 1
0
 public static function getMultipartUploadContext($UploadId)
 {
     $encryptionDir = KS3_API_PATH . DIRECTORY_SEPARATOR . "cache" . DIRECTORY_SEPARATOR . "encryption" . DIRECTORY_SEPARATOR;
     if (!EncryptionUtil::multipartUploadContextExists($UploadId)) {
         throw new Ks3ClientException("can not found multipart upload context in cache dir");
     }
     $jsonString = file_get_contents($encryptionDir . $UploadId);
     $arry = json_decode($jsonString, TRUE);
     return $arry;
 }
Esempio n. 2
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;
 }