Documentation Archive Developer
Search

Security Changes for Swift

Security

DeclarationProtocols
From
struct SecAccessControlCreateFlags : OptionSetType {
    init(rawValue rawValue: CFIndex)
    static var UserPresence: SecAccessControlCreateFlags { get }
    static var TouchIDAny: SecAccessControlCreateFlags { get }
    static var TouchIDCurrentSet: SecAccessControlCreateFlags { get }
    static var DevicePasscode: SecAccessControlCreateFlags { get }
    static var Or: SecAccessControlCreateFlags { get }
    static var And: SecAccessControlCreateFlags { get }
    static var PrivateKeyUsage: SecAccessControlCreateFlags { get }
    static var ApplicationPassword: SecAccessControlCreateFlags { get }
}
OptionSetType
To
struct SecAccessControlCreateFlags : OptionSet {
    init(rawValue rawValue: CFOptionFlags)
    static var userPresence: SecAccessControlCreateFlags { get }
    static var touchIDAny: SecAccessControlCreateFlags { get }
    static var touchIDCurrentSet: SecAccessControlCreateFlags { get }
    static var devicePasscode: SecAccessControlCreateFlags { get }
    static var or: SecAccessControlCreateFlags { get }
    static var and: SecAccessControlCreateFlags { get }
    static var privateKeyUsage: SecAccessControlCreateFlags { get }
    static var applicationPassword: SecAccessControlCreateFlags { get }
    func intersect(_ other: SecAccessControlCreateFlags) -> SecAccessControlCreateFlags
    func exclusiveOr(_ other: SecAccessControlCreateFlags) -> SecAccessControlCreateFlags
    mutating func unionInPlace(_ other: SecAccessControlCreateFlags)
    mutating func intersectInPlace(_ other: SecAccessControlCreateFlags)
    mutating func exclusiveOrInPlace(_ other: SecAccessControlCreateFlags)
    func isSubsetOf(_ other: SecAccessControlCreateFlags) -> Bool
    func isDisjointWith(_ other: SecAccessControlCreateFlags) -> Bool
    func isSupersetOf(_ other: SecAccessControlCreateFlags) -> Bool
    mutating func subtractInPlace(_ other: SecAccessControlCreateFlags)
    func isStrictSupersetOf(_ other: SecAccessControlCreateFlags) -> Bool
    func isStrictSubsetOf(_ other: SecAccessControlCreateFlags) -> Bool
}
extension SecAccessControlCreateFlags {
    func union(_ other: SecAccessControlCreateFlags) -> SecAccessControlCreateFlags
    func intersection(_ other: SecAccessControlCreateFlags) -> SecAccessControlCreateFlags
    func symmetricDifference(_ other: SecAccessControlCreateFlags) -> SecAccessControlCreateFlags
}
extension SecAccessControlCreateFlags {
    func contains(_ member: SecAccessControlCreateFlags) -> Bool
    mutating func insert(_ newMember: SecAccessControlCreateFlags) -> (inserted: Bool, memberAfterInsert: SecAccessControlCreateFlags)
    mutating func remove(_ member: SecAccessControlCreateFlags) -> SecAccessControlCreateFlags?
    mutating func update(with newMember: SecAccessControlCreateFlags) -> SecAccessControlCreateFlags?
}
extension SecAccessControlCreateFlags {
    convenience init()
    mutating func formUnion(_ other: SecAccessControlCreateFlags)
    mutating func formIntersection(_ other: SecAccessControlCreateFlags)
    mutating func formSymmetricDifference(_ other: SecAccessControlCreateFlags)
}
extension SecAccessControlCreateFlags {
    convenience init<S : Sequence where S.Iterator.Element == SecAccessControlCreateFlags>(_ sequence: S)
    convenience init(arrayLiteral arrayLiteral: SecAccessControlCreateFlags...)
    mutating func subtract(_ other: SecAccessControlCreateFlags)
    func isSubset(of other: SecAccessControlCreateFlags) -> Bool
    func isSuperset(of other: SecAccessControlCreateFlags) -> Bool
    func isDisjoint(with other: SecAccessControlCreateFlags) -> Bool
    func subtracting(_ other: SecAccessControlCreateFlags) -> SecAccessControlCreateFlags
    var isEmpty: Bool { get }
    func isStrictSuperset(of other: SecAccessControlCreateFlags) -> Bool
    func isStrictSubset(of other: SecAccessControlCreateFlags) -> Bool
}
OptionSet

Declaration
From
static var And: SecAccessControlCreateFlags { get }
To
static var and: SecAccessControlCreateFlags { get }

Declaration
From
static var ApplicationPassword: SecAccessControlCreateFlags { get }
To
static var applicationPassword: SecAccessControlCreateFlags { get }

Declaration
From
static var DevicePasscode: SecAccessControlCreateFlags { get }
To
static var devicePasscode: SecAccessControlCreateFlags { get }

Declaration
From
static var Or: SecAccessControlCreateFlags { get }
To
static var or: SecAccessControlCreateFlags { get }

Declaration
From
static var PrivateKeyUsage: SecAccessControlCreateFlags { get }
To
static var privateKeyUsage: SecAccessControlCreateFlags { get }

Declaration
From
static var TouchIDAny: SecAccessControlCreateFlags { get }
To
static var touchIDAny: SecAccessControlCreateFlags { get }

Declaration
From
static var TouchIDCurrentSet: SecAccessControlCreateFlags { get }
To
static var touchIDCurrentSet: SecAccessControlCreateFlags { get }

Declaration
From
static var UserPresence: SecAccessControlCreateFlags { get }
To
static var userPresence: SecAccessControlCreateFlags { get }

DeclarationProtocols
From
struct SecPadding : OptionSetType {
    init(rawValue rawValue: UInt32)
    static var None: SecPadding { get }
    static var PKCS1: SecPadding { get }
    static var OAEP: SecPadding { get }
    static var SigRaw: SecPadding { get }
    static var PKCS1MD2: SecPadding { get }
    static var PKCS1MD5: SecPadding { get }
    static var PKCS1SHA1: SecPadding { get }
    static var PKCS1SHA224: SecPadding { get }
    static var PKCS1SHA256: SecPadding { get }
    static var PKCS1SHA384: SecPadding { get }
    static var PKCS1SHA512: SecPadding { get }
}
OptionSetType
To
struct SecPadding : OptionSet {
    init(rawValue rawValue: UInt32)
    static var none: SecPadding { get }
    static var PKCS1: SecPadding { get }
    static var OAEP: SecPadding { get }
    static var sigRaw: SecPadding { get }
    static var PKCS1MD2: SecPadding { get }
    static var PKCS1MD5: SecPadding { get }
    static var PKCS1SHA1: SecPadding { get }
    static var PKCS1SHA224: SecPadding { get }
    static var PKCS1SHA256: SecPadding { get }
    static var PKCS1SHA384: SecPadding { get }
    static var PKCS1SHA512: SecPadding { get }
    func intersect(_ other: SecPadding) -> SecPadding
    func exclusiveOr(_ other: SecPadding) -> SecPadding
    mutating func unionInPlace(_ other: SecPadding)
    mutating func intersectInPlace(_ other: SecPadding)
    mutating func exclusiveOrInPlace(_ other: SecPadding)
    func isSubsetOf(_ other: SecPadding) -> Bool
    func isDisjointWith(_ other: SecPadding) -> Bool
    func isSupersetOf(_ other: SecPadding) -> Bool
    mutating func subtractInPlace(_ other: SecPadding)
    func isStrictSupersetOf(_ other: SecPadding) -> Bool
    func isStrictSubsetOf(_ other: SecPadding) -> Bool
}
extension SecPadding {
    func union(_ other: SecPadding) -> SecPadding
    func intersection(_ other: SecPadding) -> SecPadding
    func symmetricDifference(_ other: SecPadding) -> SecPadding
}
extension SecPadding {
    func contains(_ member: SecPadding) -> Bool
    mutating func insert(_ newMember: SecPadding) -> (inserted: Bool, memberAfterInsert: SecPadding)
    mutating func remove(_ member: SecPadding) -> SecPadding?
    mutating func update(with newMember: SecPadding) -> SecPadding?
}
extension SecPadding {
    convenience init()
    mutating func formUnion(_ other: SecPadding)
    mutating func formIntersection(_ other: SecPadding)
    mutating func formSymmetricDifference(_ other: SecPadding)
}
extension SecPadding {
    convenience init<S : Sequence where S.Iterator.Element == SecPadding>(_ sequence: S)
    convenience init(arrayLiteral arrayLiteral: SecPadding...)
    mutating func subtract(_ other: SecPadding)
    func isSubset(of other: SecPadding) -> Bool
    func isSuperset(of other: SecPadding) -> Bool
    func isDisjoint(with other: SecPadding) -> Bool
    func subtracting(_ other: SecPadding) -> SecPadding
    var isEmpty: Bool { get }
    func isStrictSuperset(of other: SecPadding) -> Bool
    func isStrictSubset(of other: SecPadding) -> Bool
}
OptionSet

Declaration
From
static var SigRaw: SecPadding { get }
To
static var sigRaw: SecPadding { get }

