Code Monkey home page Code Monkey logo

Comments (5)

alexissinglaire avatar alexissinglaire commented on September 3, 2024

@nifrali : the error has something to do with the encryption key took from secret manager . Can you verify again your config.ts value especially on the section encryption for following parameters : defaultAlgorithm, keyPath and defaultVersion.

Those value should match with your secret value definition.

Good luck.

from opentrace-cloud-functions.

sethupathiramalingam avatar sethupathiramalingam commented on September 3, 2024

Hi Team,

I have the same problem. Even My encryption section "defaultAlgorithm, keyPath and defaultVersion" those parameters added properly. Previously it's was working as we expected.

OpenTrace team: Please give your input.

Thanks in advance :)

Please help me.

from opentrace-cloud-functions.

jandresnc avatar jandresnc commented on September 3, 2024

I had the same problem, I solved it changing the UID_SIZE parameter in getTempIDs.ts. The UID size is in fact 21 bytes long but when it is encrypted it starts coded as base64 that makes it appear longer. Obviously it changes the size of the final frame as well. In order to get the solution I used CyberChef to do the operations in both ways, encrypting and decrypting the tempId frame

https://gchq.github.io/CyberChef/

const decryptedB64 = customEncrypter.decodeAndDecrypt(payloadData, [UID_SIZE + 19, IV_SIZE, AUTHTAG_SIZE]); // <-- first field must be 40 bytes

. Moreover, I changed the CustomEncrypter.ts in the following parts of the code since it was not able to compile. Here my changes:

  // @ts-ignore
    //let plainText = decipher.update(cipherText, 'base64', 'base64'); <- it cannot be both the same according to the documentation**
    let plainText = decipher.update(cipherText, 'base64', 'utf8');   // <-- my change was base64 to utf8
    plainText += decipher.final('utf8');  // <-- final method also must be changed
    return plainText;
  }

 let cipherText = cipher.update(dataB64, 'base64', 'base64');  // <-- original
let cipherText = cipher.update(dataB64, 'utf8', 'base64');  // <-- my change 
    cipherText += cipher.final('base64');
    return [
      cipherText,
      iv.toString('base64'),
      cipher.getAuthTag().toString('base64')
    ];
  }`

Good luck!

from opentrace-cloud-functions.

sethupathiramalingam avatar sethupathiramalingam commented on September 3, 2024

Hi @jandresnc,

Thanks for the update. I have tried your solution but it is not working for me. Kindly suggest some other way to resolve this issue.

Other on the thread did you find any solution on the reported issue. Please help me.

Thanks in advance.

from opentrace-cloud-functions.

jandresnc avatar jandresnc commented on September 3, 2024

Hello @sethupathiramalingam , I suggest taking the encrption and decryption process step by step in your code, I did it showing with console.log all the steps in order to identify the part that was not according to the documentation, also I inspected the bytes lenght in each step. At the same time I took the message and I followed the same process using Cyberchef in order to compare the results, and when I detected the difference I got that solution. Maybe you could post one of your messages here to try to decrypt it and show you the steps.

from opentrace-cloud-functions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.