---
title: "SecEncryptTransformCreate(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/secencrypttransformcreate(_:_:)"
---

# SecEncryptTransformCreate(_:_:)

Creates an encryption transform object.

## Declaration

```swift
func SecEncryptTransformCreate(_ keyRef: SecKey, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> SecTransform
```

## Parameters

- `keyRef`: The key for the encryption operation
- `error`: A pointer to a doc://com.apple.documentation/documentation/CoreFoundation/CFError. This pointer will be set if an error occurred. This value may be nil if you do not want an error returned.

## Return Value

Return Value A pointer to a new transform or NULL on error. In Objective-C, call the CFRelease function to free this object’s memory when you are done with it.

## Discussion

Discussion This function creates a transform which encrypts data.
