spake2plus 0.1.0

SPAKE2+ (RFC 9383), the augmented password-authenticated key exchange: prover and verifier, no_std
Documentation
//! RFC 9383's test vectors (Appendix C) for the suites this crate
//! implements, as the RFC prints them: hex, with the context and the
//! identities the vectors are run with.

/// One test vector. The PBKDF is left out: `w0` and `w1` are given.
pub(crate) struct Vector {
    pub(crate) context: &'static [u8],
    pub(crate) prover_id: &'static [u8],
    pub(crate) verifier_id: &'static [u8],
    /// `w0`.
    pub(crate) w0: &'static str,
    /// `w1`.
    pub(crate) w1: &'static str,
    /// `L = w1*P`.
    pub(crate) l: &'static str,
    /// The prover's `x`.
    pub(crate) x: &'static str,
    /// `shareP = X`.
    pub(crate) share_p: &'static str,
    /// The verifier's `y`.
    pub(crate) y: &'static str,
    /// `shareV = Y`.
    pub(crate) share_v: &'static str,
    /// `Z`.
    pub(crate) z: &'static str,
    /// `V`.
    pub(crate) v: &'static str,
    /// The transcript `TT`.
    pub(crate) tt: &'static str,
    /// `K_main = Hash(TT)`.
    pub(crate) k_main: &'static str,
    /// `K_confirmP`.
    pub(crate) k_confirm_p: &'static str,
    /// `K_confirmV`.
    pub(crate) k_confirm_v: &'static str,
    /// `confirmP = MAC(K_confirmP, shareV)`.
    pub(crate) confirm_p: &'static str,
    /// `confirmV = MAC(K_confirmV, shareP)`.
    pub(crate) confirm_v: &'static str,
    /// `K_shared`.
    pub(crate) k_shared: &'static str,
}

/// `P256-SHA256-HKDF-SHA256-HMAC-SHA256`.
pub(crate) const P256_SHA256: Vector = Vector {
    context: b"SPAKE2+-P256-SHA256-HKDF-SHA256-HMAC-SHA256 Test Vectors",
    prover_id: b"client",
    verifier_id: b"server",
    w0: "bb8e1bbcf3c48f62c08db243652ae55d3e5586053fca77102994f23ad95491b3",
    w1: "7e945f34d78785b8a3ef44d0df5a1a97d6b3b460409a345ca7830387a74b1dba",
    l: "04eb7c9db3d9a9eb1f8adab81b5794c1f13ae3e225efbe91ea487425854c7fc00f00bfedcbd09b2400142d40a14f2064ef31dfaa903b91d1faea7093d835966efd",
    x: "d1232c8e8693d02368976c174e2088851b8365d0d79a9eee709c6a05a2fad539",
    share_p: "04ef3bd051bf78a2234ec0df197f7828060fe9856503579bb1733009042c15c0c1de127727f418b5966afadfdd95a6e4591d171056b333dab97a79c7193e341727",
    y: "717a72348a182085109c8d3917d6c43d59b224dc6a7fc4f0483232fa6516d8b3",
    share_v: "04c0f65da0d11927bdf5d560c69e1d7d939a05b0e88291887d679fcadea75810fb5cc1ca7494db39e82ff2f50665255d76173e09986ab46742c798a9a68437b048",
    z: "04bbfce7dd7f277819c8da21544afb7964705569bdf12fb92aa388059408d50091a0c5f1d3127f56813b5337f9e4e67e2ca633117a4fbd559946ab474356c41839",
    v: "0458bf27c6bca011c9ce1930e8984a797a3419797b936629a5a937cf2f11c8b9514b82b993da8a46e664f23db7c01edc87faa530db01c2ee405230b18997f16b68",
    tt: "38000000000000005350414b45322b2d503235362d5348413235362d484b44462d5348413235362d484d41432d534841323536205465737420566563746f72730600000000000000636c69656e740600000000000000736572766572410000000000000004886e2f97ace46e55ba9dd7242579f2993b64e16ef3dcab95afd497333d8fa12f5ff355163e43ce224e0b0e65ff02ac8e5c7be09419c785e0ca547d55a12e2d20410000000000000004d8bbd6c639c62937b04d997f38c3770719c629d7014d49a24b4f98baa1292b4907d60aa6bfade45008a636337f5168c64d9bd36034808cd564490b1e656edbe7410000000000000004ef3bd051bf78a2234ec0df197f7828060fe9856503579bb1733009042c15c0c1de127727f418b5966afadfdd95a6e4591d171056b333dab97a79c7193e341727410000000000000004c0f65da0d11927bdf5d560c69e1d7d939a05b0e88291887d679fcadea75810fb5cc1ca7494db39e82ff2f50665255d76173e09986ab46742c798a9a68437b048410000000000000004bbfce7dd7f277819c8da21544afb7964705569bdf12fb92aa388059408d50091a0c5f1d3127f56813b5337f9e4e67e2ca633117a4fbd559946ab474356c4183941000000000000000458bf27c6bca011c9ce1930e8984a797a3419797b936629a5a937cf2f11c8b9514b82b993da8a46e664f23db7c01edc87faa530db01c2ee405230b18997f16b682000000000000000bb8e1bbcf3c48f62c08db243652ae55d3e5586053fca77102994f23ad95491b3",
    k_main: "4c59e1ccf2cfb961aa31bd9434478a1089b56cd11542f53d3576fb6c2a438a29",
    k_confirm_p: "871ae3f7b78445e34438fb284504240239031c39d80ac23eb5ab9be5ad6db58a",
    k_confirm_v: "ccd53c7c1fa37b64a462b40db8be101cedcf838950162902054e644b400f1680",
    confirm_p: "926cc713504b9b4d76c9162ded04b5493e89109f6d89462cd33adc46fda27527",
    confirm_v: "9747bcc4f8fe9f63defee53ac9b07876d907d55047e6ff2def2e7529089d3e68",
    k_shared: "0c5f8ccd1413423a54f6c1fb26ff01534a87f893779c6e68666d772bfd91f3e7",
};

