Script Library

Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.


jpmc_download_upload.s

Download

JPMorgan Chase supports numerous automated banking applications (Lockbox, PositivePay, ACH, etc.) over the internet.

Robo-FTP provides all the functionality needed to securely automate the process of uploading and downloading files with JPMorgan Chase.

Their requirements include:

  • A secure file transfer protocol such as FTPs, sFTP, or HTTPs (all supported by Robo-FTP)
  • A file encryption method such as PGP (supported by Robo-FTP)

This sample script will use sFTP, although you could use FTPs or HTTPs if you prefer.

JPMorgan Chase will provide the information you need to get connected and to encrypt files for uploading:

  • The URL for their sFTP server
  • The user name they have assigned to you
  • Their PGP public key (usually sent as a file attachment)

Once you have this information you can configure Robo-FTP. Here is a short summary of the steps you will need to complete in the Robo-FTP Configurator:

  1. Create an SSH key pair for authenticating to the sFTP server. This is done from the Configure SSH tab. The default settings are fine. Name the key file anything convenient (JPMorganChaseSSHKey is fine, for example).
  2. Email the public part of the SSH key to JPMorganChase. If you used the naming example given above, the public key will be named JPMorganChaseSSHKey.ssh2.
  3. If you plan to download files from JPMorgan Chase, create a PGP key pair from the Configure PGP tab. The default settings are fine.
  4. If you created a key pair in the preceding step, export the public part of that key and email it to JPMorgan Chase. You can export your public key by clicking the Manage Keys button in the Configure PGP tab.
  5. If you plan to upload files to JPMorgan Chase, you need to import their public key. You can import a public key by clicking the Manage Keys button in the Configure PGP tab.

The sample script below demonstrates how easy it is to communicate with JPMorgan Chase's sFTP server with Robo-FTP. This sample script logs on, encrypts and uploads any files to the incoming directory, then downloads and decrypts any files waiting for you in the outgoing directory.

PGP Hints

  1. Some programs require a digital signature without encryption, in this situation your script should use the PGPSIGN command instead of PGPENCRYPT.
  2. PGP keys generated by Robo-FTP 3.9.7 and earlier always contain a signing key that is one half the size of the encryption key. Therefore, if your program requires a 2048 bit signing key you should generate a 4096 bit RSA key in the Configurator. Beginning with version 3.9.8 both keys are the same size with the notable exception that DSA does not support signing keys over 2048 bits.

  1  ;;JPMC site definition from the configurator
  2  ftplogon "JPMCManagedSite"
  3  ;; Encrypt and upload files
  4  ftpcd "incoming"
  5  workingdir "c:\JPMC\uploads"
  6  :upload_loop
  7  getnextfile "*" /oldest 
  8  IFERROR GOTO download_files
  9  set encrypted_file = %nextfile + ".pgp"
 10  PGPENCRYPT %nextfile encrypted_file /encryptfor="JPMC" /compat 
 11  sendfile encrypted_file /delete 
 12  delete %nextfile
 13  goto upload_loop
 14  :download_files
 15  ;; Download and decrypt files
 16  ftpcd "../outgoing"
 17  workingdir "c:\JPMC\downloads"
 18  :download_loop
 19  getsitefile "*.pgp" /oldest 
 20  IFERROR RETURN $ERROR_SUCCESS
 21  rcvfile %sitefile /delete 
 22  SETREPLACE decrypted_file = %sitefile ".pgp" ""
 23  pgpdecrypt %sitefile decrypted_file
 24  delete %sitefile
 25  GOTO download_loop

Browse complete list of scripts