crypt: Deduplicate get_public_key().