View on GitHub

IDES Data Preparation - Unix

The IDES Data Preparation Unix repository demonstrates a sample shell script for FATCA data packaging.

Download this project as a .zip file Download this project as a tar.gz file

IDES Data Preparation

The International Data Exchange Service (IDES) is a secure managed file transfer service that allows financial institutions and tax authorities to securely send information on financial accounts held by U.S. taxpayers in accordance with the Foreign Account Tax Compliance Act (FATCA). Files transmitted via IDES must be encrypted and packaged in accordance with published data preparation instructions. The data preparation process is an important step to ensure that information transmitted via IDES conforms to U.S security standards to safeguard sensitive information.

The IDES Data Preparation Unix repository contains a sample shell script for packaging FATCA data in Unix. It has been tested in OS X El Capitan Version 10.11.5, Redhat CentOS6.7 and Ubuntu 16.04.1. Software frameworks for packaging FATCA data using .NET and Java are also available. Please note that there are many open market tools that produce the same results; however, the IRS does not endorse any commercial products, including any operating systems or software frameworks.

The shell script in this repository can create a FATCA data packet and decrypt a Notification. While it does not validate any of the XML, it can digitally sign, encrypt, compress and archive a FATCA data packet into a compliant .ZIP file. Furthermore, the shell script currently does not work for a Model 1 Option 2 FATCA Entity.

File Permissions

Using terminal, modify the access permissions for the shell scripts to your needs. For example, set owner read, write and execute permissions:

chmod 700 fatca_package.sh
chmod 700 fatca_unpack.sh
chmod 700 sample_package.sh
chmod 700 sample_unpack.sh

For other access permission options, consult the chmod man pages.

Data Packaging

To package FATCA data, update the following environment variables in sample_package.sh. The script sample_package.sh is a wrapper for fatca_package.sh:

UNSIGNED_XML_IN=yourUnsignedPayload.xml
RECEIVER_PUBLIC_CERT_IN=theReceiverPublic.cer
MY_PRIVATE_KEYSTORE_PKCS12_IN=yourPrivateKey.p12
MY_PRIVATE_KEYSTORE_PWD_IN=yourPrivateKeyPassword

Update the metadata information. For example, to send a FATCA Report for tax year 2015, with no revision indicator:

FATCAEntitySenderId=yourGIIN
FATCAEntityReceiverId=theReceiverGIIN
TaxYear=2015
FATCAEntCommunicationTypeCd=RPT
FileRevisionInd=false
SenderContactEmailAddressTxt=yourEmail@yourDomain.com

Save and execute the script.

Data Unpacking

To unpack a FATCA data packet (for example, to open and read a Notification) update the following environment variables in sample_unpack.sh. The script sample_unpack.sh is a wrapper for fatca_unpack.sh:

FATCA_PKG_IN=theDataPacketYouReceived.zip
MY_PRIVATE_KEYSTORE_PKCS12_IN=yourPrivateKey.p12
MY_PRIVATE_KEYSTORE_PWD_IN=yourPrivateKeyPassword

As an option, you can also validate the sender's signature:

SENDER_PUBLIC_CERT_IN=theSenderPublic.cer

Save and execute the script.

Disclaimer:

We waive copyright and related rights in the work worldwide through the CC0 1.0 Universal public domain dedication. Unless expressly stated otherwise, the person who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law. When using or citing the work, you should not imply endorsement by the author or the affirmer.