<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppleArchive",
  "identifier" : "/documentation/AppleArchive/ArchiveEncryptionContext/setRecipientPrivateKey(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Apple Archive"
    ],
    "preciseIdentifier" : "s:12AppleArchive0B17EncryptionContextC22setRecipientPrivateKeyyy9CryptoKit4P256O0H9AgreementO0gH0VKF"
  },
  "title" : "setRecipientPrivateKey(_:)"
}
-->

# setRecipientPrivateKey(_:)

Sets the recipient private key that the context requires to decrypt an archive to a specific recipient in ECDHE encryption profiles.

```
func setRecipientPrivateKey(_ key: P256.KeyAgreement.PrivateKey) throws
```

## Parameters

`key`

The recipient private 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)