<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/MLDSA87/PrivateKey/init(seedRepresentation:publicKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit7MLDSA87O10PrivateKeyV18seedRepresentation06publicE0AEx_AC06PublicE0VSgtKc10Foundation12DataProtocolRzlufc"
  },
  "title" : "init(seedRepresentation:publicKey:)"
}
-->

# init(seedRepresentation:publicKey:)

Initializes a private key from the seed representation.

```
init<D>(seedRepresentation: D, publicKey: MLDSA87.PublicKey?) throws where D : DataProtocol
```

## Parameters

`seedRepresentation`

The seed representation of the private key. This parameter needs to be 32 bytes long.

`publicKey`

The public key associated with the secret key.

## Discussion

This initializer implements the `ML-DSA.KeyGen_internal` algorithm (Algorithm 16) of FIPS 204.

If a public key is provided, a consistency check is performed between it and the derived public 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)