Skip to content

crypto: State not recovered after an exception is thrown #4879

@jiripospisil

Description

@jiripospisil

While upgrading one of our applications to Node.js 4.2.6 (from 4.2.3) I bumped into an issue with the crypto module. In the tests, we supply an invalid key into the createCipheriv function and it barks as expected.

However, when running the same code again later in the tests, this time with a correct key, it still doesn't work and an exception is thrown. It weird thing is that the error comes from a different crypto function (createHash). I assume some internal state is not being cleared.

The code works on Node.js 4.2.3 and fails on 4.2.4-6. It's still entirely possible that we're doing something wrong. Any suggestions are welcomed.

https://gist.github.com/jiripospisil/70450ba715a004a11623

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.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