Minimize signature verifications to evaluate primary user

Signature verification is relatively time-consuming. The current getPrimaryUser method checks all self certificates of all users to get the primary user. With this PR signature verifications are minimized to only one verification per key in the ideal case.