<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/P256/KeyAgreement/PublicKey/init(rawRepresentation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4P256O12KeyAgreementO06PublicD0V17rawRepresentationAGx_tKc10Foundation15ContiguousBytesRzlufc"
  },
  "title" : "init(rawRepresentation:)"
}
-->

# init(rawRepresentation:)

Creates a P-256 public key for key agreement from a collection of bytes.

```
init<D>(rawRepresentation: D) throws where D : ContiguousBytes
```

## Parameters

`rawRepresentation`

A raw representation of the key as a collection of
contiguous bytes.

---

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)