Skip to content

Version 4.2.0

Latest

Choose a tag to compare

@RuiNelson RuiNelson released this 04 Dec 05:05

What's New

joke
  • Post-quantum SSH keys - You can now authenticate with ML-DSA-44 + Ed25519 composite keys (ssh-mldsa44-ed25519), as user keys and as host keys, including known_hosts entries. The server must run OpenSSH 10.6 or later.

  • Composite keys in the cryptographic utilities - AsymmetricCryptography.Composite.MLDSA44Ed25519 generates, parses and encodes composite keys in OpenSSH, PKCS#8, BEGIN PUBLIC KEY and DER form, following RFC 10073 (id-MLDSA44-Ed25519-SHA512).

    let pair = try AsymmetricCryptography.Composite.MLDSA44Ed25519.generateKeyPair()
    let privateKeyFile = try pair.privateKey.encode(format: .openSSH, passphrase: "passphrase")
    let authorizedKey = try pair.publicKey.encode(format: .openSSH) // "ssh-mldsa44-ed25519 AAAA…"
  • Splitting and joining composite keys - The new CompositeAlgorithm protocol splits a composite key pair or public key into its Ed25519 and ML-DSA-44 components, and joins separately generated or imported components into a composite key.

    typealias Composite = AsymmetricCryptography.Composite.MLDSA44Ed25519
    
    let (classical, postQuantum) = try Composite.decompose(pair)
    let same = try Composite.compose(classical: classical, postQuantum: postQuantum)

    Composing a private key needs the ML-DSA-44 seed; an ML-DSA-44 key stored without it throws the new AsymmetricCryptographyError.seedUnavailable.

See Cryptographic Utilities for details.

Migration Guide

This release adds cases to three public enums: SSHUserKeyAlgorithm.mldsa44Ed25519, LibSSH2HostKeyType.mldsa44Ed25519 and AsymmetricCryptographyError.seedUnavailable. A switch over one of these enums without a default case no longer compiles until it handles the new case.

Before:

switch algorithm {
case .rsa, .ecdsaP256, .ecdsaP384, .ecdsaP521, .ed25519:
    useClassicalKey()
}

After:

switch algorithm {
case .rsa, .ecdsaP256, .ecdsaP384, .ecdsaP521, .ed25519:
    useClassicalKey()
case .mldsa44Ed25519:
    usePostQuantumKey()
}