open(_:using:authenticating:)
Decrypts the message and verifies the authenticity of both the encrypted message and additional data.
- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
static func open<AuthenticatedData>(_ sealedBox: SealedBox, using key: SymmetricKey, authenticating authenticatedData: AuthenticatedData) throws -> Data where AuthenticatedData : DataProtocol
Parameters
- sealedBox
The sealed box to open.
- key
The cryptographic key that was used to seal the message.
- authenticatedData
Additional data that was authenticated.
Returns
The original plaintext message that was sealed in the box, as long as the correct key is used and authentication succeeds. The call throws an error if decryption or authentication fail.