Bitzsoft.Integrations.FileExchange 1.0.0-alpha.10

This is a prerelease version of Bitzsoft.Integrations.FileExchange.
dotnet add package Bitzsoft.Integrations.FileExchange --version 1.0.0-alpha.10
                    
NuGet\Install-Package Bitzsoft.Integrations.FileExchange -Version 1.0.0-alpha.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.FileExchange" Version="1.0.0-alpha.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.FileExchange" Version="1.0.0-alpha.10" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.FileExchange" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.FileExchange --version 1.0.0-alpha.10
                    
#r "nuget: Bitzsoft.Integrations.FileExchange, 1.0.0-alpha.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.FileExchange@1.0.0-alpha.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.FileExchange&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.FileExchange&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.FileExchange

面向国内与国际 ToB 文件交换场景的通用 SFTP/FTPS 客户端,目标框架为 net5.0;net8.0;net10.0

安装

dotnet add package Bitzsoft.Integrations.FileExchange

已实现

  • SFTP、explicit FTPS、implicit FTPS;
  • 密码、SSH 私钥、FTPS 客户端证书;
  • 强制 SFTP SHA-256 host-key pin;
  • FTPS 系统信任、系统信任加证书 pin、仅 pin 三种显式策略;
  • 目录根白名单与路径穿越防护,默认不跟随或返回符号链接;
  • 递归列举、stat、上传、下载、移动和幂等删除;
  • 上传、下载断点续传,以及 staging rename 原子发布和失败回滚;
  • 流式 OpenPGP AES-256 加密、解密和完整性验证;
  • Files 清单到 Sync Engine 的增量 page source;
  • 多租户端点及凭据解析。

上传、下载和 OpenPGP 处理均为流式实现,不限制或截断文件大小。宿主若启用 RequestLogging,其默认行为同样应记录完整正文;大小限制只能是显式可选策略。

注册

services.AddVaultCredentialResolver(); // 宿主实现 IIntegrationCredentialResolver
services.AddBitzsoftFileExchange(
    new FileExchangeEndpoint(
        FileExchangeProtocol.Sftp,
        host: "sftp.partner.example",
        remoteRoot: "/inbound/acme",
        authenticationMode: FileExchangeAuthenticationMode.PrivateKey,
        hostKeySha256Pins: new[] { "SHA256:base64-pin" }));

每次调用都携带显式租户上下文:

var context = new FileExchangeRequestContext(
    tenantId: "customer-a",
    region: "cn",
    environment: IntegrationEnvironments.Production,
    credentialName: "partner-sftp");

await client.UploadAsync(
    context,
    "orders/2026-07-24.json.pgp",
    source,
    new FileExchangeUploadOptions
    {
        Atomic = true,
        Resume = false,
        CreateDirectories = true,
        PgpEncryption = new PgpEncryptionOptions
        {
            CredentialName = "partner-pgp",
            FileName = "orders.json"
        }
    },
    cancellationToken);

不同租户使用不同服务器时,实现 IFileExchangeEndpointResolver 并注册:

services.AddBitzsoftFileExchange<TenantFileExchangeEndpointResolver>();

安全与兼容性默认值

  • SFTP 不提供隐式 TOFU;端点必须至少配置一个 host-key pin。
  • FTPS 默认 EPSV。仅旧服务端确有需要时显式设置 usePasvWithControlHost: true,实现使用 PASVEX 并忽略服务端返回的其他主机地址。
  • FTPS 不接受“任意证书”。企业自签名证书应显式使用 PinOnly 并配置 pin。
  • 远端路径只能是端点白名单根下的规范化相对路径。
  • OpenPGP 加解密不能安全续传,选项组合会在传输前被拒绝。
  • 调用方传入的输入、输出流不由客户端释放。

清单同步语义与限制

FileExchangeSyncPageSource 只接受 Files stream,输出文件元数据,不下载文件正文。 它使用固定运行水位和 (lastModified, relativePath) keyset cursor。缺少修改时间的 文件会在每次增量运行中重复输出,以避免静默漏数。

SFTP/FTPS 没有标准 change token、一致目录快照或删除事件。运行期间目录变化仍可能造成 重复或延迟发现,删除也不能由增量清单发现;生产任务必须保证 sink 幂等,并周期性执行 全量对账。首次接入还应在真实 sandbox 验证 rename 原子性、时间精度、递归 listing、 大文件续传和服务端并发限制。

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.FileExchange:

Package Downloads
Bitzsoft.Integrations.All

Bitzsoft 第三方集成聚合包 — net5.0 包含传统连接器,net8.0+ 额外包含受上游 TFM 限制的 AI 模块

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.10 53 7/26/2026