check key & cert non null and fix a problem with gen-token.sh