SSLSecurity


CLASS

SSLSecurity

Swift
1open class SSLSecurity : SSLTrustValidator

Properties

validatedDN

Swift
1public var validatedDN = true

validateEntireChain

Swift
1public var validateEntireChain = true

Methods

init(usePublicKeys:)

Swift
1public convenience init(usePublicKeys: Bool = false)

Use certs from main app bundle

  • parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation

  • returns: a representation security object to be used with

Parameters

NameDescription
usePublicKeysis to specific if the publicKeys or certificates should be used for SSL pinning validation

init(certs:usePublicKeys:)

Swift
1public init(certs: [SSLCert], usePublicKeys: Bool)

Designated init

  • parameter certs: is the certificates or public keys to use

  • parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation

  • returns: a representation security object to be used with

Parameters

NameDescription
certsis the certificates or public keys to use
usePublicKeysis to specific if the publicKeys or certificates should be used for SSL pinning validation

isValid(_:domain:)

Swift
1open func isValid(_ trust: SecTrust, domain: String?) -> Bool

Valid the trust and domain name.

  • parameter trust: is the serverTrust to validate

  • parameter domain: is the CN domain to validate

  • returns: if the key was successfully validated

Parameters

NameDescription
trustis the serverTrust to validate
domainis the CN domain to validate

extractPublicKey(_:)

Swift
1public func extractPublicKey(_ data: Data) -> SecKey?

Get the public key from a certificate data

  • parameter data: is the certificate to pull the public key from

  • returns: a public key

Parameters

NameDescription
datais the certificate to pull the public key from

extractPublicKey(_:policy:)

Swift
1public func extractPublicKey(_ cert: SecCertificate, policy: SecPolicy) -> SecKey?

Get the public key from a certificate

  • parameter data: is the certificate to pull the public key from

  • returns: a public key

Parameters

NameDescription
datais the certificate to pull the public key from

certificateChain(_:)

Swift
1public func certificateChain(_ trust: SecTrust) -> [Data]

Get the certificate chain for the trust

  • parameter trust: is the trust to lookup the certificate chain for

  • returns: the certificate chain for the trust

Parameters

NameDescription
trustis the trust to lookup the certificate chain for

publicKeyChain(_:)

Swift
1public func publicKeyChain(_ trust: SecTrust) -> [SecKey]

Get the public key chain for the trust

  • parameter trust: is the trust to lookup the certificate chain and extract the public keys

  • returns: the public keys from the certifcate chain for the trust

Parameters

NameDescription
trustis the trust to lookup the certificate chain and extract the public keys
Feedback

Edit on GitHub

Forums