Skip to content

Uninitialized DH computeSecret should throw instead of returning empty buffers #63674

Description

@ChALkeR

When a DH instance does not have a private key initialized, it just happily returns empty buffers for all public keys.

That is a footgun and needs to be fixed (turned into a throw).

Welcome to Node.js v26.2.0.
Type ".help" for more information.
> require('crypto').createDiffieHellman(512).computeSecret(Buffer.alloc(64,1))
<Buffer >

See also #62838

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions