PGP decryption in UNIX script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting PGP decryption in UNIX script
# 1  
Old 07-30-2013
PGP decryption in UNIX script

Hi,

I have an already running Production script that I need to simulate in QA. The script is trying to decrypt some files using the below command:

Code:
pgp --decrypt ${GET_DIR}/*.pgp --home-dir /.pgp

I am getting the following error:
Code:
1080:no private key could be found for decryption

Can someone help me with the following:
- Where do I need to keep the keys and which keys do I need for the decryption?
- What is the use of --home-dir in the command?

Thanks in advance
Moderator's Comments:
Mod Comment Please use CODE tags for sample code, sample input, and sample output rather than using bold text. CODE tags preserve spacing that can be crucial in some of these cases; font changes don't.

Last edited by Don Cragun; 07-30-2013 at 05:30 PM.. Reason: Bold -> CODE tags
# 2  
Old 07-30-2013
If your QA environment is on a different server from the Production environment, then you will need to import the private key to your QA box. The keys are usually in the users home directory in a hidden folder, most likely /~/.pgp
This User Gave Thanks to msjkadams For This Post:
# 3  
Old 07-31-2013
you have to create the keypair in your QA.. or if you want to use the same key pair as your PRD, then export/import it to QA. if you can create a new keypair in qa. you can use
Code:
pgp --key-gen

and follow the steps.
a pair of public and private keys will be created.
the below command will give you all the key that are present in your server.
Code:
pgp --key-list

to check a single key use
Code:
pgp --key-list <USER_ID>

After you create your keys, you need to make them available to others so that
they can send you encrypted information and verify your digital signature.
Export your public key to a file.
To export your key to a file,which you can then freely distribute to others, use
the --key-export option.
Code:
pgp --key-export <userID> --output <key_filename>

This exports the public portion of your key.

after exporting the public key.. you need to add the key to your keyring
Code:
pgp --key-add <key_filename>

this is the public key that you have exported.

am i clear in explaining?? if any doubts please reply.
This User Gave Thanks to Little For This Post:
# 4  
Old 07-31-2013
Thanks guys.

The problem is that it is working in Prod, so I cannot generate new keys.

I need to move the keys from Prod to QA, but am unsure where I would find them in Prod and where I need to move in QA. Strangely the user that is used to run the scripts does not have a home directory in Prod.

Please advise.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Pgp encryption script

I have file in linux which I need to do the PGP encryption. Through manually I am using this command to do the same gpg -c scsrun.log Enter passphrase : Repeat Passphrase : But how I can achive this using linux script. Thanks How to use code tags (3 Replies)
Discussion started by: mr_harish80
3 Replies

2. Shell Programming and Scripting

run vi/vim encrypted shell script without decryption on multiple servers

Hello Everyone, How do we run vi/vim encrypted shell script without decryption on multiple servers. It is a simple bash script and vim -nx <filename> has been used to encrypt with desired password. Now I have few errors, the syntax is absolutely fine as I have run that script multiple times on... (0 Replies)
Discussion started by: lovesaikrishna
0 Replies

3. UNIX Desktop Questions & Answers

decryption of .cpt file in unix

can some one help me how to decrypt a .txt.cpt file in unix i Double post (0 Replies)
Discussion started by: lily
0 Replies

4. Shell Programming and Scripting

unix Script for decryption

how to decrypt a file using unix Scipts . i am using one code that is working in the manual testing... echo $pass_phrase|gpg --output $filename_DEx --batch --passphrase-fd 0 --decrypt $filename_DEx_enc in the informatica level its not working.. can anybody help me in this? thanks... (1 Reply)
Discussion started by: rajesh_pola
1 Replies

5. Shell Programming and Scripting

decryption issue!

Hi, Something bizarre is happening while decrypting the files. I had a decrypt script which was working smoothly on uname -a Linux ######### 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:33:05 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux After the front-end application was moved to uname -a Linux... (2 Replies)
Discussion started by: dips_ag
2 Replies

6. Shell Programming and Scripting

Password decryption

Hi, I don't know if I am in a correct category with my question. I want to know what decryption-method is used for this password: (1) The first stadium is (its stored in the settings.xml of my software):... (2 Replies)
Discussion started by: Mogli1977
2 Replies

7. Solaris

PGP encryption/decryption solaris 9

Hi Someone is going to send me a file that they have encrypted by PGP encryption on windows pc to my solaris 9 server. They will give me the pgp key to decrypt the file. How can I do this on solaris 9 Is there a tool installed by default to decrypt or do I need to install something to... (0 Replies)
Discussion started by: frustrated1
0 Replies

8. Shell Programming and Scripting

Using pgp in a shell script

This may be more of a PGP (Pretty Good Privacy) question than Unix, but here's hoping. The statement I'm using to compress a file is: /opt/pgp-6.5.8/pgp +force -feat MY_Pub_Key < file_in.txt > file_out.asc The +force parameter is documented as "Eliminating confirmation questions", but I... (1 Reply)
Discussion started by: abNORMal
1 Replies

9. UNIX for Dummies Questions & Answers

File Encryption and Decryption in UNIX.

Hello guys ! I have used "crypt <first> second" command to encrypt "first" to "second" file. i have assign a key for that of course. Now when i try to look content of "seocnd" file through "cat second" command, the file is encrypted and cannot be read which is according to plan. But when... (3 Replies)
Discussion started by: abidmalik
3 Replies

10. UNIX for Dummies Questions & Answers

Decryption software

whats the most sufficient way to make decryption software? What are the recoomendations for one? (3 Replies)
Discussion started by: Phatress
3 Replies
Login or Register to Ask a Question