A key agreement result from which you can derive a symmetric cryptographic key.
- iOS 13.0+Beta
- macOS 10.15+Beta
- Mac Catalyst 13.0+Beta
- tvOS 13.0+Beta
- watchOS 6.0+Beta
- Xcode 11.0+Beta
- Apple Crypto
You generate a shared secret by calling your private key’s sharedSecretFromKeyAgreement(publicKeyShare:) method with the public key from another party. The other party computes the same secret by passing your public key to the the equivalent method on their own private key.
The shared secret isn’t suitable as a symmetric cryptographic key (
Symmetric) by itself. However, you use it to generate a key by calling either the
x963Derived method of the shared secret. After the other party does the same, then you both share a symmetric key suitable for creating a message authentication code like
HMAC, or for opening and closing a sealed box (AEADSealedBox) with a cipher like