Universities have to be accredited for other universities to accept their transfer credits.
If companies want you to have a four-year degree then they have to believe you when you say you have one.
> Is it illegal to learn in a country even if it’s a dictatorship?
It's illegal for US citizens to do a lot of things with North Korea specifically, if you don't have permission first. That's how economic sanctions work.