<!--
{
  "availability" : [
    "macOS: 10.7.0 - 13.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecEncryptTransformCreate(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecEncryptTransformCreate"
  },
  "title" : "SecEncryptTransformCreate(_:_:)"
}
-->

# SecEncryptTransformCreate(_:_:)

Creates an encryption transform object.

```
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

A pointer to a new transform or `NULL` on error. In Objective-C, call the <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> function to free this object’s memory when you are done with it.

## Discussion

This function creates a transform which encrypts data.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)