Suppose always - trust yes / true in GPG cmd

I use GPG to encrypt a file in ASP.NET, C #. My code executes the command using ProcessStartInfo and gpg.exe is executing, but I have a problem. GPG asks me to allow always-trust with the "y" option. I also tried using "YES" (as suggested by the GPG, accepting "yes" for all questions), but that didn't work either.

The line that runs GPG:

"gpg --armor --output fileOutput.gpg --recipient secure@site.com --encrypt fileInput.xml --always-trust --yes" 

The question arises:

I am NOT sure that the key belongs to the person specified in the User ID. If you really know what you are doing, you can answer the following question with yes

Use this key anyway?

How do I ignore a question or make the answer be true ("YES") without asking for confirmation?

Thanks.

+4
source share
4 answers

add --always-trust as a command line argument to gpg to delay the request.

+3
source

You only need to specify the trust model β€œalways” using the β€œ--trust-model” option.

Example:

 gpg --trust-model always --armor --output fileOutput.gpg --recipient secure@site.com --encrypt fileInput.xml 
0
source

Run the y command:

 echo "y" | <your command> 
-1
source

Source: https://habr.com/ru/post/1369532/


All Articles