Retrieves the code object for the code making the call.


func SecCodeCopySelf(_ flags: SecCSFlags, _ self: UnsafeMutablePointer<SecCode?>) -> OSStatus



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


On return, a code object representing the caller.

Return Value


A code object (that is, an object of type SecCode) represents code that is running on the system. The code can be a UNIX process, a script, an applet, a widget, or any other separately-identifiable code. You can use the code object returned by this function as input to other functions in the Code Signing Services API. This function returns a code object for the code that calls it regardless of whether the code is signed. Call the SecCodeCheckValidity(_:_:_:) or SecCodeCheckValidityWithErrors(_:_:_:_:) function to determine whether the code has a valid signature.

If the code calling this function is either a dedicated host or has called the SecHostSelectGuest(_:_:) function, then the host is considered to be acting as a proxy for its dedicated or selected guest and the SecCodeCopySelf(_:_:) function returns a code object for that guest. See kSecCSDedicatedHost for a discussion of dedicated hosts.

See Also

Code Objects

class SecCode

A code object representing signed code running on the system.

struct SecCSFlags

Values that can be used in the flags parameter to most code signing functions.

func SecCodeGetTypeID() -> CFTypeID

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