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

# SSLGetDiffieHellmanParams(_:_:_:)

Retrieves the Diffie-Hellman parameters for a given context.

```
func SSLGetDiffieHellmanParams(_ context: SSLContext, _ dhParams: UnsafeMutablePointer<UnsafeRawPointer?>, _ dhParamsLen: UnsafeMutablePointer<Int>) -> OSStatus
```

## Parameters

`context`

An SSL session context reference.

`dhParams`

On return, points to a buffer containing the Diffie-Hellman parameter block in Open SSL DER format.The returned data is not copied and belongs to the SSL session context reference; therefore, you cannot modify the data and it is released automatically when you dispose of the context.

`dhParamsLen`

On return, points to the length of the buffer pointed to by the `dhParams` parameter.

## Return Value

A result code. See [Secure Transport Result Codes](/documentation/Security/secure-transport-result-codes).

## Discussion

This function returns the parameter block specified in an earlier call to the [`SSLSetDiffieHellmanParams(_:_:_:)`](/documentation/Security/SSLSetDiffieHellmanParams(_:_:_:)) function. If that function was never called, the `dhParams` parameter returns `NULL` and the `dhParamsLen` parameter returns `0`.

---

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)