---
title: "init(dataRepresentation:authenticationContext:)"
framework: cryptokit
role: symbol
role_heading: Initializer
path: "cryptokit/secureenclave/p256/keyagreement/privatekey/init(datarepresentation:authenticationcontext:)"
---

# init(dataRepresentation:authenticationContext:)

Creates a P-256 private key for key agreement from a data representation of the key with the given authentication context.

## Declaration

```swift
init(dataRepresentation: Data, authenticationContext: LAContext? = nil) throws
```

## Parameters

- `dataRepresentation`: A data representation of the key.
- `authenticationContext`: A local authentication context.

## See Also

### Creating a private key

- [init(compactRepresentable:accessControl:authenticationContext:)](cryptokit/secureenclave/p256/keyagreement/privatekey/init(compactrepresentable:accesscontrol:authenticationcontext:).md)
