Skip to content

feat: add SetCipherList to override TLS 1.2 cipher list - #200

Closed
freitasjca wants to merge 1 commit into
winddriver:masterfrom
freitasjca:feat/set-cipher-list
Closed

feat: add SetCipherList to override TLS 1.2 cipher list#200
freitasjca wants to merge 1 commit into
winddriver:masterfrom
freitasjca:feat/set-cipher-list

Conversation

@freitasjca

@freitasjca freitasjca commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • Adds SetCipherList(const ACipherList: string) as a virtual; abstract method on TCrossSslSocketBase
  • Implements it in TCrossOpenSslSocket via SSL_CTX_set_cipher_list, wrapped in the existing BeginTlsConfigUpdate/EndTlsConfigUpdate pair
  • Empty string is a no-op (leaves the context default untouched)
  • An unrecognised cipher string raises ESsl at call site rather than silently falling back

Motivation

Some deployments need to restrict TLS 1.2 to a custom cipher list (e.g. to comply with FIPS or PCI-DSS profiles) without forking the library. SetCipherList exposes the already-bound SSL_CTX_set_cipher_list through the public API.

Notes

  • TLS 1.3 cipher suites are controlled separately by SSL_CTX_set_ciphersuites (not changed here)
  • The existing SSL_CTX_set_cipher_list binding in Net.OpenSSL.pas is reused — no new import needed
  • Follows the same pattern as SetCertificate, SetPrivateKey, and AddCACertificate

Add an abstract SetCipherList method to TCrossSslSocketBase and
implement it in TCrossOpenSslSocket via SSL_CTX_set_cipher_list.

Empty string is a no-op. An unrecognised cipher string (no matching
ciphers) raises ESsl at call time rather than silently falling back
to the context default.
@winddriver

Copy link
Copy Markdown
Owner

Thank you for contributing the cipher-list configuration code and for raising this use case.

We have now added explicit cipher-suite configuration APIs to ICrossSslSocket for both TLS versions:

  • SetTls12CipherSuites(const ACipherRules: string) configures TLS 1.2 cipher rules through SSL_CTX_set_cipher_list.
  • SetTls13CipherSuites(const ACipherSuites: string) configures TLS 1.3 cipher suites through SSL_CTX_set_ciphersuites.

The implementation also provides default cipher-suite constants for both versions and reuses the existing TLS configuration locking and error handling. The version-specific names make the scope of each API clear to callers.

Since this functionality is now covered by the implementation, we are closing this PR without merging its original branch.

Thanks again for your contribution and the code you shared!

@winddriver winddriver closed this Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants