<!--
{
  "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/Signing/PublicKey",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4P256O7SigningO9PublicKeyV"
  },
  "title" : "P256.Signing.PublicKey"
}
-->

# P256.Signing.PublicKey

A P-256 public key used to verify cryptographic signatures.

```
struct PublicKey
```

## Topics

### Creating a key

[`init<D>(rawRepresentation: D) throws`](/documentation/CryptoKit/P256/Signing/PublicKey/init(rawRepresentation:))

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

[`init<Bytes>(compactRepresentation: Bytes) throws`](/documentation/CryptoKit/P256/Signing/PublicKey/init(compactRepresentation:))

Creates a P-256 public key for signing from a compact
representation of the key.

[`init<Bytes>(compressedRepresentation: Bytes) throws`](/documentation/CryptoKit/P256/Signing/PublicKey/init(compressedRepresentation:))

Creates a P-256 public key for signing from a compressed representation of
the key.

[`init<Bytes>(derRepresentation: Bytes) throws`](/documentation/CryptoKit/P256/Signing/PublicKey/init(derRepresentation:))

Creates a P-256 public key for signing from a Distinguished Encoding
Rules (DER) encoded representation.

[`init(pemRepresentation: String) throws`](/documentation/CryptoKit/P256/Signing/PublicKey/init(pemRepresentation:))

Creates a P-256 public key for signing from a Privacy-Enhanced Mail
(PEM) representation.

[`init<Bytes>(x963Representation: Bytes) throws`](/documentation/CryptoKit/P256/Signing/PublicKey/init(x963Representation:))

Creates a P-256 public key for signing from an ANSI x9.63
representation.

### Representing the key

[`var rawRepresentation: Data`](/documentation/CryptoKit/P256/Signing/PublicKey/rawRepresentation)

A full representation of the public key.

[`var compactRepresentation: Data?`](/documentation/CryptoKit/P256/Signing/PublicKey/compactRepresentation)

A compact representation of the public key.

[`var compressedRepresentation: Data`](/documentation/CryptoKit/P256/Signing/PublicKey/compressedRepresentation)

A compressed representation of the public key.

[`var derRepresentation: Data`](/documentation/CryptoKit/P256/Signing/PublicKey/derRepresentation)

A Distinguished Encoding Rules (DER) encoded representation of the public key.

[`var pemRepresentation: String`](/documentation/CryptoKit/P256/Signing/PublicKey/pemRepresentation)

A Privacy-Enhanced Mail (PEM) representation of the public key.

[`var x963Representation: Data`](/documentation/CryptoKit/P256/Signing/PublicKey/x963Representation)

An ANSI x9.63 representation of the public key.

### Verifying a signature

[`func isValidSignature<D>(P256.Signing.ECDSASignature, for: D) -> Bool`](/documentation/CryptoKit/P256/Signing/PublicKey/isValidSignature(_:for:)-3da2m)

Verifies an elliptic curve digital signature algorithm (ECDSA)
signature on a block of data over the P-256 elliptic curve.

[`func isValidSignature<D>(P256.Signing.ECDSASignature, for: D) -> Bool`](/documentation/CryptoKit/P256/Signing/PublicKey/isValidSignature(_:for:)-2rsb5)

Verifies an elliptic curve digital signature algorithm (ECDSA)
signature on a digest over the P-256 elliptic curve.

[`struct ECDSASignature`](/documentation/CryptoKit/P256/Signing/ECDSASignature)

A P-256 elliptic curve digital signature algorithm (ECDSA) signature.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)