tools: Add util_get_pin helper function

Using this helper PINs can be passed via the command line, stdin and
an environment variable.
For now only used in the openpgp tool.
what happens if no variable is passed, but only 'env:' is passed? What value will *pin have then?