PrivateKey
A Curve25519 private key used for key agreement.
- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
struct PrivateKey
A Curve25519 private key used for key agreement.
struct PrivateKey
import Crypto
A cryptography library for Swift.
enum KeyAgreement
A mechanism used to create a shared secret between two users by performing X25519 key agreement.
enum Curve25519
An elliptic curve that enables X25519 key agreement and Ed25519 signatures.
struct PublicKey
A Curve25519 public key used for key agreement.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol DiffieHellmanKeyAgreement
A Diffie-Hellman Key Agreement Key
protocol Escapable
protocol HPKEDiffieHellmanPrivateKey : DiffieHellmanKeyAgreement where Self.PublicKey : HPKEDiffieHellmanPublicKey
A type that represents the private key in a Diffie-Hellman key exchange.
protocol HPKEDiffieHellmanPrivateKeyGeneration : HPKEDiffieHellmanPrivateKey
A type that represents the generation of private keys in a Diffie-Hellman key exchange.
init()
Creates a random Curve25519 private key for key agreement.
init<D>(rawRepresentation: D) throws where D : ContiguousBytes
Creates a Curve25519 private key for key agreement from a collection of bytes.
var publicKey: Curve25519.KeyAgreement.PublicKey { get }
The corresponding public key.
var rawRepresentation: Data { get }
The raw representation of the key as a collection of contiguous bytes.
func sharedSecretFromKeyAgreement(with publicKeyShare: Curve25519.KeyAgreement.PublicKey) throws -> SharedSecret
Computes a shared secret with the provided public key from another party.