Declaration
From
func SecAccessControlCreateWithFlags(_ allocator: CFAllocator?, _ protection: AnyObject, _ flags: SecAccessControlCreateFlags, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>) -> SecAccessControl?
To
func SecAccessControlCreateWithFlags(_ allocator: CFAllocator?, _ protection: CFTypeRef, _ flags: SecAccessControlCreateFlags, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> SecAccessControl?

Declaration
From
func SecAddSharedWebCredential(_ fqdn: CFString, _ account: CFString, _ password: CFString?, _ completionHandler: (CFError?) -> Void)
To
func SecAddSharedWebCredential(_ fqdn: CFString, _ account: CFString, _ password: CFString?, _ completionHandler: @escaping (CFError?) -> Swift.Void)

Declaration
From
func SecItemAdd(_ attributes: CFDictionary, _ result: UnsafeMutablePointer<AnyObject?>) -> OSStatus
To
func SecItemAdd(_ attributes: CFDictionary, _ result: UnsafeMutablePointer<CFTypeRef?>?) -> OSStatus

Declaration
From
func SecItemCopyMatching(_ query: CFDictionary, _ result: UnsafeMutablePointer<AnyObject?>) -> OSStatus
To
func SecItemCopyMatching(_ query: CFDictionary, _ result: UnsafeMutablePointer<CFTypeRef?>?) -> OSStatus

Declaration
From
func SecKeyGeneratePair(_ parameters: CFDictionary, _ publicKey: UnsafeMutablePointer<SecKey?>, _ privateKey: UnsafeMutablePointer<SecKey?>) -> OSStatus
To
func SecKeyGeneratePair(_ parameters: CFDictionary, _ publicKey: UnsafeMutablePointer<SecKey?>?, _ privateKey: UnsafeMutablePointer<SecKey?>?) -> OSStatus

Declaration
From
func SecPolicyCopyProperties(_ policyRef: SecPolicy) -> CFDictionary
To
func SecPolicyCopyProperties(_ policyRef: SecPolicy) -> CFDictionary?

Declaration
From
func SecPolicyCreateRevocation(_ revocationFlags: CFOptionFlags) -> SecPolicy
To
func SecPolicyCreateRevocation(_ revocationFlags: CFOptionFlags) -> SecPolicy?

Declaration
From
func SecPolicyCreateWithProperties(_ policyIdentifier: AnyObject, _ properties: CFDictionary?) -> SecPolicy
To
func SecPolicyCreateWithProperties(_ policyIdentifier: CFTypeRef, _ properties: CFDictionary?) -> SecPolicy?

Declaration
From
func SecRandomCopyBytes(_ rnd: SecRandomRef, _ count: Int, _ bytes: UnsafeMutablePointer<UInt8>) -> Int32
To
func SecRandomCopyBytes(_ rnd: SecRandomRef?, _ count: Int, _ bytes: UnsafeMutablePointer<UInt8>) -> Int32

Modified SecRandomRef
Declaration
From
typealias SecRandomRef = COpaquePointer
To
typealias SecRandomRef = OpaquePointer

Declaration
From
func SecRequestSharedWebCredential(_ fqdn: CFString?, _ account: CFString?, _ completionHandler: (CFArray?, CFError?) -> Void)
To
func SecRequestSharedWebCredential(_ fqdn: CFString?, _ account: CFString?, _ completionHandler: @escaping (CFArray?, CFError?) -> Swift.Void)

Declaration
From
typealias SecTrustCallback = (SecTrust, SecTrustResultType) -> Void
To
typealias SecTrustCallback = (SecTrust, SecTrustResultType) -> Swift.Void

Declaration
From
func SecTrustCreateWithCertificates(_ certificates: AnyObject, _ policies: AnyObject?, _ trust: UnsafeMutablePointer<SecTrust?>) -> OSStatus
To
func SecTrustCreateWithCertificates(_ certificates: CFTypeRef, _ policies: CFTypeRef?, _ trust: UnsafeMutablePointer<SecTrust?>) -> OSStatus

Declaration
From
func SecTrustEvaluate(_ trust: SecTrust, _ result: UnsafeMutablePointer<SecTrustResultType>) -> OSStatus
To
func SecTrustEvaluate(_ trust: SecTrust, _ result: UnsafeMutablePointer<SecTrustResultType>?) -> OSStatus

Declaration
From
func SecTrustEvaluateAsync(_ trust: SecTrust, _ queue: dispatch_queue_t?, _ result: SecTrustCallback) -> OSStatus
To
func SecTrustEvaluateAsync(_ trust: SecTrust, _ queue: DispatchQueue?, _ result: Security.SecTrustCallback) -> OSStatus

Declaration
From
func SecTrustSetExceptions(_ trust: SecTrust, _ exceptions: CFData) -> Bool
To
func SecTrustSetExceptions(_ trust: SecTrust, _ exceptions: CFData?) -> Bool

Declaration
From
func SecTrustSetOCSPResponse(_ trust: SecTrust, _ responseData: AnyObject?) -> OSStatus
To
func SecTrustSetOCSPResponse(_ trust: SecTrust, _ responseData: CFTypeRef?) -> OSStatus

Declaration
From
func SecTrustSetPolicies(_ trust: SecTrust, _ policies: AnyObject) -> OSStatus
To
func SecTrustSetPolicies(_ trust: SecTrust, _ policies: CFTypeRef) -> OSStatus