phpseclib\Crypt\Common\PKCS8::wrapPublicKey PHP Метод

wrapPublicKey() статический публичный Метод

Wrap a public key appropriately
static public wrapPublicKey ( string $key, $algorithm ) : string
$key string
Результат string
    static function wrapPublicKey($key, $algorithm)
    {
        $asn1 = new ASN1();
        $key = ['publicKeyAlgorithm' => ['algorithm' => $algorithm, 'parameters' => null], 'publicKey' => Base64::encode("" . $key)];
        $key = $asn1->encodeDER($key, PublicKeyInfo);
        return "-----BEGIN PUBLIC KEY-----\r\n" . chunk_split(Base64::encode($key), 64) . "-----END PUBLIC KEY-----";
    }