<!--
{
  "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/Errors",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Apple CryptoKit",
      "CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4HPKEO6ErrorsO"
  },
  "title" : "HPKE.Errors"
}
-->

# HPKE.Errors

Hybrid public key encryption (HPKE) errors that CryptoKit uses.

```
enum Errors
```

## Topics

### Enumeration Cases

[`case ciphertextTooShort`](/documentation/CryptoKit/HPKE/Errors/ciphertextTooShort)

The ciphertext is too short.

[`case expectedPSK`](/documentation/CryptoKit/HPKE/Errors/expectedPSK)

The PSK is nil and the object is in PSK mode, or in authentication and PSK mode.

[`case exportOnlyMode`](/documentation/CryptoKit/HPKE/Errors/exportOnlyMode)

The object is in export-only mode and received a request to encrypt or decrypt data.

[`case inconsistentCiphersuiteAndKey`](/documentation/CryptoKit/HPKE/Errors/inconsistentCiphersuiteAndKey)

The supplied encryption key is incompatible with the requested cipher suite.

[`case inconsistentPSKInputs`](/documentation/CryptoKit/HPKE/Errors/inconsistentPSKInputs)

The PSK is nil and the PSK ID isn’t nil, or the PSK ID is nil and the PSK isn’t nil.

[`case inconsistentParameters`](/documentation/CryptoKit/HPKE/Errors/inconsistentParameters)

The parameters for initializing an HPKE sender or receiver are inconsistent.

[`case outOfRangeSequenceNumber`](/documentation/CryptoKit/HPKE/Errors/outOfRangeSequenceNumber)

The sequence number for encrypting or decrypting the message is out of range.

[`case unexpectedPSK`](/documentation/CryptoKit/HPKE/Errors/unexpectedPSK)

The PSK isn’t nil and the object is in base mode, or in authentication mode.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`Error`](/documentation/Swift/Error)

[`Sendable`](/documentation/Swift/Sendable)

---

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)