Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cipher job failed #37370

Closed
ghost opened this issue Feb 14, 2021 · 9 comments
Closed

Cipher job failed #37370

ghost opened this issue Feb 14, 2021 · 9 comments

Comments

@ghost
Copy link

ghost commented Feb 14, 2021

Node: 15.8.0
System: Ubuntu

We've been using the experimental WebCrypto module to encrypt and decrypt data in Nodejs. Sometimes, we see Cipher job failed in the logs with no other information given. Because of that, I sadly don't have anything else to share. I'm hoping someone could look into it.

Much appreciated!

@jasnell
Copy link
Member

jasnell commented Feb 14, 2021

Could be a couple of issues. We'd need a test case that reproduces that issue in order to chase it down.

@ghost
Copy link
Author

ghost commented Feb 14, 2021

Hi there!

We're encrypting and decrypting buffers using AES-GCM with a 256-bit key for our Websocket MMO. So it's safe to say that there's nothing interesting going on here, but just a lot of data being processed. It also doesn't seem to happen that often, but when it does happen it seems to fail multiple times more frequently.

I started to notice it when half of the clients suddenly got disconnected and I looked at the logs and found a ton of these Cipher job failed errors. I guess having it process 400 buffers is the best way to try and reproduce it, as this is the max amount of clients our servers have and we're assuming each client sends a message every few seconds.

I hope this can be looked into further with my information as it's quite high priority for our setup.

Edit: This error happens when we decrypt data. I've made some edits to include a stack trace, which I'll provide here as soon as it happens again.

@ghost
Copy link
Author

ghost commented Feb 21, 2021

@jasnell I tried catching the stack of this error, but sadly it's just Cipher job failed. What's this about? Could anybody help?

@jasnell
Copy link
Member

jasnell commented Feb 21, 2021

I'll be able to take a look on Monday

@ghost
Copy link
Author

ghost commented Feb 21, 2021

Thank you for your swift response. I'll be awaiting results 🙂

@ghost
Copy link
Author

ghost commented Feb 23, 2021

@jasnell Any info on this? We're still experiencing the problem.

@ghost ghost closed this as completed Feb 28, 2021
@tcoulter
Copy link

Did you ever figure this out? This is the only place on the internet where I've seen the same error, don't know how to get around it.

@tcoulter
Copy link

For anyone finding their way here: I decided to follow the example here and it worked. I don't know why my example didn't, but whatevs: https://gist.github.com/chrisveness/43bcda93af9f646d083fad678071b90a

@fawazahmed0
Copy link

It working for me in nodejs v17.1.0

Here is my partial code:

const fs = require('fs');
const path = require('path');
const {Blob} = require('buffer')
const crypto = require('crypto').webcrypto

async function decryptFile(filePath,ivdata, exportedkey) {

    let file = fs.readFileSync(filePath);
    let encblob = new Blob([file]);
    let decBlob = await decryptblob(encblob, ivdata, exportedkey);
    const buffer = Buffer.from( await decBlob.arrayBuffer() );
    fs.writeFileSync(filePath, buffer);


}

This issue was closed.
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

No branches or pull requests

3 participants