Skip to content

Support Non-Default TrustRoots on Darwin #292

Closed
@PeterAdams-A

Description

@PeterAdams-A

Currently lots of the TLS options are not supported on Darwin - see

preconditionFailure("TLSConfiguration.trustRoots != .default is not supported")

Rough instructions of how to implement (thanks @Lukasa)

  1. Set a verify block using https://developer.apple.com/documentation/security/2976289-sec_protocol_options_set_verify_.
  2. Create a SecTrust from the data you get there: https://github.com/apple/swift-nio-ssl/blob/7932e709af56d27035084ca918bdd729b4084741/Sources/NIOSSL/SecurityFrameworkCertificateVerification.swift#L47
  3. Call SecTrustSetAnchorCertificates with the custom roots: https://developer.apple.com/documentation/security/1396098-sectrustsetanchorcertificates
  4. Call SecTrustSetAnchorCertificatesOnly with anchorCertificatesOnly: true https://developer.apple.com/documentation/security/1399071-sectrustsetanchorcertificatesonl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions