since this is a public method, it will be good to validate $str, $key, $iv are valid inputs.