---
title: "init(compactRepresentable:accessControl:authenticationContext:)"
framework: cryptokit
role: symbol
role_heading: Initializer
path: "cryptokit/secureenclave/p256/keyagreement/privatekey/init(compactrepresentable:accesscontrol:authenticationcontext:)"
---

# init(compactRepresentable:accessControl:authenticationContext:)

Creates a P-256 private key for key agreement with the specified access control.

## Declaration

```swift
init(compactRepresentable: Bool = true, accessControl: SecAccessControl = SecAccessControlCreateWithFlags(nil, kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, [], nil)!, authenticationContext: LAContext? = nil) throws
```

## Parameters

- `compactRepresentable`: A Boolean value that indicates whether CryptoKit creates the key with the structure to enable compact point encoding.
- `accessControl`: The protection type and flags to use when creating the associated access control object.
- `authenticationContext`: A local authentication context.

## See Also

### Creating a private key

- [init(dataRepresentation:authenticationContext:)](cryptokit/secureenclave/p256/keyagreement/privatekey/init(datarepresentation:authenticationcontext:).md)
