I have a PGP public key of B. Now A wants to send an encrypted message to B using his PGP Public key by using PGP method. How can I do this with OpenSSL?

**Edit**

I have seen wiki page for PGP method where a random key is used to encrypt the message and that random key is again encrypted with senders PGP Public key and then receiver will decrypt the encrypted key using his private key and then that decrypted key is used to decrypt the message. But i am not able to do that process in openssl.

It can be done in gpg, but i want to know how can it be done in OpenSSL?

receiver'spublickey, not the sender's. As correctly shown in the wikipedia figure you linked on one answer. The sender must have previously obtained, and validated, a copy of the receiver's key. This is fundamental to the design of en.wikipedia.org/wiki/Public-key_cryptography . – dave_thompson_085 Apr 8 '20 at 10:40