-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Using private/public key example #131
Copy link
Copy link
Closed
Labels
enhancementhelp-wantedIf you're looking to help the project, start with these!If you're looking to help the project, start with these!
Description
Hi, can you please provide an example of how to sign/verify using an existing private/public key pair?
I got it working in node with node-jsonwebtoken, like this:
var key = fs.readFileSync('private.key');
var pem = fs.readFileSync('public.pem');
var header = {...};
var payload = {...};
header.algorithm = "RS256";
var message = jsonwebtoken.sign(payload, key, header);
var decoded = jsonwebtoken.verify(message, pem, {algorithm: "RS256"});
And it works just fine.
I would like to do the same in Java.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementhelp-wantedIf you're looking to help the project, start with these!If you're looking to help the project, start with these!