Fixing encryption and signing process