function copyAnddeleteObject($client, $bucket, $keyprefix)
{
    $content = EncryptionUtil::genereateOnceUsedKey(rand(100, 1000));
    $args = array("Bucket" => $bucket, "Key" => $keyprefix . "EOFile", "ACL" => "public-read", "Content" => $content);
    $client->putObjectByContent($args);
    if ($client->objectExists(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy"))) {
        $client->deleteObject(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy"));
    }
    if ($client->objectExists(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy.instruction"))) {
        $client->deleteObject(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy.instruction"));
    }
    $copyReq = array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy", "CopySource" => array("Bucket" => $bucket, "Key" => $keyprefix . "EOFile"));
    $client->copyObject($copyReq);
    if (!$client->objectExists(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy"))) {
        throw new Exception("not found " . $keyprefix . "EOFileCopy");
    }
    if (!$client->objectExists(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy.instruction"))) {
        throw new Exception("not found " . $keyprefix . "EOFileCopy.instruction");
    }
    $client->deleteObject(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy"));
    if ($client->objectExists(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy"))) {
        throw new Exception("found " . $keyprefix . "EOFileCopy");
    }
    if ($client->objectExists(array("Bucket" => $bucket, "Key" => $keyprefix . "EOFileCopy.instruction"))) {
        throw new Exception("found " . $keyprefix . "EOFileCopy.instruction");
    }
}
function putObjectByContentAndGetObjectUsingMeta($client, $bucket, $keyprefix)
{
    for ($i = 45; $i < 60; $i++) {
        $content = EncryptionUtil::genereateOnceUsedKey($i);
        $args = array("Bucket" => $bucket, "Key" => $keyprefix . "EOMeta", "ACL" => "public-read", "Content" => $content);
        $client->putObjectByContent($args);
        rangeGetAndCheckMd5($client, $bucket, $keyprefix . "EOMeta", "D://testdown/down", base64_encode(md5($args["Content"])));
    }
}
$Reserve2 = "";
$Reserve3 = "";
$Reserve4 = "";
$Reserve5 = "";
$Reserve6 = "";
$Reserve7 = "";
$Reserve8 = "";
$Reserve9 = "";
$Reserve10 = "";
if ($_POST) {
    if ($_POST['DATA'] == null) {
        print "null is the value";
    }
    $astrResponseData = $_POST['DATA'];
    $astrDigest = $_POST['EncryptedData'];
    $oEncryptionUtilenc = new EncryptionUtil();
    $astrsfaDigest = $oEncryptionUtilenc->getHMAC($astrResponseData, $astrFileName, $strMerchantId);
    if (strcasecmp($astrDigest, $astrsfaDigest) == 0) {
        parse_str($astrResponseData, $output);
        if (array_key_exists('RespCode', $output) == 1) {
            $ResponseCode = $output['RespCode'];
        }
        if (array_key_exists('Message', $output) == 1) {
            $Message = $output['Message'];
        }
        if (array_key_exists('TxnID', $output) == 1) {
            $TxnID = $output['TxnID'];
        }
        if (array_key_exists('ePGTxnID', $output) == 1) {
            $ePGTxnID = $output['ePGTxnID'];
        }
 function postStatusInq($aoMerchant)
 {
     if ($this->verbose != null && trim($this->verbose) == "true") {
         error_log("PostLibPHP postStatusInq Entered", 0);
     }
     $oPGSearchResphp = new PGSearchResponse();
     # Mandetory checks for Merchant and Merchant object containing
     # checks for Merchant id  and and merchant transaction ID
     #
     #
     if ($aoMerchant == null || $aoMerchant == "") {
         if ($this->verbose != null && trim($this->verbose) == "true") {
             error_log("PostLibPHP postStatusInq Error. Merchant object passed is null or Invalid.Transaction cannot proceed.", 0);
         }
         $oPGSearchResphp->setRespCode("2");
         $oPGSearchResphp->setRespMessage("Merchant object passed is null or Invalid.Transaction cannot proceed.");
         return $oPGSearchResphp;
     }
     if ($aoMerchant->getMerchantID() == null || $aoMerchant->getMerchantID() == "") {
         if ($this->verbose != null && trim($this->verbose) == "true") {
             error_log("PostLibPHP postStatusInq Error. Merchant id is Invalid.Transaction cannot proceed.", 0);
         }
         $oPGSearchResphp->setRespCode("2");
         $oPGSearchResphp->setRespMessage("Merchant id is Invalid.Transaction cannot proceed.");
         return $oPGSearchResphp;
     }
     if ($aoMerchant->getMerchantTxnID() == null || $aoMerchant->getMerchantTxnID() == "") {
         if ($this->verbose != null && trim($this->verbose) == "true") {
             error_log("PostLibPHP postStatusInq Error. Merchant Transaction id is Invalid.Transaction cannot proceed.", 0);
         }
         $oPGSearchResphp->setRespCode("2");
         $oPGSearchResphp->setRespMessage("Merchant Transaction id is Invalid.Transaction cannot proceed.");
         return $oPGSearchResphp;
     }
     $strData = "";
     # Merchant details
     $strData = $strData . 'MerchantID=' . $aoMerchant->getMerchantID();
     $strData = $strData . '&MerchantTxnID=' . $aoMerchant->getMerchantTxnID();
     $oEncryptionUtilenc = new EncryptionUtil();
     $strEncryptedData = trim($aoMerchant->getMerchantID()) . trim($aoMerchant->getMerchantTxnID());
     $sDigest = $oEncryptionUtilenc->getHMAC($strEncryptedData, trim($this->mstrKeyDir) . $aoMerchant->getMerchantID() . '.key', $aoMerchant->getMerchantID());
     if ($sDigest == null || $sDigest == "") {
         if ($this->verbose != null && trim($this->verbose) == "true") {
             error_log("Error in Encrypting/Hashing Merchant Data.Transaction cannot proceed.", 0);
         }
         $oPGSearchResphp->setRespCode("2");
         $oPGSearchResphp->setRespMessage(" Error while encrypting/hashing data. Transaction cannot be processed.");
         return $oPGSearchResphp;
     }
     $strData = $strData . '&EncryptedData=' . $sDigest;
     $strData = $strData . '&IntfVer=ASPV2.0';
     $strData = $strData . '&OsType=' . trim($this->mstrOSType);
     $strData = $strData . '&LanguageType=php';
     $strData = $strData . '&RequestType=SFAStatusInquiry';
     $retData = $this->postData(trim($this->epgURL), trim($strData));
     # The function return PGResponse object of php Sfa.
     if ($retData == null || $retData == "") {
         $oPGSearchResphp->setRespCode("2");
         $oPGSearchResphp->setRespMessage(" No response From Payment Gateway or URL not Found");
         if ($this->verbose != null && trim($this->verbose) == "true") {
             error_log("PostLibPHP postStatusInq Exiting", 0);
         }
         return $oPGSearchResphp;
     } else {
         $oPGSearchResphp = $oPGSearchResphp->getResponse($retData);
         if ($this->verbose != null && trim($this->verbose) == "true") {
             error_log("PostLibPHP postStatusInq Exiting", 0);
         }
         return $oPGSearchResphp;
     }
 }
Exemplo n.º 5
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;
 }
 public function SFAResponseAction()
 {
     include "Sfa/EncryptionUtil.php";
     $config = Mage::getSingleton('payseal/config');
     $merchantId = trim($config->getMerchantId());
     $keyPath = str_replace("/", "//", $config->getKeyPath()) . $merchantId . ".key";
     $strMerchantId = $merchantId;
     $astrFileName = $keyPath;
     $astrClearData;
     $ResponseCode = "";
     $Message = "";
     $TxnID = "";
     $ePGTxnID = "";
     $AuthIdCode = "";
     $RRN = "";
     $CVRespCode = "";
     $session = Mage::getSingleton('checkout/session');
     $session->setData("redirected", "false");
     if ($_POST) {
         if ($_POST['DATA'] == null) {
             print "null is the value";
         }
         $astrResponseData = $_POST['DATA'];
         $astrDigest = $_POST['EncryptedData'];
         $oEncryptionUtilenc = new EncryptionUtil();
         $astrsfaDigest = $oEncryptionUtilenc->getHMAC($astrResponseData, $astrFileName, $strMerchantId);
         if (strcasecmp($astrDigest, $astrsfaDigest) == 0) {
             parse_str($astrResponseData, $output);
             if (array_key_exists('RespCode', $output) == 1) {
                 $ResponseCode = $output['RespCode'];
             }
             if (array_key_exists('Message', $output) == 1) {
                 $Message = $output['Message'];
             }
             if (array_key_exists('TxnID', $output) == 1) {
                 $TxnID = $output['TxnID'];
             }
             if (array_key_exists('ePGTxnID', $output) == 1) {
                 $ePGTxnID = $output['ePGTxnID'];
             }
             if (array_key_exists('AuthIdCode', $output) == 1) {
                 $AuthIdCode = $output['AuthIdCode'];
             }
             if (array_key_exists('RRN', $output) == 1) {
                 $RRN = $output['RRN'];
             }
             if (array_key_exists('CVRespCode', $output) == 1) {
                 $CVRespCode = $output['CVRespCode'];
             }
         }
     }
     $debug = Mage::getModel('payseal/api_debug')->load($TxnID, "transact_id");
     $debug->setResponseBody(print_r($output, 1));
     $debug->save();
     if ($output['RespCode'] == 2 && $Message == "No Suitable Acquirer Found" || $output['RespCode'] == 0) {
         $_order = new Mage_Sales_Model_Order();
         $orderId = $session->getLastRealOrderId();
         $_order->loadByIncrementId($orderId);
         $_order->sendNewOrderEmail();
         try {
             $payment = $_order->getPayment();
             $payment->setTransactionId($TxnID)->capture(null);
             $_order->setStatus('created');
             $_order->addStatusToHistory($_order->getStatus(), Mage::helper('payseal')->__('Customer successfully returned from payseal'));
             $_order->save();
         } catch (Exception $e) {
             Mage::logException($e);
             //if we couldn't capture order, just leave it as NEW order.
         }
         $session->getQuote()->setIsActive(false)->save();
         $this->_redirect('checkout/onepage/success', array('_secure' => true));
     } else {
         $this->_redirect('checkout/onepage/failure', array('_secure' => true));
     }
 }
Exemplo n.º 7
0
 function postAuth($aoMerchant, $aoCInfo, $aoPGResp, $oPSD, $aoReserveData)
 {
     $ojMerchant = new Merchant();
     $ojCInfo = new CardInfo();
     //$oPGResp = new Java('com.opus.epg.sfa.java.PGResponse');
     //$ojPSD = new Java('com.opus.epg.sfa.java.PaySecureDetails');
     $ojReserveData = new PGReserveData();
     $oPostLib = new PostLibPHP();
     $oPGResphp = new PGResponse();
     ## Mandetory checks for Merchant objects
     #  check for Merchant id and the Message type
     #
     ##
     if ($aoMerchant == null) {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Merchant object is null");
         return $oPGResphp;
     }
     if ($aoMerchant->getMerchantID() == null || $aoMerchant->getMerchantID() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Merchant id is null or Invalid");
         return $oPGResphp;
     }
     if ($aoMerchant->getMessageType() == null || $aoMerchant->getMessageType() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Message type is null.");
         return $oPGResphp;
     }
     if ($oPSD->getPaysecureResp() == null || $oPSD->getPaysecureResp() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Invalid Paysecure Response. Transaction cannot be processed.");
         return $oPGResphp;
     }
     if ($oPSD->getPaySecureTxnID() == null || $oPSD->getPaySecureTxnID() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Invalid PaySecure Txn Id. Transaction cannot be processed.");
         return $oPGResphp;
     }
     if ($oPSD->getAuthAmount() == null || $oPSD->getAuthAmount() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Error. Auth Amount is Invalid.");
         return $oPGResphp;
     }
     if ($oPSD->getCardAcceptorID() == null || $oPSD->getCardAcceptorID() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Error. Card Acceptor/Merchant Id is Invalid.");
         return $oPGResphp;
     }
     if ($oPSD->getCurrCode() == null || $oPSD->getCurrCode() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Invalid Currency code. Transaction cannot be processed.");
         return $oPGResphp;
     }
     #  Assigning Merchant object of php to Merchant object of java Sfa
     $ojMerchant->setMerchantDetails($aoMerchant->getMerchantID(), $aoMerchant->getVendor(), $aoMerchant->getPartner(), $aoMerchant->getCustIPAddress(), $aoMerchant->getMerchantTxnID(), $aoMerchant->getOrderReferenceNo(), $aoMerchant->getRespURL(), $aoMerchant->getRespMethod(), $aoMerchant->getCurrCode(), $aoMerchant->getInvoiceNo(), $aoMerchant->getMessageType(), $aoMerchant->getAmount(), $aoMerchant->getGMTTimeOffset(), $aoMerchant->getExt1(), $aoMerchant->getExt2(), $aoMerchant->getExt3(), $aoMerchant->getExt4(), $aoMerchant->getExt5());
     #   Assigning Card Info object of php to Card info object of java Sfa
     if ($aoCInfo != null || $aoCInfo != "") {
         $ojCInfo->setCardDetails($aoCInfo->getCardType(), $aoCInfo->getCardNum(), $aoCInfo->getCVVNum(), $aoCInfo->getExpDtYr(), $aoCInfo->getExpDtMon(), $aoCInfo->getNameOnCard(), $aoCInfo->getInstrType());
     }
     if ($aoReserveData != null || $aoReserveData != "") {
         $ojReserveData->setReserveObj($aoReserveData->getReserveField1(), $aoReserveData->getReserveField2(), $aoReserveData->getReserveField3(), $aoReserveData->getReserveField4(), $aoReserveData->getReserveField5(), $aoReserveData->getReserveField6(), $aoReserveData->getReserveField7(), $aoReserveData->getReserveField8(), $aoReserveData->getReserveField9(), $aoReserveData->getReserveField10());
     }
     $strData = $this->buildMerchantBillShip($aoMerchant, null, null);
     $oEncryptionUtilenc = new EncryptionUtil();
     $strMotoEncryptedData = $aoMerchant->getMerchantID() . trim($aoMerchant->getMerchantTxnID()) . trim($aoMerchant->getCustIPAddress()) . trim($aoMerchant->getAmount()) . trim($aoMerchant->getMessageType()) . trim($aoMerchant->getCurrCode()) . trim($aoMerchant->getInvoiceNo()) . trim($aoCInfo->getCardNum()) . trim($aoCInfo->getExpDtYr()) . trim($aoCInfo->getExpDtMon()) . $aoCInfo->getCVVNum();
     $sDigest = $oEncryptionUtilenc->getHMAC($strMotoEncryptedData, trim($this->mstrKeyDir) . $aoMerchant->getMerchantID() . '.key', $aoMerchant->getMerchantID());
     if ($sDigest == null || $sDigest == "") {
         if ($this->verbose != null && trim($this->verbose) == "true") {
             error_log("Error in Encrypting/Hashing Merchant Data.Transaction cannot proceed.", 0);
         }
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Error while encrypting/hashing data. Transaction cannot be processed.");
         return $oPGResphp;
     }
     $strData = $strData . '&EncryptedData=' . $sDigest;
     $strData = $strData . '&IntfVer=ASPV2.0';
     $strData = $strData . '&OsType=' . trim($this->mstrOSType);
     $strData = $strData . '&LanguageType=php';
     $strData = $strData . '&CustIPAddress=' . $aoMerchant->getCustIPAddress();
     $strData = $strData . '&InstrType=' . $aoCInfo->getInstrType();
     $strData = $strData . '&CardType=' . $aoCInfo->getCardType();
     $strData = $strData . '&CardNum=' . $aoCInfo->getCardNum();
     $strData = $strData . '&ExpDtYr=' . $aoCInfo->getExpDtYr();
     $strData = $strData . '&ExpDtMon=' . $aoCInfo->getExpDtMon();
     $strData = $strData . '&CVVNum=' . $aoCInfo->getCVVNum();
     $strData = $strData . '&NameOnCard=' . $aoCInfo->getNameOnCard();
     if ($aoMPI == null || $aoMPI == "") {
         $strData = $strData . '&status=""';
         $strData = $strData . '&cavv=""';
         $strData = $strData . '&eci=""';
         $strData = $strData . '&xid=""';
         $strData = $strData . '&purchaseAmount=""';
         $strData = $strData . '&currencyVal=""';
         $strData = $strData . '&shoppingcontext=""';
     } else {
         $strData = $strData . '&status=' . $aoMPI->getVBVStatus();
         $strData = $strData . '&cavv=' . $aoMPI->getCAVV();
         $strData = $strData . '&eci=' . $aoMPI->getECI();
         $strData = $strData . '&xid=' . $aoMPI->getXID();
         $strData = $strData . '&purchaseAmount=' . $aoMPI->getPurchaseAmount();
         $strData = $strData . '&currencyVal=' . $aoMPI->getCurrencyVal();
         $strData = $strData . '&shoppingcontext=' . $aoMPI->getShoppingContext();
     }
     $strData = $strData . '&Reserve1=' . $aoReserveData->getReserveField1();
     $strData = $strData . '&Reserve2=' . $aoReserveData->getReserveField2();
     $strData = $strData . '&Reserve3=' . $aoReserveData->getReserveField3();
     $strData = $strData . '&Reserve4=' . $aoReserveData->getReserveField4();
     $strData = $strData . '&Reserve5=' . $aoReserveData->getReserveField5();
     $strData = $strData . '&Reserve6=' . $aoReserveData->getReserveField6();
     $strData = $strData . '&Reserve7=' . $aoReserveData->getReserveField7();
     $strData = $strData . '&Reserve8=' . $aoReserveData->getReserveField8();
     $strData = $strData . '&Reserve9=' . $aoReserveData->getReserveField9();
     $strData = $strData . '&Reserve10=' . $aoReserveData->getReserveField10();
     $strData = $strData . '&WsErrCode=' . $aoReserveData->getWsErrCode();
     $strData = $strData . '&WsErrMsg=' . $aoReserveData->getWsErrMsg();
     $strData = $strData . '&WsExponent=' . $aoReserveData->getWsExponent();
     $strData = $strData . '&WsGuid=' . $aoReserveData->getWsGuid();
     $strData = $strData . '&WsModulus=' . $aoReserveData->getWsModulus();
     $strData = $strData . '&WsTxnId=' . $aoReserveData->getWsTxnId();
     $oPGResp = $this->postData(trim($this->motoURL), trim($ojReserveData));
     # Assigning PGResponse objects of java to PGResponse object of php
     $oPGResphp->setRespCode($oPGResp->getRespCode());
     $oPGResphp->setRespMessage($oPGResp->getRespMessage());
     $oPGResphp->setTxnId($oPGResp->getTxnId());
     $oPGResphp->setEpgTxnId($oPGResp->getEpgTxnId());
     $oPGResphp->setAuthIdCode($oPGResp->getAuthIdCode());
     $oPGResphp->setRRN($oPGResp->getRRN());
     $oPGResphp->setCVRespCode($oPGResp->getCVRespCode());
     $oPGResphp->setReserveFld1($oPGResp->getReserveFld1());
     $oPGResphp->setReserveFld2($oPGResp->getReserveFld2());
     $oPGResphp->setReserveFld3($oPGResp->getReserveFld3());
     $oPGResphp->setReserveFld4($oPGResp->getReserveFld4());
     $oPGResphp->setReserveFld5($oPGResp->getReserveFld5());
     $oPGResphp->setReserveFld6($oPGResp->getReserveFld6());
     $oPGResphp->setReserveFld7($oPGResp->getReserveFld7());
     $oPGResphp->setReserveFld8($oPGResp->getReserveFld8());
     $oPGResphp->setReserveFld9($oPGResp->getReserveFld9());
     $oPGResphp->setReserveFld10($oPGResp->getReserveFld10());
     # Returning PGResponse object of php
     return $oPGResphp;
 }
Exemplo n.º 8
0
 public function testPutObjectByContentAndGetObject()
 {
     @unlink($this->cachedir . "down");
     $content = EncryptionUtil::genereateOnceUsedKey(500);
     $args = array("Bucket" => $this->bucket, "Key" => $this->key, "ACL" => "public-read", "Content" => $content);
     $this->encryptionClient->putObjectByContent($args);
     $start = (int) rand(0, 520);
     $end = (int) rand($start, 520);
     $s3Object = $this->encryptionClient->getObject(array("Bucket" => $this->bucket, "Key" => $this->key, "Range" => "bytes=" . $start . "-" . $end));
     $this->assertEquals(substr($content, $start, $end - $start + 1), $s3Object["Content"]);
 }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
0
 public function streaming_read_callback($curl_handle, $file_handle, $length, $read_stream, $seek_position)
 {
     // Once we've sent as much as we're supposed to send...
     if ($this->hasread >= $this->contentLength) {
         // Send EOF
         return '';
     }
     // If we're at the beginning of an upload and need to seek...
     if ($this->hasread == 0 && $seek_position > 0 && $seek_position !== ftell($read_stream)) {
         if (fseek($read_stream, $seek_position) !== 0) {
             throw new RequestCore_Exception('The stream does not support seeking and is either not at the requested position or the position is unknown.');
         }
     }
     $blocksize = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
     $needRead = min($this->contentLength - $this->hasread, $length);
     $read = fread($read_stream, $needRead);
     $this->hasread += strlen($read);
     $isLast = FALSE;
     if ($this->hasread >= $this->contentLength) {
         $isLast = TRUE;
     }
     $data = $this->buffer . $read;
     $dataLength = strlen($data);
     if (!$isLast) {
         $this->buffer = substr($data, $dataLength - $dataLength % $blocksize);
         $data = substr($data, 0, $dataLength - $dataLength % $blocksize);
     } else {
         //分块上传除最后一块外肯定是blocksize大小的倍数,所以不需要填充。
         if ($this->mutipartUpload) {
             if ($this->isLastPart) {
                 $this->buffer = NULL;
                 $data = EncryptionUtil::PKCS5Padding($data, $blocksize);
             } else {
                 //donothing
             }
         } else {
             $this->buffer = NULL;
             $data = EncryptionUtil::PKCS5Padding($data, $blocksize);
         }
     }
     $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
     mcrypt_generic_init($td, $this->cek, $this->iv);
     $encrypted = mcrypt_generic($td, $data);
     mcrypt_generic_deinit($td);
     //去除自动填充的16个字节//php的当恰好为16的倍数时竟然不填充?
     //$encrypted = substr($encrypted,0,strlen($encrypted)-$blocksize);
     //取最后一个block作为下一次的iv
     $this->iv = substr($encrypted, strlen($encrypted) - $blocksize);
     return $encrypted;
 }