Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
OpenSSL::PKey::PKey#public_to_pem
() -> ::String
pkey.public_to_pem → string
ext/openssl/ossl_pkey.c
View on GitHub ↗
static VALUE
ossl_pkey_public_to_pem(VALUE self)
{
return ossl_pkey_export_spki(self, 0);
}
Serializes the public key to PEM-encoded X.509 SubjectPublicKeyInfo format.
A PEM-encoded key will look like:
-----BEGIN PUBLIC KEY----- [...] -----END PUBLIC KEY-----
See also
#public_to_der
#raw_private_key
#private_to_pem
#raw_public_key
also in
4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0