X25519 vs P-256: curve choices in key exchange

X25519 and P-256 are two elliptic-curve groups used for key exchange, and the main distinction is that X25519 is a Montgomery-form curve defined in RFC 7748 while P-256 is a NIST prime curve defined for FIPS and U.S. Government use. Both appear in TLS and in hybrid post-quantum pairings.

On this page

Does X25519 or P-256 apply to your key exchange configuration?

You met both names in a vendor document, a TLS configuration or a tender, and you need to know which one your key exchange actually uses. X25519 and P-256 are both elliptic-curve groups used for key agreement, but they differ in curve form and in the document that defines them. X25519 is a Montgomery-form curve defined in RFC 7748, while P-256 (also called secp256r1) is a Weierstrass-form curve named in RFC 5480 and recommended for U.S. Government use in NIST SP 800-186. Those definitions drive the question you are asking: which group your stack offers, and which it prefers.

This question usually comes up for TLS engineers configuring supported groups, for architects reviewing vendor responses, and for compliance reviewers checking a tender. In TLS 1.3, P-256 appears in the Supported Groups enumeration with code point 0x0017 and X25519 with 0x001D, as set out in RFC 8446. Certificates use different identifiers again: the X25519 key OID is defined in RFC 8410, and P-256 keys carry the OID given in RFC 5480. A product can support both groups in its configuration while presenting certificates or key shares that use only one of them.

Post-quantum work adds a second layer. Hybrid pairings such as X25519MLKEM768 combine a classical curve with a lattice-based KEM, and the curve half of that pairing is what your existing configuration already controls. Before you accept a vendor claim about hybrid support, confirm which classical group is paired, the exact version and build, and whether the default preference order changed in a release you run. Check the current default ordering in your own stack's documentation, for example the OpenSSL and Go release notes, rather than relying on a general statement.

X25519 and P-256 side by side, attribute by attribute

This table sets X25519 and P-256 against each other on the attributes the sources give, including defining document, curve form, intended security level, TLS and X.509 identifiers, and shared secret size. Read each row across both columns to see where the two groups match in the sources and where they differ. The main takeaway is that the two are separate curve groups with different encodings and identifiers, so a hybrid pairing must name each one explicitly.

AttributeX25519P-256 (secp256r1)
Defining documentRFC 7748RFC 5480 (named P-256 in FIPS 186-3)
Curve formMontgomery form, scalar multiplication (X25519 function)Named curve identified by OID, used with ECDH
Intended security levelRoughly 128-bit, per RFC 7748128-bit with SHA-256, per RFC 5480
TLS 1.3 code point0x001D (x25519)0x0017 (secp256r1)
TLS value in RFC 842229 (x25519)23 (secp256r1)
X.509 OID1.3.101.110 (id-X25519, RFC 8410)1.2.840.10045.3.1.7
Shared secret size32 bytes, used directly as the premaster secret per RFC 8422The sources listed on this page do not state the P-256 shared secret size
Where it appears in the sourcesNamed in OpenSSL 3.5 default TLS keyshares and Go 1.24 hybrid defaults with X25519MLKEM768Listed among TLS 1.3 Supported Groups; NIST SP 800-186 covers elliptic curves recommended for U.S. Government use

What X25519 and P-256 each are, and which document defines them

X25519 is the Diffie-Hellman function on Curve25519, specified in RFC 7748. RFC 7748 defines Curve25519 and Curve448 and describes them as intended for roughly the 128-bit and 224-bit security levels. Its X25519 function performs scalar multiplication on the Montgomery form of the curve, and the RFC fixes the size of its data: X25519 inputs and outputs are 32-byte strings. That fixed width is one of the practical differences from P-256, whose public points are encoded differently. Readers comparing the two should check the length of the key share their stack actually transmits and stores, since the 32-byte value is the one RFC 7748 defines.

  • Curve and function: Curve25519 is defined in RFC 7748, and X25519 is the function that runs on it.
  • Input and output size: X25519 inputs and outputs are 32-byte strings, per RFC 7748.
  • Intended security level: RFC 7748 associates Curve25519 with roughly the 128-bit level.
  • Not the same as Ed25519: the signature scheme Ed25519 is a separate construction and is not defined by RFC 7748.
  • Parameter check: confirm in the library documentation that the key length and encoding match RFC 7748 before comparing sizes across products.

When reviewing an X25519 deployment, confirm the library and version used, and check that the implementation follows RFC 7748 for input and output lengths.

Which differences between X25519 and P-256 change system behavior

