Get self with given subject public key info.

@param PublicKeyInfo $pub_key_info
@return self
960011
public function withSubjectPublicKeyInfo(PublicKeyInfo $pub_key_info): self
    {
        $obj = clone $this;
        $obj->_subjectPublicKeyInfo = $pub_key_info;
        return $obj;
    }
721354
public static function getPublicInfo()
    {
        if (empty(session('user'))) {
            throw new UnauthorizedException('There is no valid session for the current request.');
        }

        $sessionData = [
            'session_token'   => session('session_token'),
            'session_id'      => session('session_token'), // temp for compatibility with 1.x
            'id'              => session('user.id'),
            'name'            => session('user.display_name'),
            'first_name'      => session('user.first_name'),
            'last_name'       => session('user.last_name'),
            'email'           => session('user.email'),
            'is_sys_admin'    => session('user.is_sys_admin'),
            'last_login_date' => session('user.last_login_date'),
            'host'            => gethostname()
        ];

        $role = static::get('role');
        if (!session('user.is_sys_admin') && !empty($role)) {
            $sessionData['role'] = array_get($role, 'name');
            $sessionData['role_id'] = array_get($role, 'id');
        }

        return $sessionData;
    }
1055955
public function pub($data)
    {
        foreach ($this as $obj) {
            $func = $this->getInfo();
            $func($data);
        }
        return $this;
    }
683373
public void setSignInfo(PrivateKey privKey, Certificate[] certChain, CRL[] crlList) {
        try {
            pkcs = new PdfPKCS7(privKey, certChain, crlList, hashAlgorithm, provider, PdfName.ADBE_PKCS7_SHA1.equals(get(PdfName.SUBFILTER)));
            pkcs.setExternalDigest(externalDigest, externalRSAdata, digestEncryptionAlgorithm);
            if (PdfName.ADBE_X509_RSA_SHA1.equals(get(PdfName.SUBFILTER))) {
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
                for (int k = 0; k < certChain.length; ++k) {
                    bout.write(certChain[k].getEncoded());
                }
                bout.close();
                setCert(bout.toByteArray());
                setContents(pkcs.getEncodedPKCS1());
            }
            else
                setContents(pkcs.getEncodedPKCS7());
            name = PdfPKCS7.getSubjectFields(pkcs.getSigningCertificate()).getField("CN");
            if (name != null)
                put(PdfName.NAME, new PdfString(name, PdfObject.TEXT_UNICODE));
            pkcs = new PdfPKCS7(privKey, certChain, crlList, hashAlgorithm, provider, PdfName.ADBE_PKCS7_SHA1.equals(get(PdfName.SUBFILTER)));
            pkcs.setExternalDigest(externalDigest, externalRSAdata, digestEncryptionAlgorithm);
        }
        catch (Exception e) {
            throw new ExceptionConverter(e);
        }
    }
159813
public function store($public_key_file, $private_key_file)
    {
        file_put_contents($public_key_file, $this->public_key_text);
        file_put_contents($private_key_file, $this->private_key_text);
        chmod($private_key_file, 0600);

        return $this;
    }
1036129
public function getPubkeyFormat($private_key = null)
    {
        $private_key = ($this->testIfWIF($private_key) === true) ? $this->decodeWIF($private_key) : $private_key;

        if (empty($private_key) === true) {
            return ($this->compressed_pubkey_format != '') ? $this->compressed_pubkey_format : '';
        } else {
            return $this->calculatePubKeyFormat($private_key);
        }
    }
147183
public function getUserInfo() {
        $userInfo = $this->getCommand('GetUserInfo', array(
            'user' => $this->getUser(),
        ))->execute();

        return PublicKeyFallback::fallback($userInfo);
    }
