Check if GPG/PGP public key is valid
问题 Through a web interface I'm trying to check if a given public key is valid or not. The bash command gpg --import key.pub returns import successful/failed based on the given key, but I don't want to use $data = system("/usr/bin/gpg --import $key) for my own security concerns. Is there an alternative? 回答1: Ok, I've done a little debugging and this is what I've found: nginx daemon was running under nginx:nginx , no home dir, nologin shell When I executed sudo -u nginx php -r "echo system("gpg -k