Unlocking your network locked iPhone is legal in most countries we know. However, regulations always change from time to time. If you’re still financing the iPhone with your carrier, they technically own it until you complete the payments. In this case, your cellular provider won’t support you unlocking it as you might switch carriers without paying the outstanding bills on the iPhone.