Merge changes Ia19c6678,I44baaa47 into integration

* changes:
  refactor(auth): clean up certificate length checks
  refactor(auth): remove code duplication