Added base64 encoding for encrypted output