How encrypt and decrypt with public and private key
openssl req -x509 -nodes -days 100000 -newkey rsa:2048 -keyout private.pem -out public.pub
openssl smime -encrypt -aes256 -in filename.input -binary -outform DEM -out filename.encrypted public.pub
openssl smime -decrypt -in filename.encrypted -binary -inform DEM -inkey private.pem -out filename.input