Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
node-jose cyrillic support, how to?

https://github.com/cisco/node-jose it's my code example:

    let keystore1;
    let keystore2;
    keystore1 = JWK.createKeyStore();
    keystore2 = JWK.createKeyStore();

    const input = { message: { text: 'Привет!' } };

    const priv1 = await keystore1.generate('EC', 'P-256', {
      kid: '1gBdaS-G8RLax2qgObTD94w',
      key_ops:["sign", "decrypt", "unwrap"]
    });
    const priv2 = await keystore2.generate('EC', 'P-256', {
      kid: '2gBdaS-G8RLax2qgObTD94v',
      key_ops:["sign", "decrypt", "unwrap"]
    });

    const pub1 = await JWK.asKey(priv1.toJSON());
    const pub2 = await JWK.asKey(priv2.toJSON());
    const encrypted = await JWE.createEncrypt(
      {
        format: 'compact',
        fields: {
          alg: 'ECDH-ES',
          enc: 'A128CBC-HS256',
          cty: 'json', // replace with JWT if you're encrypting a JWT...
        },
      },
      {
        key: pub2,
      }
    )
      .update(JSON.stringify(input))
      .final();

    console.log('encrypted', encrypted);

    const decrypted = await JWE.createDecrypt(priv2).decrypt(encrypted);

    console.log('decrypted', JSON.parse(decrypted.payload.toString()));

// simulate only having access to the public key, usually this is your starting point as you only have access to the public components if you're encrypting a message for someone else.

With latin - decryption ok! How to decrypte with cyrillic, please help me.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can pass the encoding to the update function.

e.g.JWE.createEncrypt(...).update(input, "utf8")

Doc

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!