mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-15 01:17:36 +00:00
GitBook: [master] one page modified
This commit is contained in:
parent
b3c8c325f1
commit
c8225861c4
1 changed files with 12 additions and 0 deletions
|
@ -137,6 +137,18 @@ If the JWT has embedded a public key like in the following scenario:
|
|||
|
||||
![](../.gitbook/assets/image%20%28436%29.png)
|
||||
|
||||
Using the following nodejs script it's possible to generate a public key from that data:
|
||||
|
||||
```bash
|
||||
const NodeRSA = require('node-rsa');
|
||||
const fs = require('fs');
|
||||
n ="ANQ3hoFoDxGQMhYOAc6CHmzz6_Z20hiP1Nvl1IN6phLwBj5gLei3e4e-DDmdwQ1zOueacCun0DkX1gMtTTX36jR8CnoBRBUTmNsQ7zaL3jIU4iXeYGuy7WPZ_TQEuAO1ogVQudn2zTXEiQeh-58tuPeTVpKmqZdS3Mpum3l72GHBbqggo_1h3cyvW4j3QM49YbV35aHV3WbwZJXPzWcDoEnCM4EwnqJiKeSpxvaClxQ5nQo3h2WdnV03C5WuLWaBNhDfC_HItdcaZ3pjImAjo4jkkej6mW3eXqtmDX39uZUyvwBzreMWh6uOu9W0DMdGBbfNNWcaR5tSZEGGj2divE8";
|
||||
e = "AQAB";
|
||||
const key = new NodeRSA();
|
||||
var importedKey = key.importKey({n: Buffer.from(n, 'base64'),e: Buffer.from(e, 'base64'),}, 'components-public');
|
||||
console.log(importedKey.exportKey("public"));
|
||||
```
|
||||
|
||||
It's possible to generate a new private/public key, embeded the new public key inside the token and use it to generate a new signature:
|
||||
|
||||
```bash
|
||||
|
|
Loading…
Reference in a new issue