---
title: "SecKeyCopyKeyExchangeResult(_:_:_:_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/seckeycopykeyexchangeresult(_:_:_:_:_:)"
---

# SecKeyCopyKeyExchangeResult(_:_:_:_:_:)

Performs the Diffie-Hellman style of key exchange with optional key-derivation steps.

## Declaration

```swift
func SecKeyCopyKeyExchangeResult(_ privateKey: SecKey, _ algorithm: SecKeyAlgorithm, _ publicKey: SecKey, _ parameters: CFDictionary, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> CFData?
```

## Return Value

Return Value A data object representing the result of the key exchange operation or NULL on failure. In Objective-C, call CFRelease to free the data object’s memory when you are done with it.
