Skip to content

Commit 9dfdb12

Browse files
committed
Fix up the md table and lang specs in md
1 parent 6937057 commit 9dfdb12

File tree

1 file changed

+21
-27
lines changed

1 file changed

+21
-27
lines changed

guides/asymmetric_cryptography_signers.md

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,22 @@ It is common to divide cryptography in three categories:
1515

1616
In the [JWA](https://tools.ietf.org/html/rfc7518#section-3) specification we have algorithms that use both symmetric and asymmetric cryptography functions. Let's see them (taken from the specification):
1717

18-
|-------|-------------------------------|--------------|
19-
| HS256 | HMAC using SHA-256 | Required |
20-
| HS384 | HMAC using SHA-384 | Optional |
21-
| HS512 | HMAC using SHA-512 | Optional |
22-
| RS256 | RSASSA-PKCS1-v1_5 using | Recommended |
23-
| | SHA-256 | |
24-
| RS384 | RSASSA-PKCS1-v1_5 using | Optional |
25-
| | SHA-384 | |
26-
| RS512 | RSASSA-PKCS1-v1_5 using | Optional |
27-
| | SHA-512 | |
28-
| ES256 | ECDSA using P-256 and SHA-256 | Recommended+ |
29-
| ES384 | ECDSA using P-384 and SHA-384 | Optional |
30-
| ES512 | ECDSA using P-521 and SHA-512 | Optional |
31-
| PS256 | RSASSA-PSS using SHA-256 and | Optional |
32-
| | MGF1 with SHA-256 | |
33-
| PS384 | RSASSA-PSS using SHA-384 and | Optional |
34-
| | MGF1 with SHA-384 | |
35-
| PS512 | RSASSA-PSS using SHA-512 and | Optional |
36-
| | MGF1 with SHA-512 | |
37-
|-------|-------------------------------|--------------|
38-
39-
(removed the none algorithm we don't support**)
18+
| "alg" Param Value | Digital Signature or MAC Algorithm | Implementation requirements |
19+
| ----------------- | ---------------------------------------------- | --------------------------- |
20+
| HS256 | HMAC using SHA-256 | Required |
21+
| HS384 | HMAC using SHA-384 | Optional |
22+
| HS512 | HMAC using SHA-512 | Optional |
23+
| RS256 | RSASSA-PKCS1-v1_5 using SHA-256 | Recommended |
24+
| RS384 | RSASSA-PKCS1-v1_5 using SHA-384 | Optional |
25+
| RS512 | RSASSA-PKCS1-v1_5 using SHA-512 | Optional |
26+
| ES256 | ECDSA using P-256 and SHA-256 | Recommended+ |
27+
| ES384 | ECDSA using P-384 and SHA-384 | Optional |
28+
| ES512 | ECDSA using P-521 and SHA-512 | Optional |
29+
| PS256 | RSASSA-PSS using SHA-256 and MGF1 with SHA-256 | Optional |
30+
| PS384 | RSASSA-PSS using SHA-384 and MGF1 with SHA-384 | Optional |
31+
| PS512 | RSASSA-PSS using SHA-512 and MGF1 with SHA-512 | Optional |
32+
33+
(removed the none algorithm we don't support\*\*)
4034

4135
Besides the HSxxx family of algorithms, all others use asymmetric cryptography.
4236

@@ -69,7 +63,7 @@ Let's see some examples on parsing asymmetric RSA keys with Joken:
6963

7064
This algorithm uses the RSASSA-PKCS1-v1_5 that uses SHA2 hash algorithms. The base for this algorithm is the RSA public key standard. So, to use this algorithm we need a pair of RSA keys. There are many ways to generate these keys in different environments and is outside the scope of this library. Here is one of these ways just for an example:
7165

72-
``` shell
66+
```shell
7367
➜ joken git:(main) openssl genrsa -out mykey.pem 4096
7468
Generating RSA private key, 4096 bit long modulus (2 primes)
7569
.............++++
@@ -82,13 +76,13 @@ To use it with Joken we can call one of the `Joken.Signer.create` variants:
8276

8377
1. With the RAW PEM contents:
8478

85-
``` elixir
79+
```elixir
8680
signer = Joken.Signer.create("RS256", %{"pem" => pem_contents})
8781
```
8882

8983
2. With the pem file in the configuration:
9084

91-
``` elixir
85+
```elixir
9286
use Mix.Config
9387

9488
config :joken,
@@ -107,7 +101,7 @@ To use it with Joken we can call one of the `Joken.Signer.create` variants:
107101

108102
3. With the key in JWK format:
109103

110-
``` elixir
104+
```elixir
111105
# example of key parameters from https://tools.ietf.org/html/rfc7517#appendix-A.1
112106
# This is for demonstration purposes. We don't allow those parameters in the map like
113107
# "alg", "kid", "kty". Although they are part of the JWK Set specification.
@@ -125,7 +119,7 @@ To use it with Joken we can call one of the `Joken.Signer.create` variants:
125119

126120
4. With the key in JWK format on the config:
127121

128-
``` elixir
122+
```elixir
129123
use Mix.Config
130124

131125
config :joken,

0 commit comments

Comments
 (0)