You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Ensured Edwards Curve keys (X25519 and X448) worked with ECDH-ES algorithms
- Ensured JWT Header ephemeral PublicKey ('epk' field) could be any Public JWK, not just an EcPublicJwk
- Updated README.md to ensure the installation instructions for uncommenting BouncyCastle were a little less confusing (having commented out stuff be at the end of the code block so it couldn't be confused with other lines)
Once you've generated a `KeyPair`, you can use the private key (`keyPair.getPrivate()`) to create a JWS and the
@@ -1540,9 +1553,12 @@ public key (`keyPair.getPublic()`) to parse/verify a JWS.
1540
1553
>**Note**
1541
1554
>
1542
1555
>**The `PS256`, `PS384`, and `PS512` algorithms require JDK11 or a compatible JCAProvider
1543
-
> (like BouncyCastle) in the runtime classpath.**If you are using JDK10 or earlier and you want to use them, see
1544
-
> the [Installation](#Installation) section to see how to enable BouncyCastle. All other algorithms are natively
1545
-
> supported by the JDK.
1556
+
> (like BouncyCastle) in the runtime classpath.**
1557
+
>**The `EdDSA`, `Ed25519` and `Ed448` algorithms require JDK15 or a compatible JCAProvider
1558
+
> (like BouncyCastle) in the runtime classpath.**
1559
+
>If you want to use either set of algorithms, and you are on an earlier JDK that does not support them,
1560
+
> see the [Installation](#Installation) section to see how to enable BouncyCastle. All other algorithms are
1561
+
> natively supported by the JDK.
1546
1562
1547
1563
<a name="jws-create"></a>
1548
1564
### Creating a JWS
@@ -2377,7 +2393,7 @@ All `Jwk` instances support [JWK Thumbprint](https://www.rfc-editor.org/rfc/rfc7
2377
2393
`thumbprint()` and `thumbprint(HashAlgorithm)` methods:
2378
2394
2379
2395
```java
2380
-
HashAlgorithm hashAlg =getAHashAlgorithm();
2396
+
HashAlgorithm hashAlg =Jwks.HASH.SHA256; // or SHA384, SHA512, etc.
2381
2397
2382
2398
Jwk<?> jwk =Jwks.builder()./* ... */ .build();
2383
2399
@@ -2388,7 +2404,7 @@ JwkThumbprint anotherThumbprint = jwk.thumbprint(hashAlg); // thumbprint using s
2388
2404
2389
2405
The resulting `JwkThumbprint` instance provides some useful methods:
2390
2406
2391
-
* `jwkThumbprint.toByteArray()`: the thumbprint's actual digest bytes - i.e. the output from the hash algorithm
2407
+
* `jwkThumbprint.toByteArray()`: the thumbprint's actual digest bytes - i.e. the raw output from the hash algorithm
2392
2408
* `jwkThumbprint.toString()`: the digest bytes as a Base64URL-encoded string
2393
2409
* `jwkThumbprint.getHashAlgorithm()`: the specific `HashAlgorithm` used to compute the thumbprint
2394
2410
* `jwkThumbprint.toURI()`: the thumbprint's canonical URI as defined by the [JWKThumbprintURI](https://www.rfc-editor.org/rfc/rfc9278.html) specification
@@ -2405,6 +2421,7 @@ For example:
2405
2421
```java
2406
2422
String kid = jwk.thumbprint().toString(); // Thumbprint bytes as a Base64URL-encoded string
2407
2423
Key key = findKey(kid);
2424
+
assert jwk.toKey().equals(key);
2408
2425
```
2409
2426
2410
2427
However, because `Jwk` instances are immutable, you can't set the key id after the JWK is created. For example, the
@@ -2496,7 +2513,7 @@ This code would print the following string literal to the System console:
2496
2513
{kty=oct, k=<redacted>, kid=HMAC key used in https://www.rfc-editor.org/rfc/rfc7515#appendix-A.1.1 example.}
2497
2514
```
2498
2515
2499
-
This is truefor all secret or private key values in `SecretJwk` and `PrivateJwk` (e.g. `RsaPrivateJwk`,
2516
+
This is truefor all secret or private key members in `SecretJwk` and `PrivateJwk` (e.g. `RsaPrivateJwk`,
0 commit comments