$ zip -P *secret* compressed.zip file.txt
Monday, April 10, 2017
Zip n mail
Local string &ZipFile = %FilePath | &zip_name;
Local string &Zip_Cmd = "D:\BatchServer\Batch\PKzip25 " | &ZipFile | " -add " | &qryFile | "." | &ext;
CommitWork();
&ExitCode = Exec(&Zip_Cmd, %Exec_Synchronous + %FilePath_Absolute);
&email.AddAttachment(&ZipFile, %FilePath_Absolute, &zip_name, &attachDescr, "", "");
Saturday, April 8, 2017
Zip password
**This method is used to create a password protected zip file.
* @param dirName of type String indicating the name of the directory to be zipped
* @param zipFileName of type String indicating the name of the zip file to be created
* @param password of type String indicating the password
*/
public static void zipDirWithPassword( String dirName , String zipFileName , String password)
{
if( zipFileName == null )
{
File tempFile = new File(dirName);
zipFileName = tempFile.getAbsoluteFile().getParent() +File.separator+tempFile.getName()+".zip";
}
zipDir(dirName, zipFileName);
String tempZipFileName = new File( dirName ).getAbsoluteFile() .getParent()+File.separator+"tempencrypted.zip";
try
{
AesZipFileEncrypter enc = new AesZipFileEncrypter (tempZipFileName);
enc.addEncrypted( new File(zipFileName), password);
new File(zipFileName).delete();
new File( tempZipFileName ).renameTo( new File (zipFileName));
}
catch (IOException e)
{
e.printStackTrace();
}
}
* @param dirName of type String indicating the name of the directory to be zipped
* @param zipFileName of type String indicating the name of the zip file to be created
* @param password of type String indicating the password
*/
public static void zipDirWithPassword( String dirName , String zipFileName , String password)
{
if( zipFileName == null )
{
File tempFile = new File(dirName);
zipFileName = tempFile.getAbsoluteFile().getParent() +File.separator+tempFile.getName()+".zip";
}
zipDir(dirName, zipFileName);
String tempZipFileName = new File( dirName ).getAbsoluteFile() .getParent()+File.separator+"tempencrypted.zip";
try
{
AesZipFileEncrypter enc = new AesZipFileEncrypter (tempZipFileName);
enc.addEncrypted( new File(zipFileName), password);
new File(zipFileName).delete();
new File( tempZipFileName ).renameTo( new File (zipFileName));
}
catch (IOException e)
{
e.printStackTrace();
}
}
Thursday, April 6, 2017
encrypt
!************************************************************************
Begin-Procedure PGP
!************************************************************************
Let $pgp_cmd = 'pgp --encrypt --armor Filepath/Filename.csv --user "0x43D24C70" --output /Filepath/Filename.csv.pgp'
do Encryption
End-Procedure PGP
!************************************************************************
Begin-Procedure Encryption
!************************************************************************
Display 'Moved File'
Display 'PGP Cmd = ' noline
Display $pgp_cmd
CALL SYSTEM USING $pgp_cmd #op_status
if #op_status = 0
Display 'PGP Encryption success'
else
Display 'Encryption Failed = ' noline
Display #op_status
end-if
End-Procedure Encryption
Encryption Unix Command
Example:
pgp --encrypt "E:\temp\test1.txt" --recipient "Wells Fargo - PGP" --home-dir "<C:\Program Files\PGP Corporation\PGP Command Line>" --sign --signer "YourKeyNameOrKeyID" --passphrase "YourPassphrase"
pgp --encrypt "E:\temp\test1.txt" --recipient "Wells Fargo - PGP" --home-dir "<C:\Program Files\PGP Corporation\PGP Command Line>" --sign --signer "YourKeyNameOrKeyID" --passphrase "YourPassphrase"
You can also combine --encrypt and --sign flags into one command, -es (only one dash for shorthand commands):
pgp -es "E:\temp\test1.txt" --recipient "Wells Fargo - PGP" --home-dir "<C:\Program Files\PGP Corporation\PGP Command Line>" --signer "YourKeyNameOrKeyID" --passphrase "YourPassphrase"
pgp -es "E:\temp\test1.txt" --recipient "Wells Fargo - PGP" --home-dir "<C:\Program Files\PGP Corporation\PGP Command Line>" --signer "YourKeyNameOrKeyID" --passphrase "YourPassphrase"
Subscribe to:
Comments (Atom)