get rpubkey outside of subshell