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

127
Views
How to add a cbor.tag to a cose signature in cose-js

Does anyone with experience with cose-js know how to add a cbor tag to a cose signature? More specifically the tag "18" indicating that it is cose-sign1.

I am studying COSE for my computer science course and I need to encode a secret recipe using CBOR and COSE, using the cose-sign1 procedure.

const payload = Buffer.from('mysecretfoodrecipe', 'base64') 
const headers = {
  'p': {'alg': 'ES256', 'kid': 'chefsid'},
  'u': []
};
const signer = {
  'key': {
    'd': Buffer.from('mysecretrecipesignature', 'hex')
  }
};

cose.sign.create(
  headers,
  payload,
  signer)
.then((buf) => {
  console.log('Signed message: ' + buf.toString('hex'));
  console.log(headers, payload, signer)
  return buf.toString('hex')
}).catch((error) => {
  console.log(error);
});

Currently you get this --> {[[protected header, unprotected header], [payload], [signature]]}.

But I require this --> {Number: 18 Content: [[protected header, unprotected header], [payload], [signature]]}

Any ideas?

Thanks

about 4 years ago · Juan Pablo Isaza
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!