<!--
{
  "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/P521/Signing/PrivateKey/signature(for:)-34g01",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Apple CryptoKit",
      "CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4P521O7SigningO10PrivateKeyV9signature3forAE14ECDSASignatureVx_tK10Foundation12DataProtocolRzlF"
  },
  "title" : "signature(for:)"
}
-->

# signature(for:)

Generates an Elliptic Curve Digital Signature Algorithm (ECDSA)
signature of the data you provide over the P-521 elliptic curve,
using SHA-512 as the hash function.

```
func signature<D>(for data: D) throws -> P521.Signing.ECDSASignature where D : DataProtocol
```

## Parameters

`data`

The data to sign.

## Return Value

The signature corresponding to the data. The signing
algorithm employs randomization to generate a different signature on
every call, even for the same data and key.

---

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)