X25519 and P-256 both appear as classical groups in hybrid key exchange, but they differ in curve form, encoding, and how the shared secret feeds the handshake. Each difference below changes something an operator must configure, verify or document.

Curve form changes the group identifier

X25519 is defined on the Montgomery form of Curve25519, and RFC 7748 specifies it as scalar multiplication on that form. P-256, also called secp256r1, is a prime-field curve, so the two are not drop-in substitutes at the parameter level. Operators who inventory curves should record the curve form next to the group name rather than assuming one label covers both. Confirm the group your library negotiates before writing it into a policy.

RFC 7748

Input and output sizes differ

RFC 7748 states that X25519 inputs and outputs are 32-byte strings. Sizes are the place where a parser or fixed-length buffer can fail when a group is swapped. Teams that validate key shares or log exchange material should check the expected length for each group. Confirm the length handling in any custom code that touches these values.

RFC 7748

Premaster secret comes straight from the shared secret

RFC 8422 says the X25519 shared secret is used directly as the 32-byte premaster secret. That means a deployment that relies on a fixed derivation step for every group should confirm how its stack handles X25519 specifically. Reviewers comparing traces or test vectors should expect this path to differ from the P-256 path. Verify the premaster handling against your TLS implementation's documentation.

RFC 8422

Certificate encoding uses different identifiers

RFC 5480 assigns secp256r1 the object identifier 1.2.840.10045.3.1.7, while RFC 8410 assigns id-X25519 the identifier 1.3.101.110 for X.509 certificates and keys. A certificate profile or parser that expects one identifier will reject the other. PKI teams should confirm which key types their issuing and validating tools accept. Check the encoding in your certificate profile before issuing keys for either group.

RFC 8410

NIST guidance names the curves differently

NIST SP 800-186 specifies the elliptic curves recommended for U.S. Government use, and it names curves in its own terms rather than the RFC names used for X25519. A compliance reviewer matching a control to a curve name should map the NIST name to the protocol name before concluding a group is covered. Ask the auditor which naming the assessment uses. Confirm the mapping against the SP 800-186 text.

SP 800-186

Default preference varies by library release

OpenSSL 3.5.0 changed the default TLS keyshares to offer X25519MLKEM768 and X25519, and Go 1.24 enables X25519MLKEM768 by default in crypto/tls when CurvePreferences is nil. Default group order therefore changes with the library version, not only with configuration. Operators upgrading libraries should re-check which group a handshake actually selects. Test the negotiated group after each upgrade.

OpenSSL 3.5 notes

Where X25519 and P-256 show up in TLS, certificates and libraries

Teams reviewing key exchange need to know which curve a given stack actually negotiates, and the answer depends on where the curve is named. In TLS 1.3, both secp256r1 (P-256) and x25519 are entries in the Supported Groups enumeration, with code points 0x0017 and 0x001D respectively, as defined in RFC 8446. RFC 8422 assigns the same two groups the TLS values 23 and 29 and says the X25519 shared secret is used directly as the 32-byte premaster secret. P-256 therefore appears in the same lists as X25519 across TLS, and a server or client can offer either one unless its configuration removes it. Check the Supported Groups configuration on each endpoint, not only the library version.

Library defaults have moved recently, and the defaults are where most inherited configurations get their curves. OpenSSL 3.5.0, released 8 Apr 2025, changed the default TLS keyshares to offer X25519MLKEM768 and X25519, and it added hybrid post-quantum KEM groups to the default supported groups list, preferring them. Go 1.24 enables X25519MLKEM768 by default in crypto/tls when Config.CurvePreferences is nil, and the GODEBUG setting tlsmlkem=0 reverts that default. Confirm the exact behavior for the versions you run in the OpenSSL 3.5 release notes and the Go 1.24 release notes, because a service that sets its own curve preferences will not follow these defaults.

Certificates and keys carry a separate identifier. RFC 5480 gives secp256r1 the OID 1.2.840.10045.3.1.7 for elliptic-curve keys, while RFC 8410 assigns X25519 the OID 1.3.101.110 for X.509 certificates and keys. A certificate chain can therefore use one curve for its keys while the key exchange negotiates the other, so inventory the certificate key algorithm and the TLS group separately. NIST SP 800-186 specifies the elliptic curves recommended for U.S. Government use, so federal reviewers will check P-256 against it. Ask each vendor which curves appear in certificates it issues and which appear in its TLS configuration.

How the two groups sit in a TLS 1.3 key exchange handshake

