Beispiel #1
0
 public static function retrieveByProviderAndPartnerID($provider, $partnerId)
 {
     $c = new Criteria();
     $c->addAnd(DrmProfilePeer::PROVIDER, $provider, Criteria::EQUAL);
     $c->addAnd(DrmProfilePeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
     return DrmProfilePeer::doSelectOne($c);
 }
 /**
  * Signs the input and forwards license request to Widevine license server
  * @param $requestParams - original parameters
  * @param $overrideParamsStr - additional parameters passed on KS
  * @param $isAdmin - true/false, identifies if called with admin KS
  * @return byte sequence
  */
 public static function sendLicenseRequest($requestParams, $overrideParamsStr = null, $isAdmin = false)
 {
     self::validateRequest($requestParams);
     $ptime = time();
     $signInput = $requestParams[self::ASSETID] . $requestParams[self::CLIENTID] . $requestParams[self::MK] . $requestParams[self::MD] . $ptime;
     $dbDrmProfile = DrmProfilePeer::retrieveByProvider(WidevinePlugin::getWidevineProviderCoreValue());
     if ($dbDrmProfile) {
         $key = $dbDrmProfile->getKey();
         $iv = $dbDrmProfile->getIv();
         $baseUrl = $dbDrmProfile->getLicenseServerUrl();
         $portal = $dbDrmProfile->getPortal();
     } else {
         $key = WidevinePlugin::getWidevineConfigParam('key');
         $iv = WidevinePlugin::getWidevineConfigParam('iv');
         $baseUrl = WidevinePlugin::getWidevineConfigParam('license_server_url');
         $portal = WidevinePlugin::getWidevineConfigParam('portal');
     }
     KalturaLog::info("sign input: " . $signInput);
     $sign = self::createRequestSignature($signInput, $key, $iv);
     $requestParams[self::PTIME] = $ptime;
     $requestParams[self::SIGN] = $sign;
     $overrideParams = self::getLicenseOverrideParams($overrideParamsStr, $isAdmin);
     $requestParams = array_merge($requestParams, $overrideParams);
     if (!$baseUrl) {
         throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::LICENSE_SERVER_URL_NOT_SET);
     }
     if (!$portal) {
         $portal = WidevinePlugin::KALTURA_PROVIDER;
     }
     $requestParams[self::PORTAL] = $portal;
     $baseUrl .= '/' . $portal;
     return self::doCurl($baseUrl, $requestParams);
 }
Beispiel #3
0
 private function getSigningKey()
 {
     $dbProfile = DrmProfilePeer::retrieveByProviderAndPartnerID(KalturaDrmProviderType::CENC, kCurrentContext::getCurrentPartnerId());
     if (!is_null($dbProfile)) {
         $signingKey = $dbProfile->getSigningKey();
         return $signingKey;
     }
     return null;
 }
 private function getPartnerKeySeed()
 {
     $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     $profile = DrmProfilePeer::retrieveByProvider(PlayReadyPlugin::getPlayReadyProviderCoreValue());
     if (!$profile) {
         throw new KalturaAPIException(KalturaPlayReadyErrors::PLAYREADY_PROFILE_NOT_FOUND);
     }
     return $profile->getKeySeed();
 }
Beispiel #5
0
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return     Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(DrmProfilePeer::DATABASE_NAME);
     $criteria->add(DrmProfilePeer::ID, $this->id);
     if ($this->alreadyInSave) {
         if ($this->isColumnModified(DrmProfilePeer::CUSTOM_DATA)) {
             if (!is_null($this->custom_data_md5)) {
                 $criteria->add(DrmProfilePeer::CUSTOM_DATA, "MD5(cast(" . DrmProfilePeer::CUSTOM_DATA . " as char character set latin1)) = '{$this->custom_data_md5}'", Criteria::CUSTOM);
             } else {
                 $criteria->add(DrmProfilePeer::CUSTOM_DATA, NULL, Criteria::ISNULL);
             }
         }
         if (count($this->modifiedColumns) == 2 && $this->isColumnModified(DrmProfilePeer::UPDATED_AT)) {
             $theModifiedColumn = null;
             foreach ($this->modifiedColumns as $modifiedColumn) {
                 if ($modifiedColumn != DrmProfilePeer::UPDATED_AT) {
                     $theModifiedColumn = $modifiedColumn;
                 }
             }
             $atomicColumns = DrmProfilePeer::getAtomicColumns();
             if (in_array($theModifiedColumn, $atomicColumns)) {
                 $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
             }
         }
     }
     return $criteria;
 }
Beispiel #6
0
 /**
  * Retrieve a KalturaDrmProfile object by provider, if no specific profile defined return default profile
  * 
  * @action getByProvider
  * @param KalturaDrmProviderType $provider
  * @return KalturaDrmProfile
  */
 public function getByProviderAction($provider)
 {
     $drmProfile = KalturaDrmProfile::getInstanceByType($provider);
     $drmProfile->provider = $provider;
     $tmpDbProfile = $drmProfile->toObject();
     $dbDrmProfile = DrmProfilePeer::retrieveByProvider($tmpDbProfile->getProvider());
     if (!$dbDrmProfile) {
         if ($provider == KalturaDrmProviderType::CENC) {
             $dbDrmProfile = new DrmProfile();
         } else {
             $dbDrmProfile = KalturaPluginManager::loadObject('DrmProfile', $tmpDbProfile->getProvider());
         }
         $dbDrmProfile->setName('default');
         $dbDrmProfile->setProvider($tmpDbProfile->getProvider());
     }
     $drmProfile->fromObject($dbDrmProfile, $this->getResponseProfile());
     return $drmProfile;
 }
Beispiel #7
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(DrmProfilePeer::DATABASE_NAME);
         $criteria->add(DrmProfilePeer::ID, $pks, Criteria::IN);
         $objs = DrmProfilePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Beispiel #8
0
 public function getFieldNameFromPeer($field_name)
 {
     $res = DrmProfilePeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME);
     return $res;
 }