Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-1008

generate_key fails to derive public key for x25519 private key

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 22.0
    • Fix Version/s: None
    • Component/s: crypto
    • Labels:
      None

      Description

      If I try to pass a PrivKey to generate_key like this:

      {Px, Sx} = crypto:generate_key(ecdh, x25519).
      crypto:generate_key(ecdh, x25519, Sx).
      

      I get the following error:

      ** exception error: bad argument
           in function  crypto:ec_key_generate/2
              called as crypto:ec_key_generate({evp,x25519},
                                               <<168,134,249,58,64,88,47,230,59,37,192,170,38,73,77,5,
                                                 68,255,244,209,130,80,78,126,43,46,239,...>>)
      

      Everything works fine for other curves, like secp128r2.

      I was originally looking to generate an ed25519 keypair when I run into this issue, but I don't think ed25519 key generation is supported at all.

        Attachments

          Activity

            People

            Assignee:
            otp_team_ps Team PS
            Reporter:
            bkolobara Bernard Kolobara
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: