I need some assistance to generate encrypted documents using https://www.gnupg.org/ software.
They have provided the command line as per following.
alice% gpg --output doc.gpg --encrypt --recipient blake#cyb.org doc
But I am not getting as per my file structure how I am suppose to do same.
Please check the following file structure.
Public Key : C:\Encryption\PB_Key.asc
File need to encrypt : C:\Encryption\Test.txt
Bat file : C:\Encryption\Test.bat
gpg.exe : C:\Program Files (x86)\GnuPG\bin\gpg.exe
UserName : Test
I did some research and found few links
Batch encrypt with public key using Gpg4win command line
Need assistance to incorporate above.
Try this one.
#echo off
CD "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
gpg --import PB_Key.asc
gpg -r "Test" -e "C:\Encryption\Test.txt"
We can create a batch file as following.
#echo off
"C:\Program Files (x86)\GnuPG\bin\gpg.exe" --import PB_Key.asc
"C:\Program Files (x86)\GnuPG\bin\gpg.exe" -r "Test" -e "C:\Encryption\Test.txt"
Related
I had a requirement to compress a folder/directory and also encrypt it. And when needed i've to decrypt it. I did browse a lot to find a working answer on a MacOs. And i just manage to use the below steps to make it working.
Zip or tar zip the file/directory using zip or tar czf linux command
use "gpg --encrypt sample-file-or-folder.zip" Prompts you to enter the passphrase
Outcome of step 2, should result in sample-file-or-folder.zip.gpg
For decrypting .zip.gpg file use "gpg --output sample-file-or-folder.zip --decrypt sample-file-or-folder.zip.gpg" --> This prompts you to enter the passphrase. Please note that if you don't mention "--output" it will not get the desired output.
Is there any other better way to get the desired result ?
I use gpg for encrypting a file storing my passwords in Windows. This file is an MS Excel file, which I use for convenience. Every time I want to check or update my passwords (> once per day on average), I execute the following batch script, which decodes the encrypted file and encodes the updated xlsx file again when I close the application.
call gpg --output pass.xlsx --decrypt pass.xlsx.gpg
call "%ProgramFiles%\Microsoft Office\Office14\excel.exe" pass.xlsx
call gpg --batch --yes --recipient myName --encrypt pass.xlsx
del pass.xlsx
Obviously, this is a suboptimal solution as it creates a decrypted file, which in case of an interruption (e.g. accidentally closing the command line window or a system crash), the file remains unencrypted. Anyone with something better, e.g. using in-memory pipes or the like (in Windows)?
I have a sequence of scripts which downloads PGP files from a FTP server. I then unzip these files with a private key using PGPKeys. The unzipped files are then picked up by a SQL Server job which appends the data onto our database. I'd like to automate the entire process. Is there anyway to unzip a PGP locked file using shell scripting (either Linux or Windows)?
That's a perfect task to automize, I can help you in Linux.
First you can use wget to download a file
wget ftp://website.com/yourpgparchive.zip
If your ftp website requires authenticated access use
wget --ftp-user=USER --ftp-password=PASSWORD ftp://ftp.site/archive.zip.pgp
Then you need gpg (the open source PGP implementation) to decrypt the file
gpg -o file.zip -d file.zip.gpg
(If you need some suggestion on how to import keys and get started with gpg check here)
Then you can just unzip the file with
unzip file.zip
You may need to install gnupg and unzip from your package manager.
Yes, GPG. In your case, it's just gpg -d filename (or just gpg -d to read from stdin).
And, what you probably wanted to say is decrypt instead of unzip and encrypted instead of locked.
I'm sending a source code package to someone via email. I have sent them an .svdump which contains the files. They have now asked me to send an MD5 file for the source dump. How do I create this on a Mac?
Open up a terminal and invoke the md5 program with the filename that you want to create a hash for:
md5 some_app > md5.txt
The command above stores the resulting hash in a file named md5.txt.
In your terminal, just use the command "md5" and the file name. It's in /sbin/md5 i think.
> md5 -r myfile.txt
i want to automate the task of uploading of a file at FTP site "uploads.google.com"
how can i achive this
please see here for example
One of the example is depicted as follows :
Prepare a file (say ftp_cmd.txt)with all the ftp commands to upload the files to our specific site
as below:
binary
cd
mput file.*
bye
Now create a batch file with the following content:
ftp -i -v -s:
ex: ftp -i -v -s:ftp_cmd.txt updates.google.com
Now, when you execute this batch file, it will put all files with format file.* to the specified directory.