424933
public function getServerToken ( $consumer_key, $token, $user_id )
	{
		$ts = $this->query_row_assoc('
					SELECT	ocr_consumer_key		as consumer_key,
							ocr_consumer_secret		as consumer_secret,
							oct_token				as token,
							oct_token_secret		as token_secret,
							oct_usa_id_ref			as usr_id,
							ocr_signature_methods	as signature_methods,
							ocr_server_uri			as server_uri,
							ocr_server_uri_host		as server_uri_host,
							ocr_server_uri_path		as server_uri_path,
							ocr_request_token_uri	as request_token_uri,
							ocr_authorize_uri		as authorize_uri,
							ocr_access_token_uri	as access_token_uri,
							oct_timestamp			as timestamp
					FROM oauth_consumer_registry
							JOIN oauth_consumer_token
							ON oct_ocr_id_ref = ocr_id
					WHERE ocr_consumer_key = \'%s\'
					  AND oct_usa_id_ref   = %d
					  AND oct_token_type   = \'access\'
					  AND oct_token        = \'%s\'
					  AND oct_token_ttl    >= NOW()
					', $consumer_key, $user_id, $token);
		
		if (empty($ts))
		{
			throw new OAuthException2('No such consumer key ('.$consumer_key.') and token ('.$token.') combination for user "'.$user_id.'"');
		}
		return $ts;
	}
18449
def subject_public_key(self, value):
        

        is_oscrypto = isinstance(value, asymmetric.PublicKey)
        if not isinstance(value, keys.PublicKeyInfo) and not is_oscrypto:
            raise TypeError(_pretty_message(
                '''
                subject_public_key must be an instance of
                asn1crypto.keys.PublicKeyInfo or oscrypto.asymmetric.PublicKey,
                not %s
                ''',
                _type_name(value)
            ))

        if is_oscrypto:
            value = value.asn1

        self._subject_public_key = value

        self._key_identifier = self._subject_public_key.sha1
        self._authority_key_identifier = None
1276352
public PublicIpMetadata getPublicIp(Server serverRef, String publicIp) {
        return this.getPublicIp(idByRef(serverRef), publicIp);
    }
990417
public function getPublicKey()
    {
        /** @var string $cacheKey */
        if(empty($this->_publicKey) && !empty($this->jwkUrl))
        {
            if(Yii::$app->cache)
            {
                $cacheKey = "JWK_".sha1($this->jwkUrl);
                $jwk = Yii::$app->cache->get($cacheKey);
            }

            if(empty($jwk))
            {
                $res = $this->createRequest()
                    ->setMethod('GET')
                    ->setUrl($this->jwkUrl)
                    ->send();
                if(!empty($res)) {
                    $jwk = $res->getContent();
                    if(!empty($jwk) && Yii::$app->cache)
                        Yii::$app->cache->set($cacheKey, $jwk, self::PUBLIC_KEY_EXPIRE_DURATION);
                } else {
                    throw new UnauthorizedHttpException("Can\'t get public key");
                }
            }
            if(!empty($jwk))
                $this->_publicKey = JWK::parseKeySet($jwk);
        }
        return $this->_publicKey;
    }
620107
def load_key(self, key):
        
        self._serialize(key)
        if isinstance(key, ec.EllipticCurvePrivateKey):
            self.priv_key = key
            self.pub_key = key.public_key()
        else:
            self.pub_key = key

        return self
966468
public function getConsumer ( $consumer_key, $user_id, $user_is_admin = false )
    {
        $consumer = $this->query_row_assoc('
                        SELECT    *
                        FROM oauth_server_registry
                        WHERE osr_consumer_key = \'%s\'
                        ', $consumer_key);

        if (!is_array($consumer))
        {
            throw new OAuthException2('No consumer with consumer_key "'.$consumer_key.'"');
        }

        $c = array();
        foreach ($consumer as $key => $value)
        {
            $c[substr($key, 4)] = $value;
        }
        $c['user_id'] = $c['usa_id_ref'];

        if (!$user_is_admin && !empty($c['user_id']) && $c['user_id'] != $user_id)
        {
            throw new OAuthException2('No access to the consumer information for consumer_key "'.$consumer_key.'"');
        }
        return $c;
    }
1217754
protected function _getKey(Subject $subject, $reader, $key)
    {
        $callable = $this->reader($reader);

        if ($callable === null || !is_callable($callable)) {
            throw new Exception('Invalid reader: ' . $reader);
        }

        return $callable($subject, $key);
    }
308301
public function getPublicMasterKey()
    {
        if (!$this->publicMasterKey) {
            $masterKey = $this->getMasterKey();
            $publicKeyDetails = openssl_pkey_get_details($masterKey);
            $this->publicMasterKey = $publicKeyDetails['key'];
        }
        return $this->publicMasterKey;
    }
749945
public function editPublicKey($publicKey, $privateKey) {
        $this->validatePublicKeyName($publicKey);

        return $this->getCommand('EditPublicKey', array(
            'properties' => json_encode(array('privateKey' => $privateKey)),
            'publicKey' => $publicKey,
        ))->execute();
    }
370128
private function getPublicKeyDetails($publicKey) {
        if (isset($this->publicKeys[$publicKey])) {
            return $this->publicKeys[$publicKey];
        }

        // Not in cache, fetch from database
        $pubkeyInfo = $this->getAclCollection()->findOne([
            'publicKey' => $publicKey,
        ]);

        if (!$pubkeyInfo) {
            return [];
        }

        $data = $this->bsonToArray->toArray($pubkeyInfo->getArrayCopy());

        $this->publicKeys[$publicKey] = $data;

        return $data;
    }