Function setCpPrivateKey

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 2018-12-05 10:21

@param string $cpPrivateKey

@return $this|\nguyenanhung\VnTelcoPhoneNumberDetect\Telcos\ViettelMps\ViettelMpsInterface
163877
public function setCpPrivateKey($cpPrivateKey = '')
    {
        $this->cpPrivateKey = $cpPrivateKey;
        $this->debug->info(__FUNCTION__, 'setCpPrivateKey: ' . json_encode($this->cpPrivateKey));

        return $this;
    }
685446
public function setKeyEncrypt($keyEncrypt = '')
    {
        $this->keyEncrypt = $keyEncrypt;
        $this->debug->debug(__FUNCTION__, 'setKeyEncrypt: ' . json_encode($this->keyEncrypt));

        return $this;
    }
588135
public function filterByPrimaryKey($key)
    {
        $this->addUsingAlias(RolePermissionTableMap::COL_ROLE_ID, $key[0], Criteria::EQUAL);
        $this->addUsingAlias(RolePermissionTableMap::COL_PERMISSION_ID, $key[1], Criteria::EQUAL);

        return $this;
    }
1255056
public function encryptByPrivateKey_data($data, $privatekey = '')
	{
		$RSACrypt = new RSACrypt();

		if ($privatekey != "") {
			$RSACrypt->privkey = $privatekey;
		}
		$crypt_res = "";
		for ($i = 0; $i < ((strlen($data) - strlen($data) % 117) / 117 + 1); $i++) {
			$crypt_res = $crypt_res . ($RSACrypt->encryptByPrivateKey(mb_strcut($data, $i * 117, 117, 'utf-8')));
		}
		return $crypt_res;
	}
789468
public function setKey()
    {
        $path = $this->path . "/.cache_key";
        $key = bin2hex(openssl_random_pseudo_bytes(6));
        $umask = umask($this->umask);
        file_put_contents($path, $key);
        umask($umask);
        return $key;
    }
817041
function setKey($key)
    {
        $this->key = $key;

        if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) {
            return;
        }

        $keyLength = strlen($key);
        $keyStream = array();
        for ($i = 0; $i < 256; $i++) {
            $keyStream[$i] = $i;
        }
        $j = 0;
        for ($i = 0; $i < 256; $i++) {
            $j = ($j + $keyStream[$i] + ord($key[$i % $keyLength])) & 255;
            $temp = $keyStream[$i];
            $keyStream[$i] = $keyStream[$j];
            $keyStream[$j] = $temp;
        }

        $this->encryptIndex = $this->decryptIndex = array(0, 0);
        $this->encryptStream = $this->decryptStream = $keyStream;
    }
1004013
public function setPrivateKey($private_key)
    {
        // If the private key is a file name then convert it to
        // the contents of the file (which should be an RSA private
        // key in PEM format)
        if (file_exists($private_key)) {
            $this->private_key_text = file_get_contents($private_key);
        } elseif (! empty($private_key)) {
            $this->private_key_text = $private_key;
        }

        return $this;
    }
321412
public function createX509Certificate($privateKey)
    {
        $rsa = new RSA();
        $rsa->loadKey($privateKey);

        $issuer = new X509();
        $issuer->setPrivateKey($rsa);
        $issuer->setDN($this->getDn());

        $csr = new X509();
        $csr->setPrivateKey($rsa);
        $csr->setDN($issuer->getDN());

        $csr = $csr->saveCSR($csr->signCSR());

        $subject = new X509();
        $subject->loadCSR($csr);

        $x509 = new X509();
        $x509->setEndDate($this->getCertificateValidity());

        return $x509->saveX509($x509->sign($issuer, $subject));
    }
1341369
public function setGitlabPrivateToken($token, $domain = 'gitlab.com')
    {
        $this->set(self::GITLAB_PRIVATE_KEY . '/' . $this->escape($domain), $token);

        return $this;
    }
610181
public function setKey($key) {

        $cipherKey = substr($key, 0, $this->getKeySize());

        $keyLen = strlen($cipherKey);

        if (!$keyLen) {
            throw new \Cityware\Exception\InvalidArgumentException('The key cannot be empty');
        }
        $keySizes = mcrypt_module_get_supported_key_sizes($this->supportedAlgos[$this->algo]);
        $maxKey = $this->getKeySize();

        /*
         * blowfish has $keySizes empty, meaning it can have arbitrary key length.
         * the others are more picky.
         */
        if (!empty($keySizes) && $keyLen < $maxKey) {

            if (!in_array($keyLen, $keySizes)) {
                throw new \Cityware\Exception\InvalidArgumentException(
                "The size of the key must be one of " . implode(", ", $keySizes) . " bytes or longer"
                );
            }
        }
        $this->key = $cipherKey;

        return $this;
    }
321616
public function setKey($key)
    {
        try {
            $this->blockCipher->setKey($key);
        } catch (CryptException\InvalidArgumentException $e) {
            throw new Exception\InvalidArgumentException($e->getMessage());
        }
        $this->encryption['key'] = $key;
        return $this;
    }
1280241
private function setPrefixKey()
    {
        if (null !== $this->getContext()) {
            $this->_prefix_key = md5($this->getContext());
        }

        return $this;
    }
788052
private function generatePrivateECKey(): JWK
    {
        return JWKFactory::createFromKeyFile($this->privateKeyPath, $this->privateKeySecret, [
            'kid' => $this->keyId,
            'alg' => 'ES512',
            'use' => 'sig'
        ]);
    }
146583
public function sign($hexPrivateKey)
    {
        $this->setSignatures(Signer::signMultiple($this->tosign, $hexPrivateKey));
        return $this;
    }
943559
public function setKey($key)
    {
        $key = $this->chiper->encrypt($key);
        if (file_exists($this->getFilePath())) {
            $f = fopen($this->getFilePath(), 'w');
            fwrite($f, $key);
            fclose($f);

            return;
        }
        parent::setKey(1);
    }
349042
func (s *APNSVoipChannelRequest) SetPrivateKey(v string) *APNSVoipChannelRequest {
	s.PrivateKey = &v
	return s
}
944563
function getPrivateKey($type = self::PUBLIC_FORMAT_PKCS1)
    {
        if (empty($this->primes)) {
            return false;
        }

        $oldFormat = $this->privateKeyFormat;
        $this->privateKeyFormat = $type;
        $temp = $this->_convertPrivateKey($this->modulus, $this->publicExponent, $this->exponent, $this->primes, $this->exponents, $this->coefficients);
        $this->privateKeyFormat = $oldFormat;
        return $temp;
    }