-
| The  I'm not strong in cryptography, but I can not even imagine how public key may be useful by its own and what is the difference between a single private key and symmetric key | 
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
| You have that already. If you do something like: const fs = require('fs')
const path = require('path')
const jose = require('@panva/jose')
const keystore = new jose.JWKS.KeyStore()
const jwkPrivateFilePath = path.resolve('private.json')
const jwkPublicFilePath = path.resolve('public.json')
keystore.generate('RSA', 2048, { use: 'sig' })
  .then(() => {
    fs.writeFileSync(
      jwkPrivateFilePath,
      JSON.stringify(keystore.toJWKS(true), null, 2)
    )
    fs.writeFileSync(
      jwkPublicFilePath,
      JSON.stringify(keystore.toJWKS(false), null, 2)
    )
  })Turning point is  | 
Beta Was this translation helpful? Give feedback.
-
| 
 I don't know either that's why generating private is the default. 
 You just generate the private one, all private keys contain or are able to derive its public counterpart. const j = require('@panva/jose');
const jwk = j.JWK.generateSync('EC');
console.log(`JWK private\n`, jwk.toJWK(true));
console.log(`JWK public\n`, jwk.toJWK());
console.log(`PEM private\n`, jwk.toPEM(true));
console.log(`PEM public\n`, jwk.toPEM()); | 
Beta Was this translation helpful? Give feedback.
-
| 
 This ☝️ ! | 
Beta Was this translation helpful? Give feedback.
-
| @panva @big-kahuna-burger thank you for answering so fast! Now I can see how to use it :) | 
Beta Was this translation helpful? Give feedback.
I don't know either that's why generating private is the default.
You just generate the private one, all private keys contain or are able to derive its public counterpart.