-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JWT #12
Comments
You can read all about it here: https://tools.ietf.org/html/rfc7517 What it essentially means is that N is the modulus component of your RSA key and D is your private exponent. The names aren't picked very well, but that's what it is. ;) This is an interesting issue however, since the creation/conversion from one project to another should be rather smooth. What format is your private key in? |
PEM |
First, I want to note that because certificates only contain public keys, you can only read and verify signed JWTs with them, not sign them. But for using a PEM cert, I just made an update to one of the dependencies for this project (JWTVapor), so if you update your packages ( let jwtProvider = JWTProvider { cert in
let headers = JWTHeader(alg: "RS256", crit: ["exp", "aud"], kid: "user_manager_kid")
return try CertService(certificate: cert, header: headers)
} The |
Can you do me a favor? Try this little bash-script with your key-file and see if that works: #!/bin/bash
data=$(openssl rsa -in my-key.key -noout -modulus)
length=${#data}
modulus=${data:8:length}
modulusMd5="test"
echo "N:"
echo $modulus | xxd -r -p | base64
data=$(openssl rsa -in dummy.key -noout -text)
p1=$(echo $data | python -c 'print(raw_input().index("privateExponent: "))+17')
p2=$(echo $data | python -c 'print(raw_input().index("prime1:"))')
d=$((p2-p1))
p=$(echo $data)
echo "D:"
echo ${p:p1:d} | xxd -r -p | base64 make sure to adjust "my-key.key" to match your file |
It printed out: N: |
is that exactly what I need to set in the configuration? |
Those should be the values you need, yes. Note: Since they are now public in GitHub I hope this is not some kind of production environment. :) |
sure 😂 |
Could you please explain how to generate this N and D values from JWT? I used JWT with NodeJS but never faced with a manual configuration of those parameters.
The text was updated successfully, but these errors were encountered: