Security Transforms

Perform cryptographic functions like encoding, encryption, signing, and signature verification.

Overview

You use security transforms to assemble a chain of security-related operations that you apply to a stream of data in macOS.

Topics

Transforms

func SecTransformCreateReadTransformWithReadStream(CFReadStream) -> SecTransform

Creates a read transform from a read stream reference.

typealias SecTransform

A Core Foundation type that represents a security transform.

func SecTransformGetTypeID() -> CFTypeID

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

Encrypting

func SecEncryptTransformGetTypeID() -> CFTypeID

Returns the unique identifier of the opaque type to which an encryption transform belongs.

func SecDecryptTransformGetTypeID() -> CFTypeID

Returns the unique identifier of the opaque type to which a decryption transform belongs.

Custom Transforms

typealias SecTransformCreateFP

A pointer to a function that creates a new instance of a custom transform.

typealias SecTransformInstanceBlock

A block that you return from a transform creation function.

typealias SecTransformImplementationRef

An opaque pointer to a block that implements an instance of a transform.

Transform Groups

func SecTransformCreateGroupTransform() -> SecGroupTransform

Creates an object that acts as a container for a set of connected transforms.

typealias SecGroupTransform

A Core Foundation type that represents a container holding a group of transforms.

func SecGroupTransformGetTypeID() -> CFTypeID

Returns the Core Foundation type ID for a transform group container.

Transform Characteristics

Actions

typealias SecTransformActionBlock

A block that overrides the default behavior of a custom transform.

typealias SecTransformAttributeActionBlock

A block used to override the default attribute handling for when an attribute is set.

typealias SecTransformDataBlock

A block used to override the default data handling for a transform.

Actions

Use actions to trigger particular behaviors.

Execution

func SecTransformExecuteAsync(SecTransform, DispatchQueue, SecMessageBlock)

Executes transform or transform group asynchronously.

func SecTransformNoData() -> CFTypeRef

Returns an object from inside a ProcessData override that says that although no data is being returned the transform is still active and awaiting data.

typealias SecMessageBlock

A block that delivers messages during asynchronous operations.

Import and Export

func SecTransformCopyExternalRepresentation(SecTransform) -> CFDictionary

Creates a dictionary that contains enough information to be able to recreate a transform.

Reporting Errors

let kSecTransformErrorDomain: CFString

The domain of any error object created by a transform on failure.

Security Transform Error Codes

Recognize the error codes used in error objects created by a transform on failure.

let kSecTransformPreviousErrorKey: CFString

The key in an error's userInfo dictionary whose value specifies the previous error when multiple errors occur during transform evaluation.

let kSecTransformAbortOriginatorKey: CFString

The key in an error's userInfo dictionary whose value indicates the transform that caused the chain to abort.

See Also

Cryptography

Complying with Encryption Export Regulations

Declare the use of encryption in your app to streamline the app submission process.

Certificate, Key, and Trust Services

Establish trust using certificates and cryptographic keys.

Cryptographic Message Syntax Services

Cryptographically sign and encrypt S/MIME messages.

Randomization Services

Generate cryptographically secure random numbers.

ASN.1

Encode and decode Distinguished Encoding Rules (DER) and Basic Encoding Rules (BER) data streams.