Acts 23:5 - - It is written, Thou shalt not speak evil of the ruler of thy people.
It is "high priest".
Do you know WHERE, exactly, "it is written"?
YLT translates that verse: "and Paul said, `I did not know, brethren, that he is chief priest: for it hath been written, Of the ruler of thy people thou shalt not speak evil;'"
...so I don't think it's referring to all people and all rulers, but something specific in this particular location and time, indicating that he could not tell that this man was a high priest because of the way others were speaking badly about him-which was against their local law.
And, it wasn't that Paul was "criticizing" him, it was that he was "reviling" him, calling him out.
So far, in the United States of America, we are free to criticize our leaders. It is a constitutionally protected right. Against such we have no law.