The diagram starts with the client's ClientHello, which carries a Supported Groups list containing x25519 (0x001D) and secp256r1 (0x0017), and in some configurations a hybrid group such as X25519MLKEM768 as a single entry alongside them. The server selects one group from that list and returns its key share, and the two sides derive the shared secret from it. Check which entries a given client and server actually offer, because the sources listed on this page do not establish that any particular implementation will choose one group over another. The sources do establish that X25519 and secp256r1 are distinct code points in the same enumeration, and that the hybrid group is one entry, not two.

Client and server negotiate one group from a Supported Groups list that can hold X25519, secp256r1 and a hybrid entry.

Whether X25519 and P-256 are used together or replace each other

X25519 and P-256 are not presented in the sources as alternatives where one replaces the other. Both are elliptic-curve groups that can appear together in the same supported groups list. In TLS 1.3, P-256 is assigned the code point 0x0017 and X25519 the code point 0x001D in the Supported Groups enumeration (RFC 8446). A client advertises the groups it can use, and the server selects one from that list according to its own preference. The sources do not describe one group being removed when the other is added. Each keeps its own assigned value, so a deployment can offer both, offer only one, or prefer one and fall back to the other. The choice is made per connection during negotiation, which means the same server can accept X25519 from some clients and P-256 from others.

The post-quantum context adds a further layer. RFC 9794 defines terminology for post-quantum traditional hybrid schemes, meaning schemes that combine a post-quantum algorithm with a traditional asymmetric one (RFC 9794). RFC 10024 defines post-quantum traditional hybrid key agreement for TLS 1.3 (IETF RFC 10024 record). In the hybrid case, the classical component is an elliptic-curve group, and X25519 and P-256 are the two groups most often named for that role. OpenSSL 3.5.0 changed its default TLS groups to prefer hybrid groups, and it offers X25519MLKEM768 and X25519 as default key shares (OpenSSL 3.5 release notes). Go 1.24 enables X25519MLKEM768 by default when no curve preferences are set, and the GODEBUG setting tlsmlkem=0 reverts that default (Go 1.24 release notes). These are defaults in those releases, not a statement that either curve is retired.

For planning, confirm three things for each product and version you run. First, check whether its default group list includes P-256, X25519 or a hybrid group, and whether it can be configured to prefer or exclude one. Second, check whether your compliance profile names a curve. NIST SP 800-186 specifies the elliptic curves recommended for U.S. Government use (NIST SP 800-186), so review it against your requirements before removing either group. Third, confirm that peers you must interoperate with support the groups you intend to keep. The sources listed here do not say that X25519 and P-256 are interchangeable, and compatibility for specific versions must be confirmed in each vendor's documentation.

How to work out which group applies to your system

This sequence tells you which elliptic-curve key exchange groups, X25519 or P-256, your servers and clients actually negotiate and which certificate key type they present. It ends with a written record you can check against the vendor documentation for the versions you run.

  1. Confirm the requirement source and contract terms

    Start by identifying where any requirement for a specific curve comes from. Check the requirements section of your project, any internal security policy, and any federal contract that names NIST SP 800-186 or another document as a condition of delivery. Record each source, its date and the clause that applies. If no requirement exists, note that too, because the choice then falls to your own configuration review. The output is a short list of binding sources, or a statement that none were found.

  2. Inventory the TLS stacks and libraries in use

    List every service that terminates TLS or negotiates key exchange, along with the library that performs the negotiation: OpenSSL, Go's crypto/tls, a load balancer, a service mesh, or a client SDK. Include both server and client roles, since either side can constrain the group that is finally used. Assign an owner to each entry. The output is an inventory table with one row per stack, which becomes the basis for the remaining checks.

  3. Check default supported groups for each version

    For each library in the inventory, read the default supported groups and key share list for the exact version you run, using the vendor release notes and configuration documentation. Note whether X25519, secp256r1 (P-256), or hybrid post-quantum groups are offered by default and in what order. Defaults have changed in recent releases, so do not assume they match an older version. Record the version, the default list and the source page. The output is a per-version record of what each stack offers before any local override.

  4. Test the groups actually negotiated

    Compare the documented defaults with what your systems negotiate in practice. Use a TLS client that reports the selected group, such as openssl s_client with the relevant options, against a test endpoint you control, and record the group shown in the handshake. Repeat the test with any configuration overrides you use, such as explicit group lists or GODEBUG settings. Where the observed group differs from the documented default, note the discrepancy and the configuration responsible. The output is a table of observed groups per service and configuration.

  5. Check certificate key type and OID in your PKI

    Separately from key exchange, inspect the certificates your PKI issues and deploys. Identify whether each leaf certificate carries an elliptic-curve key on P-256, which is identified by the OID 1.2.840.10045.3.1.7, or an Ed25519 or X25519 key, identified by OIDs such as 1.3.101.110 for X25519. Key exchange groups and certificate key types are independent, so record both. The output is a list of certificates with their key type and OID, grouped by issuing CA.

  6. Confirm each finding against vendor documentation

    Before drawing conclusions, check every finding against the vendor documentation for the exact version you run. Vendor defaults, supported group names and configuration keys can differ between releases and editions, and the sources on this page describe general behavior, not your build. Where documentation and observed behavior disagree, raise it with the vendor and keep the test output. The output is a set of verified findings, each linked to a vendor source.

  7. Record which group applies to each system

    Combine the requirement sources, the per-version defaults, the observed negotiations and the certificate inventory into one record per system. For each system, state which group it negotiates, which certificate key type it presents, which requirement applies, and which items remain unverified. Assign a reviewer and a review date. This record is what an auditor or procurement reviewer can check, and it is the input for any later change to the configuration.

