@param PublicKey $publicKey

@return string
491469
public static function serializePublicKey(PublicKey $publicKey): string
    {
        $hexString = '04';
        $hexString .= str_pad(gmp_strval($publicKey->getPoint()->getX(), 16), 64, '0', STR_PAD_LEFT);
        $hexString .= str_pad(gmp_strval($publicKey->getPoint()->getY(), 16), 64, '0', STR_PAD_LEFT);

        return $hexString;
    }
412502
func (key *Key) PublicKey() *Key {
	keyBytes := key.Key

	if key.IsPrivate {
		keyBytes = publicKeyForPrivateKey(keyBytes)
	}

	return &Key{
		Version:     PublicWalletVersion,
		Key:         keyBytes,
		Depth:       key.Depth,
		ChildNumber: key.ChildNumber,
		FingerPrint: key.FingerPrint,
		ChainCode:   key.ChainCode,
		IsPrivate:   false,
	}
}
314667
public function publicKeyToDer($publicKey)
    {
        try {
            return CryptoVirgilKeyPair::publicKeyToDER($publicKey);
        } catch (Exception $exception) {
            throw new PublicKeyToDerConvertingException($exception->getMessage(), $exception->getCode());
        }
    }
366848
public function addPubkey($pubkey)
    {
        if (!$this->getPubkeys()) {
            return $this->setPubkeys(array($pubkey));
        } else {
            return $this->setPubkeys(
                array_merge($this->getPubkeys(), array($pubkey))
            );
        }
    }
1063165
static public function publicIdDecode($public_id)
    {
        $hashids = new Hashids(self::getSalt(), self::getMinLength(), self::getAlphabet());

        $id = $hashids->decode($public_id);

        if (is_array($id) && isset($id[0]))
            return $id[0];

        return null;
    }
385774
public function parseUncompressedPublicKey($pubkey)
    {
        return (substr($pubkey, 0, 2) == '04') ? $this->prepAndClean(substr($pubkey, 2)) : $this->prepAndClean($pubkey);
    }
442092
public function getRsaPublicKey()
    {
        if ($this->rsaPublicKey) {
            return $this->rsaPublicKey;
        }

        if (!file_exists($this->rsaPublicKeyFile)) {
            throw new CredentialsException('Could not read the public key file.');
        }

        $this->rsaPublicKey = openssl_get_publickey(file_get_contents($this->rsaPublicKeyFile));

        if (!$this->rsaPublicKey) {
            throw new CredentialsException('Cannot access public key for signing');
        }

        return $this->rsaPublicKey;
    }
76238
public function getPublicKey() {
        return (string) $this->encryptor->decrypt($this->getValue(
            self::KEY_PUBLIC_KEY,
            $this->storeManager->getStore()
        ));
    }
848816
public static function toURL(string $path, string $publicPath): string
    {
        $unixPublic = rtrim(str_replace('\\', '/', $publicPath), '\\/') . '/';
        $path = str_replace('\\', '/', $path);

        return str_replace([$unixPublic], '/', $path);
    }
414836
public function convertKey($key, $type)
    {
        $lines = [];

        if ($type == self::KEY_TYPE_PUBLIC) {
            $lines[] = '-----BEGIN PUBLIC KEY-----';
        } else {
            $lines[] = '-----BEGIN RSA PRIVATE KEY-----';
        }

        for ($i = 0; $i < strlen($key); $i += 64) {
            $lines[] = trim(substr($key, $i, 64));
        }

        if ($type == self::KEY_TYPE_PUBLIC) {
            $lines[] = '-----END PUBLIC KEY-----';
        } else {
            $lines[] = '-----END RSA PRIVATE KEY-----';
        }

        return implode("\n", $lines);
    }
60843
def _get_ssh_public_key(self):
        """"""
        key = ipa_utils.generate_public_ssh_key(self.ssh_private_key_file)
        return '{user}:{key} {user}'.format(
            user=self.ssh_user,
            key=key.decode()
        )
1156263
def get_public_key(self):
        """"""
        return PublicKey.from_verifying_key(
            self._private_key.get_verifying_key(),
            network=self.network, compressed=self.compressed)
468360
public function verifySignedStringRequest(
        RequestInterface $request,
        SigningPublicKey $publicKey
    ): string {
        $verified = $this->verifySignedRequest($request, $publicKey);
        return (string) $verified->getBody();
    }
401571
public static String RSAKeyToString (PublicKey key)
    {
        try {
            KeyFactory kf = KeyFactory.getInstance("RSA");
            RSAPublicKeySpec spec = kf.getKeySpec(key, RSAPublicKeySpec.class);
            StringBuilder buf = new StringBuilder();
            buf.append(spec.getModulus().toString(16))
                .append(SPLIT)
                .append(spec.getPublicExponent().toString(16));
            return buf.toString();
        } catch (GeneralSecurityException gse) {
            log.warning("Failed to convert key to string", gse);
        }
        return null;
    }
777762
public function getPublicKey() {

    if (empty($this->wardenPublicKey)) {
      $result = $this->request('/public-key');
      $this->wardenPublicKey = base64_decode($result->getBody());
    }

    return $this->wardenPublicKey;
  }
27433
public function exportPublicKey(VirgilPublicKey $publicKey)
    {
        try {
            return $this->cryptoService->publicKeyToDer($publicKey->getValue());
        } catch (Exception $exception) {
            throw new VirgilCryptoException($exception->getMessage());
        }
    }
1260097
public function parseKey($key)
	{
		$segments = parent::parseKey($key);

		if (is_null($segments[0])) $segments[0] = '*';

		return $segments;
	}