GPG Using batch

Trying to find out how to get bat file to work. I am trying to encrypt a folder that as a few files in it. I am using cmd, when I run the command/bat file it keeps asking to use key (y/n), I want it to say yes, I thought the using the --yes would work but cant seem to find the correct order or correct command structure.

tried a few different options
gpg --batch --yes -r ps_ua --encrypt-files *.txt —errors with unusable public key

gpg --no-batch --yes -r crypto.ual.com --encrypt-files *.txt —asks for y/n

gpg --no-batch -r crypto.ual.com --encrypt-files *.txt --asks for y/n

gpg -r crypto.ual.com --multifile --encrypt --yes *.txt --yes --asks for y/n

anyone have little guidance/pointers?

Hi Phil,

if gpg asks you, it often is because it is not yet clear that the public key of the recpient really is the key you want to encrypt to.

In this situation you can see why the public key is not trusted enough to be the right
one and change that by either:

  • sign the public key with a trusted private key you have
  • change the trust model for this operation (which means you need a different external validation scheme) see documentation for --trust-model always or --trusted-key

Hope that helps, :wink:
Bernhard

I have the cert set to to full trust (i believe checks are very accurate). I tried to certify the cert but didn’t change anything.

Hi Phil,
what kind of question is coming up in particular?

(The setting to trust a key to certify other keys has to be done on your private keypair.)

Regards,
Bernhard

–trust-model always

will end any questions about trust. But please combine this with setting “-r” to the fingerprint of the certificate you want to use to encrypt to so that it is ensured the right cert is used.

@Andre,
–trust-model always is what I had recommended in my first response.
Phil wrote that it did not make the question go away. :wink:

Best,
Bernhard

so I went back and re-certified cert and then closed and restarted program and it seemed to work now. Odd that it is working now…well not really thats kind of the way it works :slight_smile:

thanks