Common mix-ups between X25519 and P-256 in tenders and vendor claims

Tenders and vendor documents often use X25519, P-256, secp256r1 and hybrid group names loosely, and the same words can refer to different roles. The cards below separate key exchange groups from signature curves, show where one name stands for another, and list the checks reviewers should run before accepting a claim.

Key exchange group versus signature curve

A key exchange group such as X25519 or secp256r1 negotiates a shared secret during the handshake, while a signature curve is used to sign certificates or messages. A claim that a product supports P-256 for key exchange says nothing about the curve on its certificates, and the reverse is also true. Ask the vendor which role each curve plays in the configuration they are describing, and confirm the answer against the protocol section of the relevant RFC, such as the Supported Groups entries in TLS 1.3. The role of the curve is the first thing to pin down in any tender answer.

TLS 1.3 text

Secp256r1 and P-256 are one group

RFC 5480 gives secp256r1 the OID 1.2.840.10045.3.1.7 and notes that it is called P-256 in FIPS 186-3. A tender that lists P-256 as a requirement and a product that lists secp256r1 are therefore describing the same curve, and a reviewer should not treat them as two options that must both be present. Check that the OID or TLS value matches what the product actually negotiates, since names can differ across documents while the underlying group stays the same. Writing both names in one requirement is redundant, not a stricter test.

RFC 5480 text

Library defaults are not requirements

Default group lists change with library versions, so a default is a property of one release rather than a requirement the organization has set. OpenSSL 3.5.0, released 8 April 2025, changed its default TLS supported groups to include and prefer hybrid PQC KEM groups, and Go 1.24 enables X25519MLKEM768 by default in crypto/tls when CurvePreferences is nil. Reviewers should ask which configuration the vendor ships, whether the organization can override it, and what the policy requires. A product that works with the default is not thereby compliant with a tender clause that names specific groups.

OpenSSL 3.5 notes

Hybrid group names are not classical groups

A hybrid name such as X25519MLKEM768 combines a classical group with a post-quantum key encapsulation mechanism, and RFC 9794 uses the term post-quantum traditional hybrid for schemes of this kind. A claim that a system supports X25519 may be satisfied by the hybrid group, but a claim that a system supports only X25519 as its key exchange is a different statement. Read the vendor's list of supported groups in full, and ask whether a hybrid group is offered, preferred, or only available under specific settings. Confirm the exact group name in the configuration against the draft or RFC it implements.

RFC 9794 text

Questions people search about X25519 and P-256

Are X25519 and P-256 the same elliptic-curve group?

No. They are different groups. X25519 is built on Curve25519, which RFC 7748 specifies along with Curve448 and the X25519 and X448 functions that perform scalar multiplication on Montgomery forms of those curves. P-256, also called secp256r1, is a different curve that RFC 5480 assigns the OID 1.2.840.10045.3.1.7 and recommends for 128-bit security with SHA-256. They are not interchangeable. The two also differ in encoding: X25519 inputs and outputs are 32-byte strings according to RFC 7748, and the two groups carry different TLS identifiers, so a configuration must name each one explicitly. Confirm the group your implementation uses against the version you run.

Which of X25519 and P-256 is newer?

