Advertisement

08.28.2008 at 02:44AM PDT, ID: 23684833
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Capturing the output of the GPG import command

Asked by vtechpilot in Encryption for Network Security

Tags: , , ,

I am working on an application that will encrypt a file using a public key as part of an automated process. So far I have been able to write code that can capture the output of some of GPG's commands. For example, I am able execute 'gpg.exe --list-keys' and capture the output from stdout and parse the results.

currently the code can check for the existence of the public key in the keyring without any problems. In the case where the public key is not already in the keyring, I want to prompt the user to locate the key file. From the shell, I can call 'gpg.exe --dry-run --import c:\some\path\key.asc' and inside the shell gpg will display some basic information about the file. I want my program to be able to use this output to check that the user selected the file with the desired key in it. The problem that I am seeing the output during an import command can not be redirected.

The work around that I have is that I could import the file, then use list keys again to check again for the public key I want to use. However I consider this to be a sub optimal solution since this could cause the user to import keys that aren't needed.

What I am looking for is either a workaround that allows me to capture the output of an import command, or a really good reason why I can't do this. I expect that a good reason why I can't do this is going to be difficult because the key gets imported anyway, even if the output is not captured, and the output of a import command does not contain any information that is not also displayed in a list keys command. If the output of an import command is somehow meant to be secret, then why is it so easy to capture when listing keys? The second point is that this is a public key, there shouldn't be any harm in seeing any output related to a public key.

I've also heard the argument that you shouldn't parse the output of a program like GPG because later changes to the program can cause different output and would break my code, on this point I simply don't care. I'll update the code when that happens. Start Free Trial
 
 
[+][-]08.28.2008 at 04:21AM PDT, ID: 22333529

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.28.2008 at 07:01AM PDT, ID: 22334899

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 07:35AM PDT, ID: 22335342

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Encryption for Network Security
Tags: GNU, GPG Gnu Privacy Guard, 1.4.9 (MingW32), import pipe stdout windows gpg
Sign Up Now!
Solution Provided By: vtechpilot
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628