Add pub_key_from_params factory method

Fixes: https://bugzilla.osafoundation.org/show_bug.cgi?id=12981