<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.0.0 - 10.13.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSConnectionDelegate/authenticationDataForComponents:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSConnectionDelegate(im)authenticationDataForComponents:"
  },
  "title" : "authenticationDataForComponents:"
}
-->

# authenticationDataForComponents:

Returns an `NSData` object to be used as an authentication stamp for an outgoing message.

```
- (NSData *) authenticationDataForComponents:(NSArray *) components;
```

## Parameters

`components`

An array containing the elements of a network message, in the form of `NSPort` and `NSData` objects.

## Return Value

An `NSData` object to be used as an authentication stamp for an outgoing message.

## Discussion

The delegate should use only the `NSData` elements to create the authentication stamp. See the [`PortMessage`](/documentation/Foundation/PortMessage) class specification for more information on the components.

If [`authenticationDataForComponents:`](/documentation/Foundation/NSConnectionDelegate/authenticationDataForComponents:) returns `nil`, an `NSGenericException` will be raised. If the delegate determines that the message shouldn’t be authenticated, it should return an empty `NSData` object. The delegate on the other side of the connection must then be prepared to accept an empty `NSData` object as the second parameter to [`authenticateComponents:withData:`](/documentation/Foundation/NSConnectionDelegate/authenticateComponents:withData:) and to handle the situation appropriately.

The `components` parameter will be validated on receipt by the delegate of the peer `NSConnection` object with [`authenticateComponents:withData:`](/documentation/Foundation/NSConnectionDelegate/authenticateComponents:withData:).

---

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)