mirror of https://github.com/golang-jwt/jwt.git
Deployed 0bc1aae with MkDocs version 1.4.2 (9.1.4)
This commit is contained in:
parent
9539be7f1a
commit
cdb6c1717d
2
404.html
2
404.html
|
@ -311,7 +311,7 @@
|
||||||
|
|
||||||
<li class="md-nav__item">
|
<li class="md-nav__item">
|
||||||
<a href="/jwt/usage/signing_methods/" class="md-nav__link">
|
<a href="/jwt/usage/signing_methods/" class="md-nav__link">
|
||||||
Signing methods
|
Signing Methods
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 33 KiB |
|
@ -412,7 +412,7 @@
|
||||||
|
|
||||||
<li class="md-nav__item">
|
<li class="md-nav__item">
|
||||||
<a href="usage/signing_methods/" class="md-nav__link">
|
<a href="usage/signing_methods/" class="md-nav__link">
|
||||||
Signing methods
|
Signing Methods
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,22 +2,22 @@
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
<url>
|
<url>
|
||||||
<loc>https://golang-jwt.github.io/jwt/</loc>
|
<loc>https://golang-jwt.github.io/jwt/</loc>
|
||||||
<lastmod>2023-03-26</lastmod>
|
<lastmod>2023-03-30</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
<url>
|
<url>
|
||||||
<loc>https://golang-jwt.github.io/jwt/usage/create/</loc>
|
<loc>https://golang-jwt.github.io/jwt/usage/create/</loc>
|
||||||
<lastmod>2023-03-26</lastmod>
|
<lastmod>2023-03-30</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
<url>
|
<url>
|
||||||
<loc>https://golang-jwt.github.io/jwt/usage/parse/</loc>
|
<loc>https://golang-jwt.github.io/jwt/usage/parse/</loc>
|
||||||
<lastmod>2023-03-26</lastmod>
|
<lastmod>2023-03-30</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
<url>
|
<url>
|
||||||
<loc>https://golang-jwt.github.io/jwt/usage/signing_methods/</loc>
|
<loc>https://golang-jwt.github.io/jwt/usage/signing_methods/</loc>
|
||||||
<lastmod>2023-03-26</lastmod>
|
<lastmod>2023-03-30</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
</urlset>
|
</urlset>
|
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
|
@ -407,7 +407,7 @@
|
||||||
|
|
||||||
<li class="md-nav__item">
|
<li class="md-nav__item">
|
||||||
<a href="../signing_methods/" class="md-nav__link">
|
<a href="../signing_methods/" class="md-nav__link">
|
||||||
Signing methods
|
Signing Methods
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
@ -400,7 +400,7 @@
|
||||||
|
|
||||||
<li class="md-nav__item">
|
<li class="md-nav__item">
|
||||||
<a href="../signing_methods/" class="md-nav__link">
|
<a href="../signing_methods/" class="md-nav__link">
|
||||||
Signing methods
|
Signing Methods
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<title>Signing methods - golang-jwt docs</title>
|
<title>Signing Methods - golang-jwt docs</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
<meta property="og:type" content="website" >
|
<meta property="og:type" content="website" >
|
||||||
|
|
||||||
<meta property="og:title" content="Signing methods - golang-jwt docs" >
|
<meta property="og:title" content="Signing Methods - golang-jwt docs" >
|
||||||
|
|
||||||
<meta property="og:description" content="None" >
|
<meta property="og:description" content="None" >
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
|
|
||||||
<meta name="twitter:card" content="summary_large_image" >
|
<meta name="twitter:card" content="summary_large_image" >
|
||||||
|
|
||||||
<meta name="twitter:title" content="Signing methods - golang-jwt docs" >
|
<meta name="twitter:title" content="Signing Methods - golang-jwt docs" >
|
||||||
|
|
||||||
<meta name="twitter:description" content="None" >
|
<meta name="twitter:description" content="None" >
|
||||||
|
|
||||||
|
@ -92,6 +92,11 @@
|
||||||
<label class="md-overlay" for="__drawer"></label>
|
<label class="md-overlay" for="__drawer"></label>
|
||||||
<div data-md-component="skip">
|
<div data-md-component="skip">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="#signing-methods" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div data-md-component="announce">
|
<div data-md-component="announce">
|
||||||
|
|
||||||
|
@ -120,7 +125,7 @@
|
||||||
<div class="md-header__topic" data-md-component="header-topic">
|
<div class="md-header__topic" data-md-component="header-topic">
|
||||||
<span class="md-ellipsis">
|
<span class="md-ellipsis">
|
||||||
|
|
||||||
Signing methods
|
Signing Methods
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -350,11 +355,44 @@
|
||||||
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
|
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Signing Methods
|
||||||
|
<span class="md-nav__icon md-icon"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<a href="./" class="md-nav__link md-nav__link--active">
|
<a href="./" class="md-nav__link md-nav__link--active">
|
||||||
Signing methods
|
Signing Methods
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">
|
||||||
|
<span class="md-nav__icon md-icon"></span>
|
||||||
|
Table of contents
|
||||||
|
</label>
|
||||||
|
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#signing-methods-and-key-types" class="md-nav__link">
|
||||||
|
Signing Methods and Key Types
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
@ -381,9 +419,74 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h1>Signing methods</h1>
|
<h1 id="signing-methods">Signing Methods</h1>
|
||||||
|
<p>There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be <strong>symmetric</strong> vs <strong>asymmetric</strong>.</p>
|
||||||
|
<p>Symmetric signing methods, such as HMAC, use only a single secret. This is probably the simplest signing method to use since any <code>[]byte</code> can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation.</p>
|
||||||
|
<p>Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification.</p>
|
||||||
|
<h2 id="signing-methods-and-key-types">Signing Methods and Key Types</h2>
|
||||||
|
<p>Each signing method expects a different object type for its signing keys. The following table lists all supported signing methods in the core library.</p>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th><code>"alg"</code> Parameter Values</th>
|
||||||
|
<th>Signing Key Type</th>
|
||||||
|
<th>Verification Key Type</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><a href="https://pkg.go.dev/github.com/golang-jwt/jwt/v5#SigningMethodHMAC">HMAC signing method</a><sup id="fnref:hmac"><a class="footnote-ref" href="#fn:hmac">1</a></sup></td>
|
||||||
|
<td><code>HS256</code>,<code>HS384</code>,<code>HS512</code></td>
|
||||||
|
<td><code>[]byte</code></td>
|
||||||
|
<td><code>[]byte</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><a href="https://pkg.go.dev/github.com/golang-jwt/jwt/v5#SigningMethodRSA">RSA signing method</a><sup id="fnref:rsa"><a class="footnote-ref" href="#fn:rsa">2</a></sup></td>
|
||||||
|
<td><code>RS256</code>,<code>RS384</code>,<code>RS512</code></td>
|
||||||
|
<td><a href="https://pkg.go.dev/crypto/rsa#PrivateKey"><code>*rsa.PrivateKey</code></a></td>
|
||||||
|
<td><a href="https://pkg.go.dev/crypto/rsa#PublicKey"><code>*rsa.PublicKey</code></a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><a href="https://pkg.go.dev/github.com/golang-jwt/jwt/v5#SigningMethodECDSA">ECDSA signing method</a><sup id="fnref:ecdsa"><a class="footnote-ref" href="#fn:ecdsa">3</a></sup></td>
|
||||||
|
<td><code>ES256</code>,<code>ES384</code>,<code>ES512</code></td>
|
||||||
|
<td><a href="https://pkg.go.dev/crypto/ecdsa#PrivateKey"><code>*ecdsa.PrivateKey</code></a></td>
|
||||||
|
<td><a href="https://pkg.go.dev/crypto/ecdsa#PublicKey"><code>*ecdsa.PublicKey</code></a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><a href="https://pkg.go.dev/github.com/golang-jwt/jwt/v5#SigningMethodRSAPSS">RSA-PSS signing method</a><sup id="fnref:rsapss"><a class="footnote-ref" href="#fn:rsapss">4</a></sup></td>
|
||||||
|
<td><code>PS256</code>,<code>PS384</code>,<code>PS512</code></td>
|
||||||
|
<td><a href="https://pkg.go.dev/crypto/rsa#PrivateKey"><code>*rsa.PrivateKey</code></a></td>
|
||||||
|
<td><a href="https://pkg.go.dev/crypto/rsa#PublicKey"><code>*rsa.PublicKey</code></a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><a href="https://pkg.go.dev/github.com/golang-jwt/jwt/v5#SigningMethodEd25519">EdDSA signing method</a><sup id="fnref:eddsa"><a class="footnote-ref" href="#fn:eddsa">5</a></sup></td>
|
||||||
|
<td><code>Ed25519</code></td>
|
||||||
|
<td><a href="https://pkg.go.dev/crypto/ed25519#PrivateKey"><code>ed25519.PrivateKey</code></a></td>
|
||||||
|
<td><a href="https://pkg.go.dev/crypto/ed25519#PublicKey"><code>ed25519.PublicKey</code></a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="footnote">
|
||||||
|
<hr />
|
||||||
|
<ol>
|
||||||
|
<li id="fn:hmac">
|
||||||
|
<p><a href="https://datatracker.ietf.org/doc/html/rfc7518#section-3.2">Section 3.2 of RFC 7518</a> <a class="footnote-backref" href="#fnref:hmac" title="Jump back to footnote 1 in the text">↩</a></p>
|
||||||
|
</li>
|
||||||
|
<li id="fn:rsa">
|
||||||
|
<p><a href="https://datatracker.ietf.org/doc/html/rfc7518#section-3.3">Section 3.2 of RFC 7518</a> <a class="footnote-backref" href="#fnref:rsa" title="Jump back to footnote 2 in the text">↩</a></p>
|
||||||
|
</li>
|
||||||
|
<li id="fn:ecdsa">
|
||||||
|
<p><a href="https://datatracker.ietf.org/doc/html/rfc7518#section-3.4">Section 3.2 of RFC 7518</a> <a class="footnote-backref" href="#fnref:ecdsa" title="Jump back to footnote 3 in the text">↩</a></p>
|
||||||
|
</li>
|
||||||
|
<li id="fn:rsapss">
|
||||||
|
<p><a href="https://datatracker.ietf.org/doc/html/rfc7518#section-3.5">Section 3.2 of RFC 7518</a> <a class="footnote-backref" href="#fnref:rsapss" title="Jump back to footnote 4 in the text">↩</a></p>
|
||||||
|
</li>
|
||||||
|
<li id="fn:eddsa">
|
||||||
|
<p><a href="https://datatracker.ietf.org/doc/html/rfc8037#section-3.1">Section 3.1 of RFC 8037</a> <a class="footnote-backref" href="#fnref:eddsa" title="Jump back to footnote 5 in the text">↩</a></p>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue