---
title: "signature(for:)"
framework: cryptokit
role: symbol
role_heading: Instance Method
path: "cryptokit/secureenclave/p256/signing/privatekey/signature(for:)-76j0u"
---

# signature(for:)

Generates an elliptic curve digital signature algorithm (ECDSA) signature of the given data over the P-256 elliptic curve, using SHA-256 as the hash function.

## Declaration

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

## Parameters

- `data`: The data to sign.

## Return Value

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

## See Also

### Generating a signature

- [signature(for:)](cryptokit/secureenclave/p256/signing/privatekey/signature(for:)-3xogs.md)
