TlsConfig class

Configuration for TLS/SSL in the FTP server.

Provide either PEM file paths (certFilePath + keyFilePath) or a pre-built securityContext. For mutual TLS (client certificate validation), set requireClientCert to true and provide trustedCertificatesPath or a securityContext with trusted CAs.

Example with PEM files:

final config = TlsConfig(
  certFilePath: '/path/to/cert.pem',
  keyFilePath: '/path/to/key.pem',
);

Example with pre-built SecurityContext:

final ctx = SecurityContext()
  ..useCertificateChain('cert.pem')
  ..usePrivateKey('key.pem');
final config = TlsConfig(securityContext: ctx);

Constructors

TlsConfig({String? certFilePath, String? keyFilePath, String? trustedCertificatesPath, SecurityContext? securityContext, bool requireClientCert = false})
Creates a TLS configuration.
TlsConfig.fromPem({required String certificatePem, required String privateKeyPem})
Creates a TLS configuration from PEM-encoded strings instead of files.
factory

Properties

certFilePath → String?
Path to the PEM-encoded certificate chain file.
final
hashCode → int
The hash code for this object.
no setterinherited
keyFilePath → String?
Path to the PEM-encoded private key file.
final
requireClientCert → bool
Whether to require client certificates (mutual TLS).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
securityContext → SecurityContext?
A pre-built SecurityContext for advanced use cases.
final
trustedCertificatesPath → String?
Path to PEM-encoded trusted CA certificates for client certificate validation.
final

Methods

buildContext() → SecurityContext
Builds and returns a SecurityContext from this configuration.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited