Encrypt/Decrypt string with rsa keys

Hello,
I wanted to know if there was a way to encrypt a string, not a file using openssl and then decrypt it? I cant seem to get it to work.

This is what I have been trying but I'm not having much luck.

encTxt=`echo "$1" | openssl dgst -sha1 -binary | openssl rsautl -sign -inkey pri_keyfile.pem | openssl enc -base64`
echo `"$encTxt" | openssl enc -base64 -d | openssl rsautl -verify -inkey pub_keyfile.pem -pubin`

Thanks!

encTxt=`echo "$1" | openssl enc -base64`
echo "$encTxt" | openssl enc -base64 -d