title: Convert a JSON Public/Private Key pair to rsa.PrivateKey and rsa.PublicKey
body: <p>As the title says, I have a JSON file generated based on <a href="https://mkjwk.org/" rel="nofollow noreferrer">https://mkjwk.org/</a> and now I want to use the generated values to sign a JWT. I will do this for multiple &quot;clients&quot;, each with its own signature.
  These will then be verified against a set of JWKS containing the public keys for the different &quot;clients&quot;.</p>
  <p>However, I'm struggling to understand how to use the generated JSON values..</p>
  <p>I know I can generate one priv/pub keys directly with the <code>crypto/rsa</code> module. I've also seen examples where the ppk is given as input in X509 format, though I was trying to avoid it if possible (I guess I'm just being picky as I prefer to be able to read the contents of a file rather than seeing random chars..)</p>
  <p>From the multiple examples and numerous searches I've done, I haven't seen one where the process of taking a json file and generating a rsa.privateKey is performed.
  I'm also using the <code>jwt-go</code> and <code>jwx</code> modules to handle the rest of the use cases, but this one is escaping me..</p>
  <p>So, what am I missing? How can I go from a JSON like the one below to a <code>rsa.PrivateKey</code>?</p>
  <pre><code>{
      &quot;p&quot;: &quot;vQXloZI9y5..._PPE6m05J-VqhIF6-FQjvwc&quot;,
      &quot;kty&quot;: &quot;RSA&quot;,
      &quot;q&quot;: &quot;u1OqnCCLyEZDMoSfK...SfcIGNSd90PEcPs&quot;,
      &quot;d&quot;: &quot;eoAj0Z0PkK3A0pc5t...9Q8iqGntoxMVARBtQ&quot;,
      &quot;e&quot;: &quot;AQAB&quot;,
      &quot;use&quot;: &quot;sig&quot;,
      &quot;kid&quot;: &quot;r9cuFC3...HiAc7VhSME&quot;,
      &quot;qi&quot;: &quot;upOjfCF_na...H4a7Bs2pWGoS6w5mcqXU&quot;,
      &quot;dp&quot;: &quot;HKGzCclEEP...GdofDVR5Yas&quot;,
      &quot;alg&quot;: &quot;RS256&quot;,
      &quot;dq&quot;: &quot;PDyRNhc5G7OMVChVTm61kn2ShRFTe...BLytOxGBm5ntJv4V0HRBU&quot;,
      &quot;n&quot;: &quot;ilEVn6tSuh7-tZBV8qXmlvzWDE5jTS...sNH8-wPf6gKCuZzEyyS2AyZE8S4NzqoFkaepVpdoOPtb3Q&quot;
  }
  </code></pre>
  <p>Thanks</p>