Generate a PublicKey object from the passed PEM formatted data
Decrypts data previously encrypted with the matching PrivateKey
Encrypt the passed data using the PublicKey
Return a PublicKey in the PEM format.
Verify the data passed was signed with the public key.
PublicKey contains the RSA public key from a private/public keypair.
It also allows extraction of the public key from a keypair.
This is useful for encryption, you can encrypt data with someone's public key and they can decrypt it with their private key.
Example