Create a CryptKey instance without permissions check.

@param string $key
@return \League\OAuth2\Server\CryptKey
718
protected function makeCryptKey($type)
    {
        $key = str_replace('\\n', "\n", $this->app->make(Config::class)->get('passport.'.$type.'_key'));

        if (! $key) {
            $key = 'file://'.Passport::keyPath('oauth-'.$type.'.key');
        }

        return new CryptKey($key, null, false);
    }
520990
static function unlock($cipher, $key = null) {
        return openssl_decrypt($cipher, self::_getSecMethod(), Utils::spare($key, self::_geteSecKey()), false, self::_getSecIv());
    }
904545
public function encrypt($data, $key) {
        if ($data === '') {
            return $data;
        }

        $cipher = $this->createCipher($key);

        $encrypted = mcrypt_generic($cipher, $data);

        $this->clearCipher($cipher);

        return $encrypted;
    }
476172
protected function _hashKey( $key )
    {
        if ( null !== $this->_keyHashCallback && is_callable( $this->_keyHashCallback ) )
        {
            $_arguments = func_get_args();

            return call_user_func_array( $this->_keyHashCallback, $_arguments );
        }

        return $key;
    }
1039428
public static function createNormalizer($key = 'default')
    {
        return isset(self::$instancePool[$key]) ?
            self::$instancePool[$key] :
            self::$instancePool[$key] = new static(
            PropertyAccess::createPropertyAccessor()
        );
    }
347567
public function setKey($key)
    {
        $arr = $this->parseKey($key);
        $this->key = $arr['key'];
        $this->identifier = $arr['identifier'];
        $this->prefix = $arr['prefix'];

        return $this;
    }
531347
private function buildKeyUri($key)
    {
        if (strpos($key, '/') !== 0) {
            $key = '/' . $key;
        }
        $uri = '/' . $this->apiversion . '/keys' . $this->root . $key;
        return $uri;
    }
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));
    }
75183
public function newFromKey($key)
    {
        $scope = $this->get($key);
        if ($this->checkRefs && is_array($scope)) {
            $this->replaceRefs($key, $scope);
        }
        $result = new static($scope);

        return $result;
    }
257742
protected function shouldEncrypt($key)
    {
        $encrypt = isset($this->encrypts) ? $this->encrypts : $this->encryptable;

        return in_array($key, $encrypt);
    }
656762
public function decrypt($encrypted, $privateKey)
    {
        $rsa = new RSA();
        $rsa->loadKey($privateKey);

        return $rsa->decrypt($encrypted);
    }
194319
public function setSecretKey($secretKey)
    {
        $this->secretKey = "-----BEGIN PUBLIC KEY-----" . PHP_EOL . chunk_split($secretKey, 64, PHP_EOL) . "-----END PUBLIC KEY-----";
        $this->checkKey();

        return $this;
    }
877860
public function convertToJWT(CryptKey $privateKey)
    {
        $tokenBuilder = (new Builder())
            ->setAudience($this->getClient()->getIdentifier())
            ->setId($this->getIdentifier(), true)
            ->setIssuedAt(time())
            ->setNotBefore(time())
            ->setExpiration($this->getExpiryDateTime()->getTimestamp())
            ->setSubject($this->getUserIdentifier())
            ->set('scopes', $this->getScopes());

        // add user name to claims
        if ($this->getUserIdentifier()) {
            $userEntity = $this->getUserEntity();
            $member = $userEntity->getMember();

            $tokenBuilder->set('fn', $member ? $member->FirstName : null)
                ->set('ln', $member ? $member->Surname : null);
        }

        return $tokenBuilder->sign(new Sha256(), new Key($privateKey->getKeyPath(), $privateKey->getPassPhrase()))
            ->getToken();
    }
1330449
public function getAuthKeyVar($key)
    {
        if (!isset($this->authKeyMap[$key])) {
            $msg = 'Invalid Auth key requested: ' . $key;
            throw new ApiException($msg);
        }

        $property = $this->authKeyMap[$key];
        return $this->$property;
    }
532144
public function createPrivateKey()
    {
        $rsa = new RSA();
        $rsa->setPrivateKeyFormat(RSA::PRIVATE_FORMAT_PKCS1);

        return $rsa->createKey($this->getPrivateKeySize())['privatekey'];
    }
314667
public function publicKeyToDer($publicKey)
    {
        try {
            return CryptoVirgilKeyPair::publicKeyToDER($publicKey);
        } catch (Exception $exception) {
            throw new PublicKeyToDerConvertingException($exception->getMessage(), $exception->getCode());
        }
    }
307389
public function setAuthKey($key)
    {
        $authKeyAttribute = $this->authKeyAttribute;
        return (is_string($authKeyAttribute) && !empty($authKeyAttribute)) ? $this->$authKeyAttribute = $key : null;
    }