Skip to content
leeway edited this page Nov 19, 2021 · 1 revision

SSLSecurity

!((os(Linux)))
open class SSLSecurity : SSLTrustValidator 

Inheritance

SSLTrustValidator

Initializers

init(usePublicKeys:)

!((os(Linux)))

Use certs from main app bundle

public convenience init(usePublicKeys: Bool = false) 

Parameters

  • 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

init(certs:usePublicKeys:)

!((os(Linux)))

Designated init

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

Parameters

  • certs: is the certificates or public keys to use
  • 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

Properties

validatedDN

!((os(Linux)))
public var validatedDN = true 

validateEntireChain

!((os(Linux)))
public var validateEntireChain = true 

Methods

isValid(_:domain:)

!((os(Linux)))

Valid the trust and domain name.

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

Parameters

  • trust: is the serverTrust to validate
  • domain: is the CN domain to validate

Returns

if the key was successfully validated

extractPublicKey(_:)

!((os(Linux)))

Get the public key from a certificate data

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

Parameters

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

Returns

a public key

extractPublicKey(_:policy:)

!((os(Linux)))

Get the public key from a certificate

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

Parameters

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

Returns

a public key

certificateChain(_:)

!((os(Linux)))

Get the certificate chain for the trust

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

Parameters

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

Returns

the certificate chain for the trust

publicKeyChain(_:)

!((os(Linux)))

Get the public key chain for the trust

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

Parameters

  • 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

Types
Protocols
Global Variables
Clone this wiki locally