I don't know about legality, but most forms online in Japan accept 4 characters at most for family name; the vast majority of people have two characters with one and three being less common. Okinawa, I think has the highest instance of 4-character surnames, but I may be wrong on that.
I was living in Seoul many (many) moons ago. I remember all forms having three character spaces each for first and last names. Fun times squeezing in a standard western ten-twenty latin character names. Even transliterated to hangul my name wouldn't fit. It was always a small thrill if the person behind the counter would look terrified and accept it without question or get pissy and refuse it without mercy.