Skip to content

Instantly share code, notes, and snippets.

@snyff
Created June 13, 2020 22:20
Show Gist options
  • Save snyff/1c48bfe9fd9ee8ed5e11d764d26ea7a3 to your computer and use it in GitHub Desktop.
Save snyff/1c48bfe9fd9ee8ed5e11d764d26ea7a3 to your computer and use it in GitHub Desktop.
k = OpenSSL::PKey::RSA.new File.read 'private.pem'
pub = k.public_key
jwks = {
"keys"=> [
{
"kty"=> "RSA",
"use"=> "sig",
"alg": "RS256",
"kid"=> "pentesterlab",
"n" => Base64.urlsafe_encode64(pub.n.to_s(2), padding: false),
"e" => Base64.urlsafe_encode64(pub.e.to_s(2), padding: false)
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment