Instance Methodswift-crypto 3.8.0Crypto
sharedSecretFromKeyAgreement(with:)
Computes a shared secret with the provided public key from another party.
ECDH.swift:1359func sharedSecretFromKeyAgreement(with publicKeyShare: P521.KeyAgreement.PublicKey) throws -> SharedSecret
Parameters
The public key from another party to be combined with the private key from this user to create the shared secret.
Returns
The computed shared secret.
Other members in extension
Type members
init(
) Creates a NIST P-521 elliptic curve private key for use with Diffie-Hellman key exchange.
init(compactRepresentable: Bool
) Creates a random P-521 private key for key agreement.
init<Bytes>(derRepresentation: Bytes
) throws Creates a P-521 private key for key agreement from a Distinguished Encoding Rules (DER) encoded representation.
init(pemRepresentation: String
) throws Creates a P-521 private key for key agreement from a Privacy-Enhanced Mail PEM) representation.
init<Bytes>(rawRepresentation: Bytes
) throws Creates a P-521 private key for key agreement from a collection of bytes.
init<Bytes>(x963Representation: Bytes
) throws Creates a P-521 private key for key agreement from an ANSI x9.63 representation.
Instance members
var derRepresentation: Data
A Distinguished Encoding Rules (DER) encoded representation of the private key.
var pemRepresentation: String
A Privacy-Enhanced Mail (PEM) representation of the private key.
var publicKey: P521.KeyAgreement.PublicKey
The corresponding public key.
var rawRepresentation: Data
A data representation of the private key.
var x963Representation: Data
An ANSI x9.63 representation of the private key.