title: Sign a string with RSA SHA 256 with ONLY the Private Key as a String .NET
body: <p>We're doing an integration with Google via RESTful API and I need to sign a payload of a JWT with RSA-SHA256 and all I have is a Private Key as a string, that looks like</p>
  
  <pre><code>-----BEGIN PRIVATE KEY-----
  MIIEvgIBfADANBg9qhkdsiG9w0BAQEFAASCBKgw
  ......
  -----END PRIVATE KEY-----
  </code></pre>
  
  <p>I've been looking everywhere for a solution, but everyone's talking about <code>X509Certificate2</code> which needs a p12 file, or some Certificates. Now I don't have either of those, I only have a string that is the private key.</p>
  
  <p>Google recommends <a href="https://jwt.io/" rel="nofollow noreferrer">https://jwt.io/</a> and it works with the key string, but well, I need my CODE to do it. There are 3 libraries listed in the page:</p>
  
  <ol>
  <li>One of them belongs to Microsoft and has absolutely no documentation.</li>
  <li>Another one is using <code>X509Certificate2</code> or specifically for string keys only has a link to this place <a href="http://www.donaldsbaconbytes.com/2016/08/create-jwt-with-a-private-rsa-key/" rel="nofollow noreferrer">http://www.donaldsbaconbytes.com/2016/08/create-jwt-with-a-private-rsa-key/</a> which uses some Certificate files I don't have, making it a wrong and unhelpful link to begin with.</li>
  <li>Same creators of #2 have another lib, but it's for phones and it actually has a method for RSA256 signing which takes private key as a string of exactly my format.</li>
  </ol>
  
  <p>So my question is - is there some working solution for my case? Because I can't believe that no one else has integrations with Google.</p>