{"id":7161,"date":"2019-06-07T02:42:20","date_gmt":"2019-06-07T02:42:20","guid":{"rendered":"https:\/\/zappysys.com\/blog\/?p=7161"},"modified":"2022-03-25T14:44:23","modified_gmt":"2022-03-25T14:44:23","slug":"ssis-pgp-encryption-decryption","status":"publish","type":"post","link":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/","title":{"rendered":"SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool)"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7202 alignleft\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png\" alt=\"\" width=\"122\" height=\"122\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png 500w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo-150x150.png 150w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo-300x300.png 300w\" sizes=\"(max-width: 122px) 100vw, 122px\" \/><\/a>In this new article, we will show you how to perform PGP encryption using SSIS (encrypt \/ decrypt files using public \/ private key). Our previous article was about\u00a0<a href=\"https:\/\/zappysys.com\/blog\/ssis-sftp-task-examples-upload-download-move-delete-files-folders\/\">SFTP using our SFTP task\u00a0for SSIS<\/a>. Now we will show how to encrypt the information.<\/p>\n<h2>Requirements<\/h2>\n<ol>\n<li>First of all, you will need SSDT for\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/ssdt\/download-sql-server-data-tools-ssdt?view=sql-server-2017\">Business Intelligence for SSIS<\/a> projects.<\/li>\n<li>Download and install FREE PGP Command line\u00a0<a href=\"https:\/\/www.gnupg.org\/download\/index.html\" target=\"_blank\" rel=\"noopener\">gnupg<\/a> for Windows.<\/li>\n<li><strong>Optionally<\/strong> you can install <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/\" target=\"_blank\" rel=\"noopener\">SSIS PowerPack<\/a>.<\/li>\n<\/ol>\n<div class=\"su-note\"  style=\"border-color:#9ddee5;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#b7f8ff;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">Note: This article is for the information purpose only.<\/div><\/div>\n<h3>What is PGP \/ GPG (GnuPG) \/ OpenPGP ?<\/h3>\n<p><strong>PGP<\/strong> stands for Pretty Good Privacy. It was created by Phil Zimmermann. PGP is\u00a0the most popular email encryption in the world. It is an Encryption that\u00a0requires a public key, a private key. You can encrypt, decrypt and sign\u00a0documents, emails. PGP Tools now acquired by Symantec. In sort PGP Tools developed by Phil are not Open Source any more so use other on if you really need FREE one.<\/p>\n<p><strong>GPG<\/strong> (i.e. GnuPG)) stands for GNU Privacy Guard. <a href=\"https:\/\/www.gnupg.org\/download\/index.html\" target=\"_blank\" rel=\"noopener\">This software<\/a> is for multiple platforms\u00a0like Linux and Windows. In this article, we will focus on Windows because we are\u00a0using SSIS that is mainly installed in Windows (at least by the moment). This\u00a0tool is free, so we will focus on this one instead of trying other licensed\u00a0versions.<\/p>\n<p><strong>OpenPGP<\/strong> is standard around Public \/ Private Key Cryptography (<a href=\"https:\/\/tools.ietf.org\/html\/rfc4880\" target=\"_blank\" rel=\"noopener\">RFC4880<\/a>) . <a href=\"https:\/\/www.openpgp.org\/about\/\" target=\"_blank\" rel=\"noopener\">Check this page<\/a>. Both GPG and PGP follow OpenPGP Standard however there will be a case when they are not 100% compatible with each other.<\/p>\n<p>For more information <a href=\"https:\/\/superuser.com\/questions\/1397874\/gnupg-package-difference-between-pgp-and-gpg\" target=\"_blank\" rel=\"noopener\">read this link<\/a> and <a href=\"https:\/\/askubuntu.com\/questions\/186805\/difference-between-pgp-and-gpg\" target=\"_blank\" rel=\"noopener\">this link<\/a>.<\/p>\n<h2>Getting started<\/h2>\n<p>In this article we will use GPG only which is essentially same features as PGP but GPG is Open Source around OpenPGP Standard and PGP is not open source.<\/p>\n<p>So let&#8217;s get started. First of all, we will start with a simple the command line.<\/p>\n<h3>GPG command line example<\/h3>\n<p>After you install gpg command line we can open it to get started. There are many more examples <a href=\"https:\/\/www.glump.net\/howto\/cryptography\/practical-introduction-to-gnu-privacy-guard-in-windows\" target=\"_blank\" rel=\"noopener\">explained here<\/a>\u00a0and <a href=\"https:\/\/gnupg.org\/documentation\/manpage.html\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<ol>\n<li>First of all, check the requirements and open the command line.<\/li>\n<li>Secondly, in the command line write gpg &#8211;help this will list all the\u00a0commands available:\n<div id=\"attachment_7171\" style=\"width: 764px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/gpg-command-line.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7171\" class=\"size-full wp-image-7171\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/gpg-command-line.jpg\" alt=\"LIst of gpg commands\" width=\"754\" height=\"481\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/gpg-command-line.jpg 754w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/gpg-command-line-300x191.jpg 300w\" sizes=\"(max-width: 754px) 100vw, 754px\" \/><\/a><p id=\"caption-attachment-7171\" class=\"wp-caption-text\">gpg help command<\/p><\/div><\/li>\n<li>Also, in order to generate your personal key pair, write the following command:\n<pre class=\"lang:default highlight:0 decode:true \">gpg --gen-key<\/pre>\n<\/li>\n<li>Finally, the command previously provided will ask for a name and email, write\u00a0an O to press OK and a Passphrase. You will be able to create your key pair\u00a0with that information.<\/li>\n<\/ol>\n<h3>PGP encryption using SSIS introduction<\/h3>\n<p>It is possible to perform PGP encryption using SSIS with the GPG command line which is free. We can use\u00a0 native <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/integration-services\/control-flow\/execute-process-task?view=sql-server-2017\" target=\"_blank\" rel=\"noopener\">execute process task<\/a> that comes with SSIS. In this\u00a0article, we will show some commands of gpg.<\/p>\n<ol>\n<li>Open a new SSIS Package.<\/li>\n<li>Drag Execute Process Task from SSIS Toolbox and double click to configure (see next step).<\/li>\n<li>Using SSIS Execute Process Task, we will invoke the gpg commands. There are different ways to\u00a0invoke the gpg commands. One way is to execute command stored in a\u00a0.bat file or .cmd file<\/li>\n<li>To invoke command from a file create a file called gpg.cmd and type <span class=\"lang:default highlight:0 decode:true crayon-inline\">gpg &#8211;version<\/span>\u00a0\u00a0 , save file to path like c:\\sql\\gpg.cmd for this demo.<\/li>\n<li>Configure Execute Process Task something like\u00a0this if you invoke command from batch file:\n<div id=\"attachment_7173\" style=\"width: 747px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-ssis-execute-process-task.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7173\" class=\"size-full wp-image-7173\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-ssis-execute-process-task.jpg\" alt=\"Invoke a cmd file in SSIS to encrypt\" width=\"737\" height=\"631\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-ssis-execute-process-task.jpg 737w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-ssis-execute-process-task-300x257.jpg 300w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><p id=\"caption-attachment-7173\" class=\"wp-caption-text\">SSIS invoke gpg<\/p><\/div><\/li>\n<li>Also, note that the <strong>windows style is hidden<\/strong>. That will hide the command\u00a0line when running the package.<\/li>\n<li>In addition, the <strong>StandardOutputVariable<\/strong> will create an object variable\u00a0in the output.<\/li>\n<li>To verify the output, we will use the <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-logging-task-free\/\" target=\"_blank\" rel=\"noopener\">ZS Logging task<\/a>\n<div style=\"width: 768px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-output-pgp-version-information.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7174\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-output-pgp-version-information.jpg\" alt=\"Show gpg output result from a variable\" width=\"758\" height=\"260\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-output-pgp-version-information.jpg 758w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-output-pgp-version-information-300x103.jpg 300w\" sizes=\"(max-width: 758px) 100vw, 758px\" \/><\/a><p class=\"wp-caption-text\">SSIS output results<\/p><\/div><\/li>\n<li>Click OK to save Execute Process Task UI.<\/li>\n<li>Now drag <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-logging-task-free\/\">ZS Logging task<\/a> from toolbox and configure like below. This will Log output captured by gpg command. This step is optional but will help you a lot if you want to know what happened in previous step (e.g. capture error message)\n<div id=\"attachment_7170\" style=\"width: 635px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-variables-logging-task-values.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7170\" class=\"size-full wp-image-7170\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-variables-logging-task-values.jpg\" alt=\"SSIS Show variable value\" width=\"625\" height=\"504\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-variables-logging-task-values.jpg 625w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-variables-logging-task-values-300x242.jpg 300w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/a><p id=\"caption-attachment-7170\" class=\"wp-caption-text\">SSIS Logging task<\/p><\/div><\/li>\n<\/ol>\n<h3>Execute GPG \/ PGP commands directly in SSIS Execute Process Task (Pass Arguments)<\/h3>\n<p>1. In the previous example, we used a cmd file with the commands. Sometimes\u00a0we need to use SSIS variables and pass information dynamically. In this new\u00a0example, we will invoke the gpg command line directly and send the arguments in\u00a0the arguments property like this:<\/p>\n<div id=\"attachment_7176\" style=\"width: 747px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-execute-process-arguments.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7176\" class=\"size-full wp-image-7176\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-execute-process-arguments.jpg\" alt=\"gpg encryption in ssis\" width=\"737\" height=\"631\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-execute-process-arguments.jpg 737w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-execute-process-arguments-300x257.jpg 300w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><p id=\"caption-attachment-7176\" class=\"wp-caption-text\">SSIS execute gpg encryption<\/p><\/div>\n<h3>Generate public key in PGP encryption using SSIS<\/h3>\n<p>Now lets look at common task with PGP cryptography which is generate Public \/ Private Key pair.<\/p>\n<ol>\n<li>In order to generate a public key, you need to run the following\u00a0arguments in SSIS:\n<div id=\"attachment_7178\" style=\"width: 966px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-gpg-generate-key.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7178\" class=\"size-full wp-image-7178\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-gpg-generate-key.jpg\" alt=\"Generating a public gpg key in SSIS\" width=\"956\" height=\"631\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-gpg-generate-key.jpg 956w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-gpg-generate-key-300x198.jpg 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-gpg-generate-key-768x507.jpg 768w\" sizes=\"(max-width: 956px) 100vw, 956px\" \/><\/a><p id=\"caption-attachment-7178\" class=\"wp-caption-text\">SSIS generation of public key<\/p><\/div>\n<pre class=\"lang:default highlight:0 decode:true\">--armor --output \"c:\\sql\\ssiskey.txt\" --export \"Name\"<\/pre>\n<\/li>\n<li>In addition, the key name is the name of the pair key created and the<br \/>\noutput contains the path of the stored key.<\/li>\n<\/ol>\n<h3>How to encrypt a file in PGP encryption using SSIS<\/h3>\n<ol>\n<li>First of all, we will encrypt a file named ssiskey.txt:<\/li>\n<li>The argument used is the following:\n<pre class=\"lang:default highlight:0 decode:true \">--recipient \"Name\" --output \"c:\\sql\\ssiskey.txt.gpg\" --encrypt \"c:\\sql\\ssiskey.txt\"<\/pre>\n<div id=\"attachment_7179\" style=\"width: 932px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-encrypt-file-pgp.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7179\" class=\"size-full wp-image-7179\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-encrypt-file-pgp.jpg\" alt=\"How to encrypt a file using PGP in SSIS\" width=\"922\" height=\"631\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-encrypt-file-pgp.jpg 922w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-encrypt-file-pgp-300x205.jpg 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-encrypt-file-pgp-768x526.jpg 768w\" sizes=\"(max-width: 922px) 100vw, 922px\" \/><\/a><p id=\"caption-attachment-7179\" class=\"wp-caption-text\">Encrypt file gpg in SSIS<\/p><\/div><\/li>\n<li>We are creating an encrypted file named ssiskey.txt.pgp<\/li>\n<\/ol>\n<h3>How to decrypt a file in PGP encryption using SSIS<\/h3>\n<ol>\n<li>In order to start, we will decrypt the file created previously:\n<div id=\"attachment_7181\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-decrypt-pgp.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7181\" class=\"size-full wp-image-7181\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-decrypt-pgp.jpg\" alt=\"PGP decryption in SSIS\" width=\"1024\" height=\"631\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-decrypt-pgp.jpg 1024w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-decrypt-pgp-300x185.jpg 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-decrypt-pgp-768x473.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><p id=\"caption-attachment-7181\" class=\"wp-caption-text\">Decrypt file using PGP<\/p><\/div><\/li>\n<li>Also, we will use the following argument:\n<pre class=\"lang:default highlight:0 decode:true \">--decrypt-files \"c:\\sql\\ssiskey.txt.gpg\"<\/pre>\n<p>&nbsp;<\/li>\n<\/ol>\n<h3>How to import a public key in PGP encryption using SSIS<\/h3>\n<ol>\n<li>In order to send a message and decrypt it, you need a public key. If you\u00a0publish a public key, the recipient needs to import the public key. To import a\u00a0key use the following argument:\n<pre class=\"lang:default highlight:0 decode:true \">gpg --import \"c:\\sql\\publickey.txt\".<\/pre>\n<p>You can download a public key here:<\/p>\n<ul>\n<li><a href=\"https:\/\/futureboy.us\/pgp.txt\" target=\"_blank\" rel=\"noopener\">Public key<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Secondly, in the Execute Process Task, will look like this:\n<div id=\"attachment_7183\" style=\"width: 747px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-pgp-gpg-import-key.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7183\" class=\"size-full wp-image-7183\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-pgp-gpg-import-key.jpg\" alt=\"Import SSIS key \" width=\"737\" height=\"631\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-pgp-gpg-import-key.jpg 737w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-pgp-gpg-import-key-300x257.jpg 300w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><p id=\"caption-attachment-7183\" class=\"wp-caption-text\">How to import a public key in SSIS<\/p><\/div><\/li>\n<\/ol>\n<h3>How to encrypt multiple files in PGP encryption using SSIS<\/h3>\n<ol>\n<li>If you want to encrypt multiple files, you can use the <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-file-system-task-advanced\/\" target=\"_blank\" rel=\"noopener\">ZS Advanced File System<\/a> combined with the Foreach loop container to\u00a0filter and select the files to encrypt.<\/li>\n<li>In addition, the package will look like this:\n<div id=\"attachment_7185\" style=\"width: 260px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-list-files-ado-list.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7185\" class=\"size-full wp-image-7185\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-list-files-ado-list.jpg\" alt=\"Get multiple files\" width=\"250\" height=\"206\" \/><\/a><p id=\"caption-attachment-7185\" class=\"wp-caption-text\">Send a list of files to the foreach loop<\/p><\/div><\/li>\n<li>Also, in the Advanced File System, we will list the files as ADO.net\u00a0DataTable:\n<div id=\"attachment_7186\" style=\"width: 693px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-get-list-ado-list.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7186\" class=\"size-full wp-image-7186\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-get-list-ado-list.jpg\" alt=\"ADO list of files\" width=\"683\" height=\"633\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-get-list-ado-list.jpg 683w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-get-list-ado-list-300x278.jpg 300w\" sizes=\"(max-width: 683px) 100vw, 683px\" \/><\/a><p id=\"caption-attachment-7186\" class=\"wp-caption-text\">Store list of files in SSIS<\/p><\/div><\/li>\n<li>In the next step, we will use the Foreach ADO Enumerator in the Foreach\u00a0Loop container:\n<div id=\"attachment_7188\" style=\"width: 747px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-foreach-ado-enumerator.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7188\" class=\"size-full wp-image-7188\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-foreach-ado-enumerator.jpg\" alt=\"SSIS foreach loop container\" width=\"737\" height=\"631\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-foreach-ado-enumerator.jpg 737w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-foreach-ado-enumerator-300x257.jpg 300w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><p id=\"caption-attachment-7188\" class=\"wp-caption-text\">Foreach loop from the Advanced Files system<\/p><\/div><\/li>\n<li>Next, we will select the first column (column 0) to get the file path\u00a0from the list.\n<div id=\"attachment_7189\" style=\"width: 747px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-mapping-column.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7189\" class=\"size-full wp-image-7189\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-mapping-column.jpg\" alt=\"Get the file path\" width=\"737\" height=\"631\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-mapping-column.jpg 737w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/ssis-mapping-column-300x257.jpg 300w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><p id=\"caption-attachment-7189\" class=\"wp-caption-text\">Send column 0 that contains the full path<\/p><\/div><\/li>\n<li>Finally, we will use the following expression for the argument property to encrypt all the txt\u00a0files of the ADO list:\n<pre class=\"lang:default highlight:0 decode:true\">\"--recipient \\\"Daniel Calbimonte\\\" --output \\\"\"+ @[User::filepath]+\".gpg\\\"\"+\" \r\n--encrypt \\\"\"+@[User::filepath]+\"\\\"\"<\/pre>\n<div id=\"attachment_7190\" style=\"width: 571px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/arguments-used-ssis.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7190\" class=\"size-full wp-image-7190\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/arguments-used-ssis.jpg\" alt=\"Expression to encrypt multiple files\" width=\"561\" height=\"503\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/arguments-used-ssis.jpg 561w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/arguments-used-ssis-300x269.jpg 300w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><\/a><p id=\"caption-attachment-7190\" class=\"wp-caption-text\">SSIS expression to encrypt multiple files<\/p><\/div><\/li>\n<\/ol>\n<h3>Troubleshooting PGP encryption using SSIS<\/h3>\n<ol>\n<li>First of all, if your package works in SSDT or VS and fails in the\u00a0agent, verify that you are using a proxy account with permissions to run the\u00a0gpg command line. For more information about SQL Agent proxies, refer to <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/ssms\/agent\/create-a-sql-server-agent-proxy?view=sql-server-2017\" target=\"_blank\" rel=\"noopener\">this link<\/a>.<\/li>\n<\/ol>\n<h2>References<\/h2>\n<p>For more information, refer to these links:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.glump.net\/howto\/cryptography\/practical-introduction-to-gnu-privacy-guard-in-windows#installing_in_other_operating_systems\" target=\"_blank\" rel=\"noopener\">Practical Introduction to GNU Privacy Guard in Windows<\/a><\/li>\n<li><a href=\"https:\/\/www.gnupg.org\/gph\/en\/manual\/book1.html\" target=\"_blank\" rel=\"noopener\">The GNU Privacy Handbook<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In this new article, we will show you how to perform PGP encryption using SSIS (encrypt \/ decrypt files using public \/ private key). Our previous article was about\u00a0SFTP using our SFTP task\u00a0for SSIS. Now we will show how to encrypt the information. Requirements First of all, you will need SSDT for\u00a0Business Intelligence for [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":7202,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,145,11],"tags":[500,192,499,501,498,12],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool) | ZappySys Blog<\/title>\r\n<meta name=\"description\" content=\"Learn how to perform PGP encryption using SSIS. Use FREE GPG Command line to encrypt, decrypt files, generate public \/ private key pair, loop files and more\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool) | ZappySys Blog\" \/>\r\n<meta property=\"og:description\" content=\"Learn how to perform PGP encryption using SSIS. Use FREE GPG Command line to encrypt, decrypt files, generate public \/ private key pair, loop files and more\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/\" \/>\r\n<meta property=\"og:site_name\" content=\"ZappySys Blog\" \/>\r\n<meta property=\"article:published_time\" content=\"2019-06-07T02:42:20+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2022-03-25T14:44:23+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"500\" \/>\r\n\t<meta property=\"og:image:height\" content=\"500\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"ZappySys Team\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ZappySys Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/\",\"url\":\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/\",\"name\":\"SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool) | ZappySys Blog\",\"isPartOf\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png\",\"datePublished\":\"2019-06-07T02:42:20+00:00\",\"dateModified\":\"2022-03-25T14:44:23+00:00\",\"author\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/91b041e2dcf7ece5f068893c1a68ac6e\"},\"description\":\"Learn how to perform PGP encryption using SSIS. Use FREE GPG Command line to encrypt, decrypt files, generate public \/ private key pair, loop files and more\",\"breadcrumb\":{\"@id\":\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#primaryimage\",\"url\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png\",\"contentUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png\",\"width\":500,\"height\":500},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/zappysys.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zappysys.com\/blog\/#website\",\"url\":\"https:\/\/zappysys.com\/blog\/\",\"name\":\"ZappySys Blog\",\"description\":\"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zappysys.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/91b041e2dcf7ece5f068893c1a68ac6e\",\"name\":\"ZappySys Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/746bec9c9d27f1b90bb181aa516ee234?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/746bec9c9d27f1b90bb181aa516ee234?s=96&d=mm&r=g\",\"caption\":\"ZappySys Team\"},\"sameAs\":[\"https:\/\/zappysys.com\"],\"url\":\"https:\/\/zappysys.com\/blog\/author\/dcalbimonte\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool) | ZappySys Blog","description":"Learn how to perform PGP encryption using SSIS. Use FREE GPG Command line to encrypt, decrypt files, generate public \/ private key pair, loop files and more","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/","og_locale":"en_US","og_type":"article","og_title":"SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool) | ZappySys Blog","og_description":"Learn how to perform PGP encryption using SSIS. Use FREE GPG Command line to encrypt, decrypt files, generate public \/ private key pair, loop files and more","og_url":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/","og_site_name":"ZappySys Blog","article_published_time":"2019-06-07T02:42:20+00:00","article_modified_time":"2022-03-25T14:44:23+00:00","og_image":[{"width":500,"height":500,"url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png","type":"image\/png"}],"author":"ZappySys Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ZappySys Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/","url":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/","name":"SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool) | ZappySys Blog","isPartOf":{"@id":"https:\/\/zappysys.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#primaryimage"},"image":{"@id":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#primaryimage"},"thumbnailUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png","datePublished":"2019-06-07T02:42:20+00:00","dateModified":"2022-03-25T14:44:23+00:00","author":{"@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/91b041e2dcf7ece5f068893c1a68ac6e"},"description":"Learn how to perform PGP encryption using SSIS. Use FREE GPG Command line to encrypt, decrypt files, generate public \/ private key pair, loop files and more","breadcrumb":{"@id":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#primaryimage","url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png","contentUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/pgp-encryption-logo.png","width":500,"height":500},{"@type":"BreadcrumbList","@id":"https:\/\/zappysys.com\/blog\/ssis-pgp-encryption-decryption\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zappysys.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SSIS PGP Encryption \/ Decryption (Using FREE GPG Tool)"}]},{"@type":"WebSite","@id":"https:\/\/zappysys.com\/blog\/#website","url":"https:\/\/zappysys.com\/blog\/","name":"ZappySys Blog","description":"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zappysys.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/91b041e2dcf7ece5f068893c1a68ac6e","name":"ZappySys Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/746bec9c9d27f1b90bb181aa516ee234?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/746bec9c9d27f1b90bb181aa516ee234?s=96&d=mm&r=g","caption":"ZappySys Team"},"sameAs":["https:\/\/zappysys.com"],"url":"https:\/\/zappysys.com\/blog\/author\/dcalbimonte\/"}]}},"_links":{"self":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/7161"}],"collection":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/comments?post=7161"}],"version-history":[{"count":26,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/7161\/revisions"}],"predecessor-version":[{"id":9572,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/7161\/revisions\/9572"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media\/7202"}],"wp:attachment":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media?parent=7161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/categories?post=7161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/tags?post=7161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}