Comments (6)
This is your key's structure. The library expects it to be this, i.e. having the publicKey member.
I have a fix for this for Node runtimes >= 12.0.0. I can't fix this for ^10.13.0 because i lack the functionality to compute the public key out of a private one and the extra code needed does seem like an overkill when all a person needs is to use lts/12 runtime.
from jose.
I think my code doesn’t account for EC private keys that don’t include the public key in them.
I’ll see what I can do, in the meantime, can you post the command that generated this key?
from jose.
I was trying out some openssl commands to generate a private key that does not have a public key embedded. Tried this:
openssl ecparam -name prime256v1 -genkey -noout -out key.pem
I am searching for a way to extra only the private key part from here.
PS: The library works fine with the key embedded with the public key
I generally generate the KeyPair using the Java security library:
public static KeyPair generateEcKeyPair() {
String name = "prime256v1";
try {
KeyPairGenerator generator = KeyPairGenerator.getInstance("EC");
ECGenParameterSpec spec = new ECGenParameterSpec(name);
generator.initialize(spec, new SecureRandom());
return generator.generateKeyPair();
} catch (Exception exp) {
// Your code
}
}
Once you get the key pair, you can access the private key separately and extract the base64 encoded format using Java's util functions.
from jose.
PS: The library works fine with the key embedded with the public key
I know.
from jose.
Thanks a lot @panva fo your quick support. :)
from jose.
Please consider supporting the library if it provides value to you or your company and this support was of help to you. Supporting the library means, amongst other things, that such support will be available in the future.
from jose.
Related Issues (20)
- Bun support ED25519 HOT 1
- Bun bun bun!! HOT 17
- Bun: SyntaxError: Import named 'KeyObject' not found in module 'crypto'. HOT 3
- Mocking URLs with msw/nock doesn't work with named imports. HOT 1
- [ES384] adding a single letter to the signature part causing a successful verification HOT 7
- Type "GetKeyFunction" is present in "types.d.ts" but not exported in "index.d.ts" HOT 1
- Check for `jwk.oth` should also check for `null` value HOT 2
- CryptoKey is not extractable HOT 1
- JWKS Timeout : request timed out HOT 1
- Cannot read properties of undefined (reading 'base64url') HOT 7
- Claims validation should not mutate incoming `requiredClaims` array HOT 6
- jose importSPKI error TypeError: "spki" must be SPKI formatted string HOT 2
- Bun: Export named 'diffieHellman' not found in module 'crypto'. HOT 1
- Maybe slightly tweak the exports? HOT 4
- createLocalJWKSet should not generate a TS error when called with immutable input HOT 2
- Signature verification works in Node.js but fails in Cloudflare Workers HOT 1
- Cloudflare: The requested module 'node:crypto' does not provide an export named 'constants' HOT 5
- Support for AWS Lambda LLRT Runtime HOT 1
- `msw` is unable to intercept JWKS request in node environment due to namespace (`* as`) import HOT 1
- [Usage with Vitest/JSDOM] payload must be an instance of Uint8Array HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jose.