The sources on this page do not rank the two by security or give a clear date of introduction for each. RFC 7748 covers Curve25519 and X25519, and RFC 5480 covers secp256r1 with its OID. What the sources do show is how each is used today. P-256 is the curve NIST SP 800-186 covers for U.S. Government use, and TLS 1.3 assigns it the code point 0x0017. X25519 has its own TLS code point, 0x001D, and RFC 8410 gives it an X.509 OID. Neither source establishes that one is more current than the other, so compare the dates in the RFCs and the standard if age matters to your review.

Which curve does a rule or customer require?

The answer depends on the rule or customer contract, and the sources on this page do not say which curve any particular rule or customer requires. NIST SP 800-186 specifies the elliptic curves recommended for U.S. Government use, so a federal or contractor requirement may point to it. Ask the customer or the governing document which named curves are accepted, and get the answer in writing. Do not assume that a curve listed in one profile is accepted in another. Check the security requirements in your contract or assessment scope before choosing a group.

Do I need both X25519 and P-256 in a TLS configuration?

The sources on this page support offering both groups in TLS 1.3, since each has its own Supported Groups code point, but they do not state that both are required. RFC 8446 lists secp256r1 as 0x0017 and x25519 as 0x001D. RFC 8422 gives each a TLS value and says the X25519 shared secret is used directly as the 32-byte premaster secret. A server and client only agree on a group both sides list, so the offered list determines what can be negotiated. Whether you need both depends on your clients and on any rule that names a curve, so check the configuration of the servers and clients you operate.

What does an X.509 OID tell me about a key or certificate?

An OID identifies the algorithm a certificate or key uses, so it tells you which curve or key type the object carries. RFC 5480 assigns P-256 the OID 1.2.840.10045.3.1.7. RFC 8410 assigns X25519 the OID 1.3.101.110 for X.509 certificates and keys. An OID does not show the key length, the hash used in a signature, or whether a library supports the algorithm. Read the OID from the certificate or key with your own tooling, then compare it against the algorithm your policy or customer names, and confirm that the software on each side accepts it.

What should I ask a vendor about X25519 and P-256 support?

Ask which curves the product offers in key exchange, which version and edition each claim applies to, and whether P-256 and X25519 are both available in its TLS configuration. Ask how its default list is set and whether the defaults changed in a recent release. Ask whether the product can be configured to prefer one group, and how to check the negotiated group in practice. OpenSSL 3.5.0, released 8 April 2025, changed the default TLS supported groups list and the default keyshares, and Go 1.24 enables X25519MLKEM768 by default in crypto/tls when no CurvePreferences are set. Request the vendor's written answer for the exact release you deploy.

Does picking a curve change what I have to deploy or pay for?

The sources on this page do not give costs, effort or timelines for choosing between X25519 and P-256, and they do not establish that one choice costs more to deploy. The cost of a curve choice usually comes from testing each configuration against the clients and servers you run, updating any policy or inventory that names a curve, and rechecking when a library default changes. These effort components are one-time when you set the configuration and recurring when defaults or dependencies change. Ask any implementation partner to separate those components in a written quote, and do not accept a figure without its basis.

How DeployOpen works on this

DeployOpen scopes, builds and documents the key exchange group settings in the client's own systems, so that the choice between X25519 and P-256 and any hybrid pairing is recorded, tested and handed over in writing. Engagements are fixed-scope, with the scope agreed before work starts.

How we scope

  • We list which TLS, SSH or VPN endpoints in the client's environment negotiate X25519, P-256 or both today.
  • The written scope names the products, versions and configuration files that will be reviewed and changed.
  • We agree in writing whether hybrid groups such as X25519MLKEM768 are in or out of the migration.
  • Ongoing support can be added as a retainer once the fixed-scope work is complete.

How we build

  • We set group preference lists in the client's servers and clients, keeping the order the client has approved.
  • We test handshakes against each group and record which group is actually negotiated in each path.
  • Where a library default changes between versions, we check the running version and its default behavior.
  • We keep changes limited to configuration unless the written scope includes code or library updates.

How we hand over

  • The client receives a document listing every group setting changed, with the file, version and value used.
  • Test results show the negotiated group for each tested endpoint, with the date of the test.
  • We record any endpoints that cannot be changed, so the client can plan isolation or replacement for them.
  • Handover includes a short walkthrough so the client's platform team can repeat the checks themselves.

How we support

  • A retainer can cover re-testing after product upgrades that change default key exchange groups.
  • We can re-check group negotiation after certificate or library changes, against the agreed test list.
  • Support findings are reported in the same format as the original handover document.
  • Confirm with the client's standards owners which NIST or IETF documents govern their target groups before work starts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.