In today’s digital landscape, secure and efficient data exchange is crucial for businesses. The AS2 Gateway supports SFTP (Secure File Transfer Protocol) for transmitting large files, enhancing security, reliability, and operational efficiency. This guide explains how to exchange messages using SFTP with AS2 Gateway.
AS2 Gateway is a secure message exchange solution that enables businesses to transmit files using the AS2 protocol. It supports on-premises, cloud, and containerized deployments and is available as a desktop application or hosted SaaS solution. While it does not natively support SFTP, it offers SFTP integration for submitting and retrieving AS2-transmitted files. AS2 Gateway ensures secure, scalable, and efficient file exchanges with multiple integration options like REST APIs, Webhooks, SFTP and AWS S3 integration.
SFTP operates over SSH (Secure Shell) and provides encrypted file transfer capabilities. Unlike traditional FTP, SFTP encrypts both commands and data, ensuring a secure file transfer environment. It is particularly useful when exchanging large amounts of files between systems securely.
Enhanced Security: Both protocols provide robust security measures, ensuring that sensitive business data is protected during transmission.
Operational Efficiency: Allows for automated and scheduled file transfers, reducing manual intervention and potential errors.
Regulatory Compliance: Helps businesses meet compliance standards, particularly in industries like healthcare and supply chain management (EDI X12), which require secure data exchanges.
Automation Capability: Streamlines and automates file transfers for greater efficiency.
The AS2 Gateway runs an SFTP server, allowing users to download received files and upload files for transmission.
Navigate to the SFTP Feature page in the AS2 Gateway interface by clicking the SFTP icon in the Integrations menu on the left navigation pane.
If you have not already set up SFTP integration the below page will appear, allowing you to enable the integration.
Once SFTP is set up, you can connect to the AS2 Gateway server using any SFTP client (e.g., OpenSSH, WinSCP, FileZilla) and exchange files securely.
Server: sftp.as2gateway.com
Port: 9193
Authentication: Key-based authentication
After the setup completes, the SFTP view will show the instructions on connecting to the AS2 Gateway SFTP server via the command line for Linux and MacOS users.
Download the private key from the SFTP view.
Navigate to the directory where the private key resides through terminal and set correct file permissions using following command:
sudo chmod 400 private_key_file
Run the following SFTP login command to connect the AS2 Gateway SFTP server:
sftp -P 9193 -i private_key_file <user_name>@sftp.as2gateway.com
Enter the passphrase when prompted.(The first time you run the command, you will be asked for the private key passphrase)
Open WinSCP and convert the private key into Putty format (PPK) using PuTTYgen.
Create a New Site with the following details
Host: sftp.as2gateway.com
Port: 9193
User:
Authentication: Click ‘Advanced’ and use the PPK format private key file under SSH -> Authentication.
Open FileZilla and create a New Site by providing the SFTP information.
Set the logon type as a Key file.
Select the key file downloaded from the AS2 Gateway. It will prompt you to convert the key and ask for the passphrase. Once entered, the key will be saved in PPK format at a location selected by you.
SFTP integration in AS2 Gateway follows a structured directory system
Top-Level Directories:
.ssh: Contains configuration files related to SFTP login.
as2gateway: Main data directory.
Inside as2gateway Folder:
Each AS2 Station has a corresponding folder:
Each AS2 Partner within a station has a folder:
Subdirectories under each AS2 Partner folder:
outbox: Files placed here will be sent via AS2.
inbox: Received AS2 messages are stored here.
failed: Files that failed to send are placed here.
Note that in AS2 Gateway, Test partners have their message folders inside an additional test subfolder, allowing separate configurations for test and production connections while using the same AS2 identifier (Partner Types | Aayu Technologies).
For example, if ALIBB is a test partner under the station alice, its folders will be:
as2gateway/alice/ALIBB/test/inbox
as2gateway/alice/ALIBB/test/outbox
as2gateway/alice/ALIBB/test/error
There are two modes of sending files.
To send a single file as an AS2 message, simply upload the file to the respective outbox and AS2 Gateway will pick it up and queue it for delivery, within a maximum of 30 seconds.
put <local path>/<filename> as2gateway/<station ID>/<partner ID>/outbox/
To send multiple files in a single AS2 message, create a folder inside the outbox, and place all files into it.
AS2 Gateway will process and enqueue the folder content, two minutes after the last file is uploaded.
cd as2gateway/<station ID>/<partner ID>/outbox/
mkdir <a unique folder name; say "20250101101035">
cd 20250101101035/
put <file 1>
put <file 2>
...
put <file n>
Files received to an AS2 station will appear in the inbox folder
as2gateway/<AS2-Station-ID>/<AS2-Partner-ID>/inbox
The file saving path depends on the receiving trading station’s inbox folder structure configurations (AS2 Gateway - Creating an AS2 Station | Aayu Technologies).You can fetch the file using the SFTP get command.
If a file fails to send, it will appear in the failed folder
as2gateway/<AS2-Station-ID>/<AS2-Partner-ID>/failed
Fore more details, Refer : AS2 Gateway - SFTP Integration | Aayu Technologies
Integrating AS2 Gateway with SFTP ensures secure, efficient file exchanges, enhancing data security, compliance, and operational efficiency. It reduces manual intervention and streamlines data transfer, making AS2 Gateway a powerful solution for enterprise communication.