Skip to content

Expand KeyAgreement group and KDF coverage#133

Open
dancewithheart wants to merge 1 commit into
haskell-cryptography:mainfrom
dancewithheart:more-key-agreement-tests
Open

Expand KeyAgreement group and KDF coverage#133
dancewithheart wants to merge 1 commit into
haskell-cryptography:mainfrom
dancewithheart:more-key-agreement-tests

Conversation

@dancewithheart
Copy link
Copy Markdown
Contributor

Address:

-- TODO: More thorough test with different KDFs and curves / groups

Adds KeyAgreement tests:

  • with matrix for
    • ffdhe/ietf/3072 - FFDHE the TLS finite-field DH group family RFC 7919
    • secp384r1 - P-384 is NIST SP 800-186 recommended prime-field elliptic curve
    • secp256k1 - relevant for blockchains Bitcoin, Cardano
    • and KDF: HKDF(SHA-256), HKDF(SHA-384), KDF2(SHA-256)
  • checks that different salts derive different keys
  • derived key length matches keyAgreementSize

Validated with:

cabal test botan-low:test

results:

    spec_keyAgreement_matrix
      keyAgreement DH modp/ietf/2048 / HKDF(SHA-256):                                 OK (0.01s)
      keyAgreement DH modp/ietf/2048 / HKDF(SHA-384):                                 OK (0.01s)
      keyAgreement DH modp/ietf/2048 / KDF2(SHA-256):                                 OK (0.01s)
      keyAgreement DH ffdhe/ietf/3072 / HKDF(SHA-256):                                OK (0.04s)
      keyAgreement DH ffdhe/ietf/3072 / HKDF(SHA-384):                                OK (0.04s)
      keyAgreement DH ffdhe/ietf/3072 / KDF2(SHA-256):                                OK (0.04s)
      keyAgreement ECDH secp256r1 / HKDF(SHA-256):                                    OK
      keyAgreement ECDH secp256r1 / HKDF(SHA-384):                                    OK
      keyAgreement ECDH secp256r1 / KDF2(SHA-256):                                    OK
      keyAgreement ECDH secp384r1 / HKDF(SHA-256):                                    OK
      keyAgreement ECDH secp384r1 / HKDF(SHA-384):                                    OK
      keyAgreement ECDH secp384r1 / KDF2(SHA-256):                                    OK
      keyAgreement ECDH secp256k1 / HKDF(SHA-256):                                    OK
      keyAgreement ECDH secp256k1 / HKDF(SHA-384):                                    OK
      keyAgreement ECDH secp256k1 / KDF2(SHA-256):                                    OK
      keyAgreement Curve25519 / HKDF(SHA-256):                                        OK
      keyAgreement Curve25519 / HKDF(SHA-384):                                        OK
      keyAgreement Curve25519 / KDF2(SHA-256):                                        OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant