Yes, jailbreaking is legal, but it can void your device's warranty. Please consider this before using the jailbreak function.