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

# SSLGetPeerDomainName(_:_:_:)

Retrieves the peer domain name specified previously.

```
func SSLGetPeerDomainName(_ context: SSLContext, _ peerName: UnsafeMutablePointer<CChar>, _ peerNameLen: UnsafeMutablePointer<Int>) -> OSStatus
```

## Parameters

`context`

An SSL session context reference.

`peerName`

On return, points to the peer domain name.

`peerNameLen`

A pointer to the length of the peer domain name. Before calling this function, retrieve the peer domain name length by calling the function [`SSLGetPeerDomainNameLength(_:_:)`](/documentation/Security/SSLGetPeerDomainNameLength(_:_:)).

## Return Value

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

## Discussion

If you previously called the [`SSLSetPeerDomainName(_:_:_:)`](/documentation/Security/SSLSetPeerDomainName(_:_:_:)) function to specify a fully qualified domain name for the peer certificate, you can use the [`SSLGetPeerDomainName(_:_:_:)`](/documentation/Security/SSLGetPeerDomainName(_:_:_:)) function to retrieve the domain name.

---

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)