Skip to main content

Secure FTPS client with mutual SSL authentication for CAD medical institutions

Project description

CAD FTPS Client

Secure FTPS client with mutual SSL authentication for CAD medical institutions.

Features

  • Implicit FTPS (port 990) with mutual SSL authentication
  • TLS 1.3 support with client/server certificates
  • Chunked uploads with configurable size and progress callbacks
  • Professional error handling with specialized exceptions
  • High-level API built on ftputil for ease of use

Installation

pip install cad-ftps-client

Quick Start

from cad_ftps_client import SecureFTPSClient

# Initialize client with certificates
client = SecureFTPSClient(
    host="ftps.hospital.fr",
    port=990,
    cert_file="/path/to/client-cert.pem",
    key_file="/path/to/client-key.pem", 
    ca_file="/path/to/ca-cert.pem"
)

# Connect and transfer files
with client.connect("username", "password") as host:
    # Upload files
    host.upload("local_file.txt", "remote_file.txt")
    
    # List directory
    files = host.listdir("/remote/path")
    
    # Download files
    host.download("remote_file.txt", "local_file.txt")
    
    # Create directories
    host.makedirs("/remote/new/path")

Advanced Usage

Chunked Upload with Progress

def progress_callback(chunk):
    print(f"Uploaded {len(chunk)} bytes")

with client.connect("username", "password") as host:
    # Upload with custom chunk size and progress callback
    host.upload_chunked(
        "large_file.dat", 
        "remote_large_file.dat",
        chunk_size=1024*1024,  # 1MB chunks
        callback=progress_callback
    )

Error Handling

from cad_ftps_client.exceptions import (
    FTPSConnectionError,
    FTPSAuthenticationError,
    FTPSCertificateError,
    FTPSTransferError
)

try:
    with client.connect("username", "password") as host:
        host.upload("file.txt", "remote.txt")
except FTPSConnectionError:
    print("Failed to connect to FTPS server")
except FTPSAuthenticationError:
    print("Invalid credentials")
except FTPSCertificateError:
    print("Certificate validation failed")
except FTPSTransferError:
    print("File transfer failed")

Certificate Requirements

The client requires three certificate files:

  • Client Certificate (client-cert.pem): Your institution's certificate
  • Private Key (client-key.pem): Private key for client certificate
  • CA Certificate (ca-cert.pem): Certificate Authority to validate server

Configuration

Environment Variables

  • FTPS_TIMEOUT: Connection timeout in seconds (default: 30)
  • FTPS_CHUNK_SIZE: Upload chunk size in bytes (default: 524288)
  • FTPS_LOG_LEVEL: Logging level (DEBUG, INFO, WARNING, ERROR)

TLS Configuration

The client enforces strong security by default:

  • TLS 1.3 only (configurable)
  • Certificate verification required
  • Hostname checking enabled
  • Strong cipher suites only

Development

Setup Development Environment

git clone https://github.com/neil-atr/cad-ftps-client
cd cad-ftps-client
pip install -e ".[dev]"

Run Tests

pytest

Code Formatting

black src/ tests/
isort src/ tests/
flake8 src/ tests/

License

MIT License - see LICENSE file.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

Support

For issues and questions:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cad_ftps_client-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cad_ftps_client-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file cad_ftps_client-1.0.0.tar.gz.

File metadata

  • Download URL: cad_ftps_client-1.0.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for cad_ftps_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 70a8a6f8075fe7eead41415d17c84fc219df11ec38d9b8f625473d1d3888796d
MD5 53a82a1ef202d379588b1d6f7f1e150d
BLAKE2b-256 39c5e4a14ae4c25378e93ea29e45e5872236c26af019d07b6ce32024ab597547

See more details on using hashes here.

File details

Details for the file cad_ftps_client-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cad_ftps_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0911da9fd4259998ba5ce39b5274a4b03748bb79ddb50bdfabd35ac8fca1a70
MD5 fd0b10777864825452823366196bc306
BLAKE2b-256 a0c48acbceeea7ed9439df79b1844325b7a807e30d96dc3332591dcba484feec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page