/// `P256-SHA512-HKDF-SHA512-HMAC-SHA512`.
pub(crate) const P256_SHA512: Vector = Vector {
    context: b"SPAKE2+-P256-SHA512-HKDF-SHA512-HMAC-SHA512 Test Vectors",
    prover_id: b"client",
    verifier_id: b"server",
    w0: "1cc5207d6e34b8f7828206fb64b86aa9c712bc952abf251bb9f5856b24d8c8cc",
    w1: "4279649e62532b01dc27d2ed39100ba350518fb969672061a01edce752d0e672",
    l: "043a348ad475d2200d46df876f1eb2e136056da31dafff52cc7762bf3be84de0097c4e69b0b9321326af1f0af4a14561a9c7b640cb5afd6822d14cb34830fc4511",
    x: "b586ab83f175c1a2b56b6a1b6a283523f88a9befcf11e22efb48e2ee1fe69a23",
    share_p: "04a7928c4b47f6b8657a5b8ebcb6f1bd266192e152fb9745a4180c94657a2f323b4d50d536c0325cdb0ec42c9bd8db8d7af3ff6dc85edb4b5365375c62e09def4a",
    y: "ac1fb828f041782d452ea9cc00c3fa34a55fa8f7f98c04be45a3d607b092d441",
    share_v: "04498c29e37dbd53ebf8db76679901d90c6be3af57f46ac3025b32420839f0489c6c3b6bf5ddc8ecbc3d7c83d0891ad814a00ad23eba13197c9d96a5b10275e35d",
    z: "04a81e31be54283cee81bf7bdc877764b6b2ac6a399f1176380aac8a82172c18051aa17dfcf438896ad253f53b52cd45ec2c7399488a919bcfcfecc0261cbf5284",
    v: "04de0a53f96cbe4abcd31c1e0a23ea6f169c162dc5a007393c8fcddd2abd5d518bb2d9734b1d2dfce3fd916e991ab9dc3a2760d439c083eb39b65408857d2bb4aa",
    tt: "38000000000000005350414b45322b2d503235362d5348413531322d484b44462d5348413531322d484d41432d534841353132205465737420566563746f72730600000000000000636c69656e740600000000000000736572766572410000000000000004886e2f97ace46e55ba9dd7242579f2993b64e16ef3dcab95afd497333d8fa12f5ff355163e43ce224e0b0e65ff02ac8e5c7be09419c785e0ca547d55a12e2d20410000000000000004d8bbd6c639c62937b04d997f38c3770719c629d7014d49a24b4f98baa1292b4907d60aa6bfade45008a636337f5168c64d9bd36034808cd564490b1e656edbe7410000000000000004a7928c4b47f6b8657a5b8ebcb6f1bd266192e152fb9745a4180c94657a2f323b4d50d536c0325cdb0ec42c9bd8db8d7af3ff6dc85edb4b5365375c62e09def4a410000000000000004498c29e37dbd53ebf8db76679901d90c6be3af57f46ac3025b32420839f0489c6c3b6bf5ddc8ecbc3d7c83d0891ad814a00ad23eba13197c9d96a5b10275e35d410000000000000004a81e31be54283cee81bf7bdc877764b6b2ac6a399f1176380aac8a82172c18051aa17dfcf438896ad253f53b52cd45ec2c7399488a919bcfcfecc0261cbf5284410000000000000004de0a53f96cbe4abcd31c1e0a23ea6f169c162dc5a007393c8fcddd2abd5d518bb2d9734b1d2dfce3fd916e991ab9dc3a2760d439c083eb39b65408857d2bb4aa20000000000000001cc5207d6e34b8f7828206fb64b86aa9c712bc952abf251bb9f5856b24d8c8cc",
    k_main: "527613439c279a375c116342a4216a8d92441d2fe1921dd1e60f140b2855916ccac7db4dbf22bd56e344a8cd506d08949bde1e9d83c24d68ff4246458dc14288",
    k_confirm_p: "0aa129d7b82067c2a9607677c9c4fdedc1cd7cfed9ff72c54c0aebb2b1a8aa915b96834b2986725c6040852ceaafbb17d638a715198f795654eac89bf0739878",
    k_confirm_v: "a1f1038de30a8c12d43d06c27d362daa9699249e941faa2d5cbc59a9683bf42aed9537818245677fdb54b5274506542994f4a83455f6d7b3af5ec017faa58f61",
    confirm_p: "6b2469b56cf8ac3f94a8d0b533380ea6b3d0f46b3e12ee82550d49e129c2412728c9437a64ee5f80c8cdc5e8a30faa0a6deb8a5251346ba81bb6fc955b2304fc",
    confirm_v: "154174fc278a935e290b3352ba877e179fa9281c0a76928faea703c72d383b267511a5cf084cb07147efece94e3cfd91944e7baab856858fbebc087167b0f409",
    k_shared: "11887659d9e002f34fa6cc270d33570f001b2a3fc0522b643c07327d09a4a9f47aab85813d13c585b53adf5ac9de5707114848f3dc31a4045f69a2cc1972b098",
};