Creates a static code object representing the code at a specified file system path using an attributes dictionary.


func SecStaticCodeCreateWithPathAndAttributes(_ path: CFURL, _ flags: SecCSFlags, _ attributes: CFDictionary, _ staticCode: UnsafeMutablePointer<SecStaticCode?>) -> OSStatus



A URL identifying the location on disk of the code for which you want a static code object. For bundles, pass a URL to the root directory of the bundle. For single files, pass a URL to the file. If you pass a URL to the main executable of a bundle, the bundle as a whole is generally recognized. Only absolute paths should be used.


Optional flags; see SecCSFlags for possible values. Pass defaultFlags for standard behavior.


A CFDictionary containing additional attributes of the requested code. Possible values are defined in Code Attributes.


On return, the static code object representing the code you specified in the path parameter.

Return Value


A static code object is not inherently linked to running code in the system.

It is possible to create a static code object from unsigned code. Although most uses of such an object cause the function to fail and return the result code errSecCSUnsigned error, you can call the SecCodeCopyPath(_:_:_:) and SecCodeCopySigningInformation(_:_:_:) functions for such objects.

See Also

Static Code

class SecStaticCode

A static code object representing signed code on disk.

func SecStaticCodeCreateWithPath(CFURL, SecCSFlags, UnsafeMutablePointer<SecStaticCode?>) -> OSStatus

Creates a static code object representing the code at a specified file system path.

Code Attributes

Specify these keys from the attribute dictionary when you create a static code instance.

func SecStaticCodeGetTypeID() -> CFTypeID

Returns the unique identifier of the opaque type to which a static code object belongs.