---
title: generate()
framework: cryptokit
role: symbol
role_heading: Type Method
path: cryptokit/secureenclave/mlkem768/privatekey/generate()
---

# generate()

Generates a new random private key.

## Declaration

```swift
static func generate() throws -> SecureEnclave.MLKEM768.PrivateKey
```

## Return Value

Return Value The generated private key

## Discussion

Discussion This method implements the required interface for the KEMPrivateKey extension, in this case invoking the initializer with a default SecAccessControl and no LAContext.

## See Also

### Creating a private key

- [init(accessControl:authenticationContext:)](cryptokit/secureenclave/mlkem768/privatekey/init(accesscontrol:authenticationcontext:).md)
- [init(dataRepresentation:authenticationContext:)](cryptokit/secureenclave/mlkem768/privatekey/init(datarepresentation:authenticationcontext:).md)
