<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NEHotspotEAPSettings/setIdentity(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NEHotspotEAPSettings(im)setIdentity:"
  },
  "title" : "setIdentity(_:)"
}
-->

# setIdentity(_:)

Sets the client identity for EAP authentication.

```
func setIdentity(_ identity: SecIdentity) -> Bool
```

## Parameters

`identity`

The EAP peer identity, a `SecIdentityRef` object that contains a `SecKeyRef` object and an associated `SecCertificateRef` object.

## Return Value

Returns `false` if the parameter is not an object of `SecIdentityRef` type or if the persistent reference is not found in the application’s keychain; otherwise returns `true`.

## Discussion

Your app must store `SecIdentity` in the keychain access group $`(Team​Identifier​Prefix)com​.apple​.networkextensionsharing`. The OS uses <doc://com.apple.documentation/documentation/Security/SecItemCopyMatching(_:_:)> to obtain a persistent reference to this identity from the application’s keychain and uses it during EAP authentication.

---

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)