Generate pubkey if not present, error on pubkey without privkey