SharedSecret

    A key agreement result from which you can derive a symmetric cryptographic key.

    DH.swift:50
    struct SharedSecret

    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 equivalent method on their own private key.

    The shared secret isn’t suitable as a symmetric cryptographic key (SymmetricKey) by itself. However, you use it to generate a key by calling either the hkdfDerivedSymmetricKey(using:salt:sharedInfo:outputByteCount:) or x963DerivedSymmetricKey(using:sharedInfo:outputByteCount:) 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 with a cipher like ChaChaPoly or AES.

    Citizens in Crypto

    Conformances

    Type members

    Instance members

    Type features