<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/HPKE/Sender/init(recipientKey:ciphersuite:info:presharedKey:presharedKeyIdentifier:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4HPKEO6SenderV12recipientKey11ciphersuite4info09presharedF00iF10IdentifierAEx_AC11CiphersuiteV10Foundation4DataVAA09SymmetricF0VAOtKcAA023HPKEDiffieHellmanPublicF0Rzlufc"
  },
  "title" : "init(recipientKey:ciphersuite:info:presharedKey:presharedKeyIdentifier:)"
}
-->

# init(recipientKey:ciphersuite:info:presharedKey:presharedKeyIdentifier:)

Creates a sender in preshared key (PSK) mode.

```
init<PK>(recipientKey: PK, ciphersuite: HPKE.Ciphersuite, info: Data, presharedKey psk: SymmetricKey, presharedKeyIdentifier pskID: Data) throws where PK : HPKEDiffieHellmanPublicKey
```

## Parameters

`recipientKey`

The recipient’s public key for encrypting the messages.

`ciphersuite`

The cipher suite that defines the cryptographic algorithms to use.

`info`

Data that the key derivation function uses to compute the symmetric key material. The sender and the recipient need to use the same `info` data.

`psk`

A preshared key (PSK) that the sender and the recipient both hold.

`pskID`

An identifier for the PSK.

## Discussion

The `Sender` encrypts messages in PSK mode using a symmetric encryption key that the sender and recipient both know in advance, in combination with a key it derives using a key derivation function (KDF) and
the key schedule data in `info`.
The `Sender` encapsulates the derived key using the recipient’s public key.
You access the encapsulated key using [`encapsulatedKey`](/documentation/CryptoKit/HPKE/Sender/encapsulatedKey).

> Note: The system throws errors from ``doc://com.apple.CryptoKit/documentation/CryptoKit/HPKE/Errors`` when it encounters them.

---

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)