I mean, crimes against humanity didnt exist before 1945. How did they charge them for crimes that were legalized by the Nazi State? The Nazi State never agreed to subject themselves via treaty to these laws. How did the Allies find jurisdiction?
More can always be said, but this section of the FAQ may be of interest.