public function __construct($accessKey, $secretKey, $encryptionMaterials, $endpoint = NULL) { parent::__construct($accessKey, $secretKey, $endpoint); if (is_array($encryptionMaterials)) { if (count($encryptionMaterials) == 2) { $pk = openssl_pkey_get_public($encryptionMaterials[0]); $sk = openssl_pkey_get_private($encryptionMaterials[1]); if (!$pk) { throw new Ks3ClientException("invalid RSA public key,you can generate key use openssl"); } if (!$sk) { throw new Ks3ClientException("invalid RSA private key,you can generate key use openssl"); } $encryptionMaterials = array($pk, $sk); } else { throw new Ks3ClientException("encryptionMaterials should be string or an array of size 2"); } } $ks3client = new Ks3Client($accessKey, $secretKey, $endpoint); $this->encryptionMaterials = $encryptionMaterials; if (ENCRYPTPTION_MODE == "EO") { $this->encryptionHandler = new EncryptionEO($ks3client, $encryptionMaterials); } elseif (ENCRYPTPTION_MODE == "AE") { throw new Ks3ClientException("Authenticated encryption will be supported in the futher"); } else { throw new Ks3ClientException("unsupported encryption mode :" . ENCRYPTPTION_MODE); } if (ENCRYPTPTION_STORAGE_MODE != "ObjectMetadata" && ENCRYPTPTION_STORAGE_MODE != "InstructionFile") { throw new Ks3ClientException("unsupported encryption storage mode :" . ENCRYPTPTION_STORAGE_MODE); } }