Metadata-Version: 2.4
Name: cad-ftps-client
Version: 1.0.0
Summary: Secure FTPS client with mutual SSL authentication for CAD medical institutions
Project-URL: Homepage, https://github.com/neil-atr/cad-ftps-client
Project-URL: Documentation, https://github.com/neil-atr/cad-ftps-client#readme
Project-URL: Repository, https://github.com/neil-atr/cad-ftps-client
Project-URL: Issues, https://github.com/neil-atr/cad-ftps-client/issues
License: MIT License
        
        Copyright (c) 2024 Neil Anteur
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Healthcare Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: File Transfer Protocol (FTP)
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Networking
Requires-Python: >=3.12
Requires-Dist: ftputil>=5.0.0
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: flake8; extra == 'dev'
Requires-Dist: isort; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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

```bash
pip install cad-ftps-client
```

## Quick Start

```python
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

```python
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

```python
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

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

### Run Tests

```bash
pytest
```

### Code Formatting

```bash
black src/ tests/
isort src/ tests/
flake8 src/ tests/
```

## License

MIT License - see [LICENSE](LICENSE) file.

## Contributing

Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## Support

For issues and questions:
- GitHub Issues: https://github.com/neil-atr/cad-ftps-client/issues
- Email: neil.anteur@gmail.com