2016-06-17 17:30:47 -04:00
## Release Notes
2024-06-16 19:05:45 -04:00
### 0.12.6
This patch release:
* Ensures that after successful JWS signature verification, an application-configured Base64Url `Decoder` output is
used to construct a `Jws` instance (instead of JJWT's default decoder). See
[Issue 947 ](https://github.com/jwtk/jjwt/issues/947 ).
2024-06-17 15:25:09 -04:00
* Fixes a decompression memory leak in concurrent/multi-threaded environments introduced in 0.12.0 when decompressing JWTs with a `zip` header of `GZIP` . See [Issue 949 ](https://github.com/jwtk/jjwt/issues/949 ).
2024-06-21 16:12:01 -04:00
* Upgrades BouncyCastle to 1.78 via [PR 941 ](https://github.com/jwtk/jjwt/pull/941 ).
2024-06-16 19:05:45 -04:00
2024-01-31 20:48:38 -05:00
### 0.12.5
This patch release:
* Ensures that builders' `NestedCollection` changes are applied to the collection immediately as mutation methods are called, no longer
requiring application developers to call `.and()` to 'commit' or apply a change. For example, prior to this release,
the following code did not apply changes:
```java
JwtBuilder builder = Jwts.builder();
builder.audience().add("an-audience"); // no .and() call
builder.compact(); // would not keep 'an-audience'
```
Now this code works as expected and all other `NestedCollection` instances like it apply changes immediately (e.g. when calling
`.add(value)` ).
However, standard fluent builder chains are still recommended for readability when feasible, e.g.
```java
Jwts.builder()
.audience().add("an-audience").and() // allows fluent chaining
.subject("Joe")
// etc...
.compact()
```
See [Issue 916 ](https://github.com/jwtk/jjwt/issues/916 ).
2024-01-11 16:34:34 -05:00
### 0.12.4
2024-01-27 00:23:18 -05:00
This patch release includes various changes listed below.
#### Jackson Default Parsing Behavior
This release makes two behavioral changes to JJWT's default Jackson `ObjectMapper` parsing settings:
1. In the interest of having stronger standards to reject potentially malformed/malicious/accidental JSON that could
have undesirable effects on an application, JJWT's default `ObjectMapper ` is now configured to explicitly reject/fail
parsing JSON (JWT headers and/or Claims) if/when that JSON contains duplicate JSON member names.
For example, now the following JSON, if parsed, would fail (be rejected) by default:
```json
{
"hello": "world",
"thisWillFail": 42,
"thisWillFail": "test"
}
```
Technically, the JWT RFCs _do allow_ duplicate named fields as long as the last parsed member is the one used
(see [JWS RFC 7515, Section 4 ](https://datatracker.ietf.org/doc/html/rfc7515#section-4 )), so this is allowed.
However, because JWTs often reflect security concepts, it's usually better to be defensive and reject these
unexpected scenarios by default. The RFC later supports this position/preference in
[Section 10.12 ](https://datatracker.ietf.org/doc/html/rfc7515#section-10.12 ):
Ambiguous and potentially exploitable situations
could arise if the JSON parser used does not enforce the uniqueness
of member names or returns an unpredictable value for duplicate
member names.
Finally, this is just a default, and the RFC does indeed allow duplicate member names if the last value is used,
so applications that require duplicates to be allowed can simply configure their own `ObjectMapper` and use
that with JJWT instead of assuming this (new) JJWT default. See
[Issue #877 ](https://github.com/jwtk/jjwt/issues/877 ) for more.
2. If using JJWT's support to use Jackson to parse
[Custom Claim Types ](https://github.com/jwtk/jjwt#json-jackson-custom-types ) (for example, a Claim that should be
unmarshalled into a POJO), and the JSON for that POJO contained a member that is not represented in the specified
class, Jackson would fail parsing by default. Because POJOs and JSON data models can sometimes be out of sync
due to different class versions, the default behavior has been changed to ignore these unknown JSON members instead
of failing (i.e. the `ObjectMapper` 's `DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES` is now set to `false` )
by default.
Again, if you prefer the stricter behavior of rejecting JSON with extra or unknown properties, you can configure
`true` on your own `ObjectMapper` instance and use that instance with the `Jwts.parser()` builder.
#### Additional Changes
This release also:
2024-01-11 16:34:34 -05:00
2024-01-27 00:23:18 -05:00
* Fixes a thread-safety issue when using `java.util.ServiceLoader` to dynamically lookup/instantiate pluggable
implementations of JJWT interfaces (e.g. JSON parsers, etc). See
[Issue #873 ](https://github.com/jwtk/jjwt/issues/873 ) and its documented fix in
[PR #893 ](https://github.com/jwtk/jjwt/pull/892 ).
2024-01-11 16:34:34 -05:00
* Ensures Android environments and older `org.json` library usages can parse JSON from a `JwtBuilder` -provided
`java.io.Reader` instance. [Issue 882 ](https://github.com/jwtk/jjwt/issues/882 ).
* Ensures a single string `aud` (Audience) claim is retained (without converting it to a `Set` ) when copying/applying a
source Claims instance to a destination Claims builder. [Issue 890 ](https://github.com/jwtk/jjwt/issues/890 ).
2024-01-26 00:31:36 -05:00
* Ensures P-256, P-384 and P-521 Elliptic Curve JWKs zero-pad their field element (`x`, `y` , and `d` ) byte array values
if necessary before Base64Url-encoding per [RFC 7518 ](https://datatracker.ietf.org/doc/html/rfc7518 ), Sections
[6.2.1.2 ](https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.2 ),
[6.2.1.3 ](https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.3 ), and
[6.2.2.1 ](https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.2.1 ), respectively.
[Issue 901 ](https://github.com/jwtk/jjwt/issues/901 ).
2024-01-27 22:54:40 -05:00
* Ensures that Secret JWKs for HMAC-SHA algorithms with `k` sizes larger than the algorithm minimum can
be parsed/used as expected. See [Issue #905 ](https://github.com/jwtk/jjwt/issues/905 )
2024-01-28 16:17:53 -05:00
* Ensures there is an upper bound (maximum) iterations enforced for PBES2 decryption to help mitigate potential DoS
attacks. Many thanks to Jingcheng Yang and Jianjun Chen from Sichuan University and Zhongguancun Lab for their
work on this. See [PR 911 ](https://github.com/jwtk/jjwt/pull/911 ).
2024-01-27 00:23:18 -05:00
* Fixes various typos in documentation and JavaDoc. Thanks to those contributing pull requests for these!
2024-01-11 16:34:34 -05:00
2023-10-14 20:20:25 -04:00
### 0.12.3
This patch release:
* Upgrades the `org.json` dependency to `20231013` to address that library's
[CVE-2023-5072 ](https://nvd.nist.gov/vuln/detail/CVE-2023-5072 ) vulnerability.
* (Re-)enables empty values for custom claims, which was the behavior in < = 0.11.5.
[Issue 858 ](https://github.com/jwtk/jjwt/issues/858 ).
2023-10-06 01:43:35 -04:00
### 0.12.2
This is a follow-up release to finalize the work in 0.12.1 that tried to fix a reflection scope problem
on >= JDK 17. The 0.12.1 fix worked, but only if the importing project or application did _not_ have its own
`module-info.java` file.
This release removes that reflection code entirely in favor of a JJWT-native implementation, eliminating JPMS
module (scope) problems on >= JDK 17. As such, `--add-opens` flags are no longer required to use JJWT.
The fix has been tested up through JDK 21 in a separate application environment (out of JJWT's codebase) to assert
expected functionality in a 'clean room' environment in a project both with and without `module-info.java` usage.
2023-10-04 23:08:53 -04:00
### 0.12.1
2023-10-04 22:39:39 -04:00
Enabled reflective access on JDK 17+ to `java.io.ByteArrayInputStream` and `sun.security.util.KeyUtil` for
`jjwt-impl.jar`
2023-10-03 16:27:28 -04:00
### 0.12.0
2022-06-11 18:53:17 -04:00
2023-09-16 16:56:13 -04:00
This is a big release! JJWT now fully supports Encrypted JSON Web Tokens (JWE), JSON Web Keys (JWK) and more! See the
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
sections below enumerating all new features as well as important notes on breaking changes or backwards-incompatible
changes made in preparation for the upcoming 1.0 release.
2023-08-04 15:35:33 -04:00
**Because breaking changes are being introduced, it is strongly recommended to wait until the upcoming 1.0 release
where you can address breaking changes one time only**.
Those that need immediate JWE encryption and JWK key support
however will likely want to upgrade now and deal with the smaller subset of breaking changes in the 1.0 release.
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
#### Simplified Starter Jar
Those upgrading to new modular JJWT versions from old single-jar versions will transparently obtain everything
they need in their Maven, Gradle or Android projects.
JJWT's early releases had one and only one .jar: `jjwt.jar` . Later releases moved to a modular design with 'api' and
'impl' jars including 'plugin' jars for Jackson, GSON, org.json, etc. Some users upgrading from the earlier single
jar to JJWT's later versions have been frustrated by being forced to learn how to configure the more modular .jars.
This release re-introduces the `jjwt.jar` artifact again, but this time it is simply an empty .jar with Maven
metadata that will automatically transitively download the following into a project, retaining the old single-jar
behavior:
* `jjwt-api.jar`
* `jjwt-impl.jar`
* `jjwt-jackson.jar`
Naturally, developers are still encouraged to configure the modular .jars as described in JJWT's documentation for
greater control and to enable their preferred JSON parser, but this stop-gap should help those unaware when upgrading.
#### JSON Web Encryption (JWE) Support!
This has been a long-awaited feature for JJWT, years in the making, and it is quite extensive - so many encryption
algorithms and key management algorithms are defined by the JWA specification, and new API concepts had to be
introduced for all of them, as well as extensive testing with RFC-defined test vectors. The wait is over!
All JWA-defined encryption algorithms and key management algorithms are fully implemented and supported and
available immediately. For example:
```java
AeadAlgorithm enc = Jwts.ENC.A256GCM;
2023-08-08 22:13:34 -04:00
SecretKey key = enc.key().build();
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
String compact = Jwts.builder().setSubject("Joe").encryptWith(key, enc).compact();
2023-10-03 13:40:06 -04:00
Jwe< Claims > jwe = Jwts.parser().decryptWith(key).build().parseEncryptedClaims(compact);
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
```
Many other RSA and Elliptic Curve examples are in the full README documentation.
#### JSON Web Key (JWK) Support!
Representing cryptographic keys - SecretKeys, RSA Public and Private Keys, Elliptic Curve Public and
Private keys - as fully encoded JSON objects according to the JWK specification - is now fully implemented and
supported. The new `Jwks` utility class exists to create JWK builders and parsers as desired. For example:
```java
2023-08-08 22:13:34 -04:00
SecretKey key = Jwts.SIG.HS256.key().build();
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
SecretJwk jwk = Jwks.builder().forKey(key).build();
assert key.equals(jwk.toKey());
// or if receiving a JWK string:
Jwk< ?> parsedJwk = Jwks.parser().build().parse(jwkString);
assert jwk.equals(parsedJwk);
assert key.equals(parsedJwk.toKey());
```
Many JJWT users won't need to use JWKs explicitly, but some JWA Key Management Algorithms (and lots of RFC test
vectors) utilize JWKs when transmitting JWEs. As this was required by JWE, it is now implemented in full for
JWE use as well as general-purpose JWK support.
2023-09-16 16:56:13 -04:00
#### JWK Thumbprint and JWK Thumbprint URI support
The [JWK Thumbprint ](https://www.rfc-editor.org/rfc/rfc7638.html ) and
[JWK Thumbprint URI ](https://www.rfc-editor.org/rfc/rfc9278.html ) RFC specifications are now fully supported. Please
see the README.md file's corresponding named sections for both for full documentation and usage examples.
#### JWS Unencoded Payload Option (`b64`) support
The [JSON Web Signature (JWS) Unencoded Payload Option ](https://www.rfc-editor.org/rfc/rfc7797.html ) RFC specification
is now fully supported. Please see the README.md corresponding named section for documentation and usage examples.
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
#### Better PKCS11 and Hardware Security Module (HSM) support
Previous versions of JJWT enforced that Private Keys implemented the `RSAKey` and `ECKey` interfaces to enforce key
length requirements. With this release, JJWT will still perform those checks when those data types are available,
but if not, as is common with keys from PKCS11 and HSM KeyStores, JJWT will still allow those Keys to be used,
expecting the underlying Security Provider to enforce any key requirements. This should reduce or eliminate any
custom code previously written to extend JJWT to use keys from those KeyStores or Providers.
2023-09-02 22:53:29 -04:00
Additionally, PKCS11/HSM tests using [SoftHSMv2 ](https://www.opendnssec.org/softhsm/ ) are run on every build with
every JWS MAC and Signature algorithm and every JWE Key algorithm to ensure continued stable support with
Android and Sun PKCS11 implementations and spec-compliant Hardware Security Modules that use the PKCS11 interface
(such as YubiKey, etc.)
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
#### Custom Signature Algorithms
The `io.jsonwebtoken.SignatureAlgorithm` enum has been deprecated in favor of new
`io.jsonwebtoken.security.SecureDigestAlgorithm` , `io.jsonwebtoken.security.MacAlgorithm` , and
2023-08-04 15:35:33 -04:00
`io.jsonwebtoken.security.SignatureAlgorithm` interfaces to allow custom algorithm implementations. The new nested
`Jwts.SIG` static inner class is a registry of all standard JWS algorithms as expected, exactly like the
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
old enum. This change was made because enums are a static concept by design and cannot
support custom values: those who wanted to use custom signature algorithms could not do so until now. The new
2023-08-04 15:35:33 -04:00
interfaces now allow anyone to plug in and support custom algorithms with JJWT as desired.
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
#### KeyBuilder and KeyPairBuilder
Because the `io.jsonwebtoken.security.Keys#secretKeyFor` and `io.jsonwebtoken.security.Keys#keyPairFor` methods
accepted the now-deprecated `io.jsonwebtoken.SignatureAlgorithm` enum, they have also been deprecated in favor of
2023-08-08 22:13:34 -04:00
calling new `key()` or `keyPair()` builder methods on `MacAlgorithm` and `SignatureAlgorithm` instances directly.
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
For example:
```java
2023-08-08 22:13:34 -04:00
SecretKey key = Jwts.SIG.HS256.key().build();
KeyPair pair = Jwts.SIG.RS256.keyPair().build();
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
```
The builders allow for customization of the JCA `Provider` and `SecureRandom` during Key or KeyPair generation if desired, whereas
the old enum-based static utility methods did not.
#### Preparation for 1.0
Now that the JWE and JWK specifications are implemented, only a few things remain for JJWT to be considered at
version 1.0. We have been waiting to apply the 1.0 release version number until the entire set of JWT specifications
2023-08-04 15:35:33 -04:00
are fully supported **and** we drop JDK 7 support (to allow users to use JDK 8 APIs). To that end, we have had to
deprecate some concepts, or in some cases, completely break backwards compatibility to ensure the transition to
1.0 (and JDK 8 APIs) are possible. Most backwards-incompatible changes are listed in the next section below.
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
#### Backwards Compatibility Breaking Changes, Warnings and Deprecations
* `io.jsonwebtoken.Jwt` 's `getBody()` method has been deprecated in favor of a new `getPayload()` method to
reflect correct JWT specification nomenclature/taxonomy.
2023-08-04 15:35:33 -04:00
* `io.jsonwebtoken.Jws` 's `getSignature()` method has been deprecated in favor of a new `getDigest()` method to
support expected congruent behavior with `Jwe` instances (both have digests).
2023-10-03 13:40:06 -04:00
* `io.jsonwebtoken.JwtParser` 's `parseContentJwt` , `parseClaimsJwt` , `parseContentJws` , and `parseClaimsJws` methods
have been deprecated in favor of more intuitive respective `parseUnsecuredContent` , `parseUnsecuredClaims` ,
`parseSignedContent` and `parseSignedClaims` methods.
2023-08-08 22:13:34 -04:00
* `io.jsonwebtoken.CompressionCodec` is now deprecated in favor of the new `io.jsonwebtoken.io.CompressionAlgorithm`
interface. This is to guarantee API congruence with all other JWT-identifiable algorithm IDs that can be set as a
header value.
* `io.jsonwebtoken.CompressionCodecResolver` has been deprecated in favor of the new
`JwtParserBuilder#addCompressionAlgorithms` method.
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
2023-08-04 15:35:33 -04:00
#### Breaking Changes
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
2023-08-08 22:13:34 -04:00
* **`io.jsonwebtoken.Claims` and `io.jsonwebtoken.Header` instances are now immutable** to enhance security and thread
safety. Creation and mutation are supported with newly introduced `ClaimsBuilder` and `HeaderBuilder` concepts.
Even though mutation methods have migrated, there are a couple that have been removed entirely:
* `io.jsonwebtoken.JwsHeader#setAlgorithm` has been removed - the `JwtBuilder` will always set the appropriate
`alg` header automatically based on builder state.
* `io.jsonwebtoken.Header#setCompressionAlgorithm` has been removed - the `JwtBuilder` will always set the appropriate
`zip` header automatically based on builder state.
2023-08-04 15:35:33 -04:00
* `io.jsonwebtoken.Jwts` 's `header(Map)` , `jwsHeader()` and `jwsHeader(Map)` methods have been removed in favor
2023-08-08 22:13:34 -04:00
of the new `header()` method that returns a `HeaderBuilder` to support method chaining and dynamic `Header` type
creation. The `HeaderBuilder` will dynamically create a `Header` , `JwsHeader` or `JweHeader` automatically based on
builder state.
* Similarly, `io.jsonwebtoken.Jwts` 's `claims()` static method has been changed to return a `ClaimsBuilder` instead
of a `Claims` instance.
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
* **JWTs that do not contain JSON Claims now have a payload type of `byte[]` instead of `String` ** (that is,
`Jwt<byte[]>` instead of `Jwt<String>` ). This is because JWTs, especially when used with the
`cty` (Content Type) header, are capable of handling _any_ type of payload, not just Strings. The previous JJWT
releases didn't account for this, and now the API accurately reflects the JWT RFC specification payload
capabilities. Additionally, the name of `plaintext` has been changed to `content` in method names and JavaDoc to
reflect this taxonomy. This change has impacted the following JJWT APIs:
* The `JwtBuilder` 's `setPayload(String)` method has been deprecated in favor of two new methods:
* `setContent(byte[])` , and
* `setContent(byte[], String contentType)`
These new methods allow any kind of content
within a JWT, not just Strings. The existing `setPayload(String)` method implementation has been changed to
delegate to this new `setContent(byte[])` method with the argument's UTF-8 bytes, for example
`setContent(payloadString.getBytes(StandardCharsets.UTF_8))` .
* The `JwtParser` 's `Jwt<Header, String> parsePlaintextJwt(String plaintextJwt)` and
`Jws<String> parsePlaintextJws(String plaintextJws)` methods have been changed to
2023-08-04 15:35:33 -04:00
`Jwt<Header, byte[]> parseContentJwt(String plaintextJwt)` and
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
`Jws<byte[]> parseContentJws(String plaintextJws)` respectively.
* `JwtHandler` 's `onPlaintextJwt(String)` and `onPlaintextJws(String)` methods have been changed to
`onContentJwt(byte[])` and `onContentJws(byte[])` respectively.
* `io.jsonwebtoken.JwtHandlerAdapter` has been changed to reflect the above-mentioned name and `String` -to-`byte[]`
argument changes, as well adding the `abstract` modifier. This class was never intended
to be instantiated directly, and is provided for subclassing only. The missing modifier has been added to ensure
the class is used as it had always been intended.
* `io.jsonwebtoken.SigningKeyResolver` 's `resolveSigningKey(JwsHeader, String)` method has been changed to
`resolveSigningKey(JwsHeader, byte[])` .
2023-08-04 19:42:35 -04:00
* `io.jsonwebtoken.JwtParser` is now immutable. All mutation/modification methods (setters, etc) deprecated 4 years
2023-08-17 18:21:54 -04:00
ago have been removed. All parser configuration requires using the `JwtParserBuilder` .
2023-08-04 19:42:35 -04:00
* Similarly, `io.jsonwebtoken.Jwts` 's `parser()` method deprecated 4 years ago has been changed to now return a
`JwtParserBuilder` instead of a direct `JwtParser` instance. The previous `Jwts.parserBuilder()` method has been
removed as it is now redundant.
2023-08-04 15:35:33 -04:00
2023-08-17 18:21:54 -04:00
* The `JwtParserBuilder` no longer supports `PrivateKey` s for signature verification. This was an old
legacy behavior scheduled for removal years ago, and that change is now complete. For various cryptographic/security
reasons, asymmetric public/private key signatures should always be created with `PrivateKey` s and verified with
`PublicKey` s.
2023-08-04 15:35:33 -04:00
* `io.jsonwebtoken.CompressionCodec` implementations are no longer discoverable via `java.util.ServiceLoader` due to
runtime performance problems with the JDK's `ServiceLoader` implementation per
2023-08-08 22:13:34 -04:00
https://github.com/jwtk/jjwt/issues/648. Custom implementations should be made available to the `JwtParser` via
the new `JwtParserBuilder#addCompressionAlgorithms` method.
2023-08-04 15:35:33 -04:00
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
* Prior to this release, if there was a serialization problem when serializing the JWT Header, an `IllegalStateException`
was thrown. If there was a problem when serializing the JWT claims, an `IllegalArgumentException` was
thrown. This has been changed up to ensure consistency: any serialization error with either headers or claims
will now throw a `io.jsonwebtoken.io.SerializationException` .
* Parsing of unsecured JWTs (`alg` header of `none` ) are now disabled by default as mandated by
[RFC 7518, Section 3.6 ](https://www.rfc-editor.org/rfc/rfc7518.html#section-3.6 ). If you require parsing of
2023-08-08 22:13:34 -04:00
unsecured JWTs, you must call the `JwtParserBuilder#enableUnsecured()` method, but note the security
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
implications mentioned in that method's JavaDoc before doing so.
* `io.jsonwebtoken.gson.io.GsonSerializer` now requires `Gson` instances that have a registered
`GsonSupplierSerializer` type adapter, for example:
```java
new GsonBuilder()
.registerTypeHierarchyAdapter(io.jsonwebtoken.lang.Supplier.class, GsonSupplierSerializer.INSTANCE)
.disableHtmlEscaping().create();
```
This is to ensure JWKs have `toString()` and application log safety (do not print secure material), but still
serialize to JSON correctly.
2023-08-04 15:35:33 -04:00
2024-01-09 18:24:37 -05:00
* `io.jsonwebtoken.InvalidClaimException` and its two subclasses (`IncorrectClaimException` and `MissingClaimException` )
JWE support (#279)
* JWE support. Resolves #113
Huge feature/code change - see CHANGELOG.MD for an in-depth review of changes.
Commit note log:
- Added JWE AeadAlgorithm and KeyAlgorithm and supporting interfaces/implementations, and refactored SignatureAlgorithm to be an interface instead of an enum to enable custom algorithms
- NoneSignatureAlgorithm cleanup. Added UnsupportedKeyExceptionTest.
- Added JWK support!
* Removed the previous SignatureAlgorithm implementation concepts (Provider/Signer/Validator implementations). Implementations are now interface-driven and fully pluggable.
* adding tests, working towards 100% coverage. Moved api static factory class tests to impl module to avoid mocking static calls due to bridge/reflection logic.
* adding tests, removed unused class
* implementation checkpoint (safety save)
* clean build checkpoint
* continued testing w/ more coverage. Replaced PbeKey concept with PasswordKey
* fixed erroneous optimize imports
* Added ECDH-ES key algorithms + RFC tests
* 1. Enabled targeted/limited use of BouncyCastle only when required by eliminating use of RuntimeEnvironment in favor of new Providers implementation. JJWT will no longer modify the system providers list.
2. Changed SecretKeyGenerator.generateKey() to KeyBuilderSupplier.keyBuilder() and a new SecretKeyBuilder interface. This allows users to customize the Provider and SecureRandom used during key generation if desired.
3. Added KeyLengthSupplier to allow certain algorithms the ability to determine a key bit length without forcing a key generation.
4. Ensured Pbes2 algorithms defaulted to OWASP-recommended iteration counts if not specified by the user.
* 1. EcdhKeyAlgorithm: consolidated duplicate logic to a single private helper method
2. Updated RequiredTypeConverter exception message to represent the expected type as well as the found type
* Minor javadoc update
* 1. Javadoc cleanup.
2. Ensured CompressionException extends from io.jsonwebtoken.io.IOException
3. Deleted old POC unused JwkParser interface
4. Ensured NoneSignatureAlgorithm reflected the correct exception message for `sign`
* Fixed erroneous JavaDoc, enhanced code coverage for DefaultClaims
* Added jwe compression test
* Added TestKeys concept for Groovy test authoring
* Added tests, cleaned up state assertions for code coverage
* Added tests, cleaned up state assertions for code coverage
* Removed unused code
* Merge branch 'master' into jwe-merge
* using groovy syntax to avoid conflict with legacy SignatureAlgorithm type
* JavaDoc fixes
* JavaDoc fixes, test additions to work on JDK >= 15
* JavaDoc fixes, test additions to work on JDK 7 and JDK >= 15
* Test adjustment to work on Java 7
* Test adjustment to work on Java 7
* code coverage work cont'd
* code coverage work cont'd
* JavaDoc fix
* Update impl/src/main/java/io/jsonwebtoken/impl/JwtTokenizer.java
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
* lift edits
* lift edits
* lift edits
* code coverage testing cont'd
* PayloadSupplier renamed to Message
* Added new KeyPairBuilder/KeyPairBuilderSupplier for parity with KeyBuilder/KeyBuilderSupplier. Switched all generate* calls to use the new API methods.
* - Added lots of JavaDoc
- JwtMap: Ensured Groovy GString implementations that invoke Groovy's InvokerHelper on a JwtMap implementation will print redacted values instead of the actual secret values.
* - JavaDoc additions cont'd
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc additions and syntax cleanup cont'd
- Minor work to fix compilation errors on a few Groovy test classes
* - JavaDoc cont'd
* Code coverage updates cont'd
* Propagating exception wrapper function enhancements
* 100% code coverage!
* Minor test changes to work with JDK >= 11
* Ensured all JWK secret or private values were wrapped in a RedactedSupplier instance to prevent accidental printing of secure values
* - Updated JavaDoc to reflect JWK toString safety and property access
- Updated README to reflect new GsonSerializer requirements for io.jsonwebtoken.lang.Supplier
* Documentation enhancements
* Fixed erroneous JavaDoc element
* Fixed LocatorAdapter usage now that it's abstract
* Minor JavaDoc fix
* JavaDoc is now complete (no warnings) for api module
* Ensured JWS signatures are computed first before deserializing the body if no SigningKeyResolver has been configured.
* Removed EllipticCurveSignatureAlgorithm and RsaSignatureAlgorithm concepts due to some PKCS11 and HSM security providers that cannot provide keys that implement the ECKey or RSAKey interfaces.
* Removed reliance on io.jsonwebtoken.security.KeyPair now that KeyPairBuilder implementations cannot guarantee RSAKey or ECKey types
* Ensured RsaKeyAlgorithm used PublicKey and PrivateKey parameters due to PKCS11 and HSM key stores that may not expose the RSAKey interface on their RSA key implementations
* cleaned up EC point addition/doubling logic to be more readable and match equations in literature
* Deprecated JwtParserBuilder setSigningKey* methods in favor of verifyWith for name accuracy and congruence with decryptWith
* Added PositiveIntegerConverter and PublicJwkConverter for JWE Header "p2c" and "jwk" fields
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* Ensured CompressionCodec inherited Identifiable for consistency w/ all other algorithms
* JavaDoc enhancement
* Added Jwks.parserBuilder(), JwkParserBuilder and JwkParser concepts
* Ensured ProtoJwkBuilder method names were all congruent (remaining set* methods were renamed to for*)
* Minor JavaDoc organization change
* Changed JweBuilder to have only two encryptWith* methods for consistency with JwtBuilder signWith* methods. Also prevents incorrect configuration by forgetting to call follow-up methods.
* Removed DefaultValueGetter in favor of new FieldReadable concept to leverage Field instances instead of duplicating logic.
* Adding copyright headers
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Deprecated CompressionCodecResolver in favor of Locator<CompressionCodec>
* Folded in JweBuilder concept and implementation into the existing JwtBuilder
* Cleanup to reduce duplicate logic
* Changed plaintext JWT payload type from String to byte[]
* Minor internal doc fixes
* - Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Updated changelog to reflect the following changes:
- Added UnprotectedHeader interface
- Renamed DefaultHeader to AbstractHeader
- Renamed JwtParser 'plaintext'* methods to 'payload'* methods to more accurately reflect the JWT nomenclature
* Adding RFC 7520 test cases.
* Changed JwtBuilder/JwtParser/JwtHandler/JwtHandlerAdapter `payload` concept to `content` concept
* JavaDoc error fix
* Added JwtParserBuilder#addCompressionCodecs method and supporting tests
* Updated changelog to reflect recent changes
* doc updates
* Fixed minor types in JWE related change log
* Enabled Mutator and HeaderBuilder interfaces and implementations
* Fixed erroneous JavaDoc
* Added additional .pem files for testing PEM parsing (TBD at a later date)
* Updating documentation to prepare for JWE release
* more docs
* docs cont'd
* Update README.md
Trying to prevent table wrap
* Update README.md
testing table whitespace wrap
* Update README.md
formatting testing
* Update README.md
formatting testing cont'd
* docs cont'd
* docs cont'd
* docs cont'd
* documentation checkpoint
* documentation checkpoint, still work in progress
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* added extra info about Android BouncyCastle registration
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* documentation cont'd
* Upgraded Jackson to 2.12.7 due to Jackson CVE
* trying to get sonatype lift working again
* Removed unnecessary println statement in test
* Added JDK 19
* Removing JDK 19 until we can resolve incompatible groovy version
* doc formatting test
* Update README.md
Fixed 'JWE Encryption Algorithms' table formatting
* renamed PasswordKey to just Password, removed unnecessary WrappedSecretKey class and its one usage in favor of JDK-standard SecretKeySpec
* Updated PasswordKey references to Password
* Renamed DefaultPassword to PasswordSpec while also implementing KeySpec per JDK conventions.
* documentation cont'd
* documentation cont'd
* documentation cont'd
* JWT expired exception is now shows difference as now - expired
Instead of now + skew - expired
Fixes: #660
* documentation cont'd
* Fixed erroneous error message (should be '521' not '512').
* - Removed EcKeyAlgorithm and RsaKeyAlgorithm in favor of KeyAlgorithm<PublicKey, PrivateKey> due to HSM key types unable to conform to respective ECKey or RSAKey types
- added Curve concept with DefaultCurve and ECCurve implementations for use across EC/EdEC SignatureAlgorithm and KeyAlgorithm implementations
- disabled Zulu JDK 10 - compiler was failing, and that is a short-term-supported version anyway
- added Temurin JDK 19 and Zulu JDK 19 to the build
* Removed JDK 19 builds due to error with Groovy compiler version compatibility
* removed unused test, created https://github.com/jwtk/jjwt/issues/765 to address later
* updated test case to reflect Edwards keys algorithm name differences between BouncyCastle and JDK 11/15
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
* - Reordered JwtBuilder .encryptWith method arguments to match signWith conventions
- Added key validation logic to DefaultRsaKeyAlgorithm
- Removed mutation methods on InvalidClaimException and its subclasses, IncorrectClaimException and MissingClaimException
- renamed Jwks.parserBuilder() to Jwks.parser() to reduce verbosity since we'll never likely offer a Jwts.parser() that returns a Parser instance directly.
* Documentation updates
* Documentation updates
* Documentation updates
* Adding Java-based tests for README.md code snippets (e.g. new Examples section).
* Testing README code snippet in examples
* Testing README code snippet in examples
* Testing README code snippet in examples
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Ensured README.md examples would compile/run by testing code in a JavaReadmeTest.java class
* Testing coveralls failure fix for JavaReadmeTest (unnecessary for coverage)
* Message* API refactoring cleanup
* Refactored SignatureAlgorithm(s) concept as a new DigestAlgorithm hierarchy to support non-keyed digests, as well as to reflect correct cryptographic taxonomy. Renamed SignatureAlgorithms utility class to JwsAlgorithms.
* - Added JwkThumbprint and JWK Thumbprint URI support
- Fixed various copyright headers
* Updated README with JWK examples
* - Added logic and test to ensure Parser builder does not allow both a signature verification key and SigningKeyResolver to be configured.
- Updated README code example, and added test for verification
* - Added proactive checks to ensure PublicKey instances cannot be specified on JwtBuilder to create digital signatures
- Added additional tests to ensure that Password instances cannot be used with Mac algorithm instances (HS256, HS384, HS512, etc)
* minor edit to reflect latest # of test cases
* Minor JavaDoc improvement
* Disabled parsing of unsecured compressed payloads by default, with a JwtParserBuilder#enableUnsecuredDecompression method added for override if necessary.
* Refactored JcaTemplate to avoid reflection
* minor readme clarification
* Edwards Curve keys checkpoint
* Edwards Curve keys and related functionality checkpoint. Added lots of tests.
* Edwards Curve keys and related functionality checkpoint. Reached 100% code coverage.
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 15+).
* Addressed EdwardsCurve differences (and a JDK 11 PKCS8 encoding bug) between JDK versions (1.7 through 18).
* Adding --add-opens lines to surefire/test config to avoid unnecessary build warnings
* Improved Edwards Key encoding error checks
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* added some code to test errors in CI
* Improved Field/FieldBuilder implementation to make it more robust and catch type errors. JwkBuilder/Factory refactoring is likely to follow on subsequent commits.
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* Updating CI config to use the Oracle no-fee JDK builds
* JavaDoc fixes
* JavaDoc fixes
* JavaDoc fixes
* Ensured license headers are updated with correct dates based on git history, as well as ensured this is enforced in CI
* fixed various build warnings and javadoc errors
* Maven license plugin config cleanup. Removed now-unused header_format.xml file.
* fixed javadoc error causing build failures
* Changed Algorithms + Bridge concept to allow nested inner classes for simpler authoring all stemming from an 'Algorithms' class (easier to find algorithms via code completion than knowing off the top of your head which *Algorithms classes to reference).
* Added license headers
* Moved JwsAlgorithms to an inner class of Algorithms. Will rename to `StandardSecureDigestAlgorithms` to maintain the convention used with the other Algorithms inner classes.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links.
* Extracting Algorithms inner classes up a level - cleaner/easier to maintain, document and reference as JavaDoc links. Renamed JwsAlgorithms to StandardSecureDigestAlgorithms to retain the JDK 'Standard*' convention.
* Removed Algorithms class in favor of direct `Standard*` `Registry` references in `Jwts` and `Jwks` helper classes to keep the references 'close' to where they are used the most.
* Minor README.md documentation updates.
* Copying over 6e74486 to test on the jwe branch
* Ensured CI license-check build pulls full (non-shallow) git history to perform full year checks.
* JavaDoc + impl + test checkpoint
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* JavaDoc + impl + test checkpoint. Returned to 100% code coverage
* - 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)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
* - enabled more IANA algorithms in StandardHashAlgorithms
- JavaDoc update
* - JavaDoc fixes/enhancements
- Fixed erroneous README.md method name reference
- ensured DefaultJwkContext#getName() supports Octet keys as well.
* - JavaDoc fixes/enhancements
* - JavaDoc fixes/enhancements required to pass the build on later JDKs
* Minor JavaDoc typo fix
* Finished implementing all [RFC 8037](https://www.rfc-editor.org/rfc/rfc8037) test vectors in the Appendix
* Removed accidentally-committed visibility modifier
* Added copyright header
* Enabled PublicKey derivation from Edwards curve PrivateKey
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Enabled PublicKey derivation from Edwards curve PrivateKey. Updated documentation and code example showing this.
* Doc update to reference Octet JWK RFC.
* Minor JavaDoc fix
* Fixed OctetPrivateJwk discrepancy with generic parameter ordering (compared to other PrivateJwk interfaces)
* Changed Jwts.header to Jwts.unprotectedHeader, and Jwts.headerBuilder is now Jwts.header
---------
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Co-authored-by: Brian Demers <bdemers@apache.org>
2023-05-18 18:21:17 -04:00
were previously mutable, allowing the corresponding claim name and claim value to be set on the exception after
creation. These should have always been immutable without those setters (just getters), and this was a previous
implementation oversight. This release has ensured they are immutable without the setters.
2022-06-11 18:53:17 -04:00
2022-04-28 12:11:36 -04:00
### 0.11.5
This patch release adds additional security guards against an ECDSA bug in Java SE versions 15-15.0.6, 17-17.0.2, and 18
([CVE-2022-21449](https://nvd.nist.gov/vuln/detail/CVE-2022-21449)) in addition to the guards added in the JJWT 0.11.3
release. This patch allows JJWT users using those JVM versions to upgrade to JJWT 0.11.5, even if they are unable to
upgrade their JVM to patched/fixed JVM version in a timely manner. Note: if your application does not use these JVM
versions, you are not exposed to the JVM vulnerability.
Note that the CVE is not a bug within JJWT itself - it is a bug within the above listed JVM versions, and the
JJWT 0.11.5 release adds additional precautions within JJWT in case an application team is not able to upgrade
their JVM in a timely manner.
However, even with these additional JJWT security guards, the root cause of the issue is the JVM, so it **strongly
recommended** to upgrade your JVM to version
15.0.7, 17.0.3, or 18.0.1 or later to ensure the bug does not surface elsewhere in your application code or any other
2022-06-11 18:53:17 -04:00
third party library in your application that may not contain similar security guards.
2022-04-28 12:11:36 -04:00
Issues included in this patch are listed in the [JJWT 0.11.5 milestone ](https://github.com/jwtk/jjwt/milestone/26?closed=1 ).
#### Credits
Thank you to [Neil Madden ](https://neilmadden.blog ), the security researcher that first discovered the JVM
vulnerability as covered in his [Psychic Signatures in Java ](https://neilmadden.blog/2022/04/19/psychic-signatures-in-java/ )
blog post. Neil worked directly with the JJWT team to provide these additional guards, beyond what was in the JJWT 0.11.3
release, and we're grateful for his help and collaboration in reviewing our fixes and for the additional tests he
provided the JJWT team.
2022-04-26 19:16:04 -04:00
### 0.11.4
2021-06-21 18:21:57 -04:00
This patch release:
2021-07-01 15:55:38 -04:00
* Adds additional handling for rare JSON parsing exceptions and wraps them in a `JwtException` to allow the application to handle these conditions as JWT concerns.
2022-03-28 10:25:14 -04:00
* Upgrades the `jjwt-jackson` module's Jackson dependency to `2.12.6.1` .
2022-04-26 19:16:04 -04:00
* Upgrades the `jjwt-orgjson` module's org.json:json dependency to `20220320` .
* Upgrades the `jjwt-gson` module's gson dependency to `2.9.0` .
* Upgrades the internal testing BouncyCastle version and any references in README documentation examples to `1.70` .
* Contains various documentation and typo fixes.
The patch also makes various internal project POM and build enhancements to reduce repetition and the chance for
stale references, and overall create a cleaner build with less warnings. It also ensures that CI testing builds
and executes on all latest OpenJDK versions from Java 7 to Java 18 (inclusive).
Issues included in this patch are listed in the [JJWT 0.11.4 milestone ](https://github.com/jwtk/jjwt/milestone/25?closed=1 ).
2021-06-21 18:21:57 -04:00
2022-04-23 17:32:28 -04:00
### 0.11.3
This patch release adds security guards against an ECDSA bug in Java SE versions 15-15.0.6, 17-17.0.2, and 18
2022-04-28 12:11:36 -04:00
([CVE-2022-21449](https://nvd.nist.gov/vuln/detail/CVE-2022-21449)). Note: if your application does not use these
JVM versions, you are not exposed to the JVM vulnerability.
2022-04-23 17:32:28 -04:00
2022-04-28 12:11:36 -04:00
Note that the CVE is not a bug within JJWT itself - it is a bug within the above listed JVM versions. However, even
with these additional JJWT security guards, the root cause of the issue is the JVM, so it **strongly
recommended** to upgrade your JVM to version 15.0.7, 17.0.3, or 18.0.1 or later to ensure the bug does not surface
elsewhere in your application code or any other third party library in your application that may not contain similar
security guards.
2022-04-23 17:32:28 -04:00
Issues included in this patch are listed in the [JJWT 0.11.3 milestone ](https://github.com/jwtk/jjwt/milestone/24 ).
#### Backwards Compatibility Warning
In addition to additional protections against
[r or s values of zero in ECDSA signatures ](https://neilmadden.blog/2022/04/19/psychic-signatures-in-java/ ), this
release also disables by default legacy DER-encoded signatures that might be included in an ECDSA-signed JWT.
(DER-encoded signatures are not supported by the JWT RFC specifications, so they are not frequently encountered.)
However, if you are using an application that needs to consume such legacy JWTs (either produced by a very
early version of JJWT, or a different JWT library), you may re-enable DER-encoded ECDSA signatures by setting the
`io.jsonwebtoken.impl.crypto.EllipticCurveSignatureValidator.derEncodingSupported` System property to the _exact_
`String` value `true` . For example:
```java
System.setProperty("io.jsonwebtoken.impl.crypto.EllipticCurveSignatureValidator.derEncodingSupported", "true");
```
*BUT BE CAREFUL*: **DO NOT** set this System property if your application may run on one of the vulnerable JVMs
noted above (Java SE versions 15-15.0.6, 17-17.0.2, and 18).
You may safely set this property to a `String` value of `true` on all other versions of the JVM if you need to
support these legacy JWTs, *otherwise it is best to ignore (not set) the property entirely* .
#### Credits
Thank you to [Neil Madden ](https://neilmadden.blog ), the security researcher that first discovered the JVM
vulnerability as covered in his [Psychic Signatures in Java ](https://neilmadden.blog/2022/04/19/psychic-signatures-in-java/ ) blog post.
We'd also like to thank Toshiki Sasazaki, a member of [LINE Corporation ](https://linecorp.com )'s Application Security
Team as the first person to report the concern directly to the JJWT team, as well as for working with us during testing
leading to our conclusions and subsequent 0.11.3 patch release.
2020-06-11 14:14:42 -04:00
### 0.11.2
2020-06-08 13:59:41 -04:00
2020-06-11 14:14:42 -04:00
This patch release:
* Allows empty JWS bodies to support [RFC 8555 ](https://tools.ietf.org/html/rfc8555 ) and similar initiatives. [Pull Request 540 ](https://github.com/jwtk/jjwt/pull/540 )
* Ensures OSGi environments can access JJWT implementation bundles (`jjwt-jackson`, `jjwt-gson` , etc) as fragments to `jjwt-api` bundle. [Pull Request 580 ](https://github.com/jwtk/jjwt/pull/580 )
* Rejects `allowedClockSkewSeconds` values that would cause numeric overflow. [Issue 583 ](https://github.com/jwtk/jjwt/issues/583 )
* Upgrades Jackson dependency to version `2.9.10.4` to address all known Jackson CVE vulnerabilities. [Issue 585 ](https://github.com/jwtk/jjwt/issues/585 )
* Updates `SecretKey` algorithm name validation to allow PKCS12 KeyStore OIDs in addition to JCA Names. [Issue 588 ](https://github.com/jwtk/jjwt/issues/588 )
* Enabled CI builds on JDK 14. [Pull Request 590 ](https://github.com/jwtk/jjwt/pull/590 )
* Adds missing parameters type to `Maps.add()` , which removes an unchecked type warning. [Issue 591 ](https://github.com/jwtk/jjwt/issues/591 )
* Ensures `GsonDeserializer` always uses `UTF-8` for encoding bytes to Strings. [Pull Request 592 ](https://github.com/jwtk/jjwt/pull/592 )
2020-06-08 13:59:41 -04:00
2020-06-11 14:21:03 -04:00
All issues and PRs are listed in the Github [JJWT 0.11.2 milestone ](https://github.com/jwtk/jjwt/milestone/23?closed=1 ).
2020-06-08 13:59:41 -04:00
2020-02-24 13:42:02 -05:00
### 0.11.1
This patch release:
2020-03-12 16:40:52 -04:00
* Upgrades the `jjwt-jackson` module's Jackson dependency to `2.9.10.3` .
2020-03-12 16:25:12 -04:00
* Fixes an issue when using Java 9+ `Map.of` with `JacksonDeserializer` that resulted in an `NullPointerException` .
* Fixes an issue that prevented the `jjwt-gson` .jar's seralizer/deserializer implementation from being detected automatically.
* Ensures service implementations are now loaded from the context class loader, Services.class.classLoader, and the system classloader, the first classloader with a service wins, and the others are ignored. This mimics how `Classes.forName()` works, and how JJWT attempted to auto-discover various implementations in previous versions.
* Fixes a minor error in the `Claims#getIssuedAt` JavaDoc.
2020-02-24 13:42:02 -05:00
2019-09-25 14:28:34 -04:00
### 0.11.0
2019-09-30 17:24:57 -04:00
This minor release:
2020-02-05 15:08:18 -05:00
* Adds [Google's Gson ](https://github.com/google/gson ) as a natively supported JSON parser. Installation instructions
have been updated and new [JJWT Gson usage guidelines ](https://github.com/jwtk/jjwt#json-gson ) have been added.
2019-09-25 14:28:34 -04:00
* Updates the Jackson dependency version to [2.9.10 ](https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.9#patches )
2019-09-27 17:11:19 -04:00
to address three security vulnerabilities in Jackson.
2020-02-05 15:08:18 -05:00
* A new `JwtParserBuilder` interface has been added and is the recommended way of creating an immutable and thread-safe JwtParser instance. Mutable methods in `JwtParser` will be removed before v1.0.
2019-10-01 12:03:20 -04:00
Migration to the new signatures is straightforward, for example:
Previous Version:
```java
Jwts.parser()
.requireAudience("string")
.parse(jwtString)
```
Current Version:
```java
Jwts.parserBuilder()
.requireAudience("string")
.build()
.parse(jwtString)
```
2020-02-05 15:08:18 -05:00
* Adds `io.jsonwebtoken.lang.Maps` utility class to make creation of maps fluent, as demonstrated next.
* Adds support for custom types when deserializing with Jackson. To use configure your parser:
```java
Jwts.parserBuilder().deserializeJsonWith(
new JacksonDeserializer(
Maps.of("claimName", YourType.class).build() // < --
)
).build()
```
2019-09-27 17:11:19 -04:00
* Moves JSON Serializer/Deserializer implementations to a different package name.
- `io.jsonwebtoken.io.JacksonSerializer` -> `io.jsonwebtoken.jackson.io.JacksonSerializer`
- `io.jsonwebtoken.io.JacksonDeserializer` -> `io.jsonwebtoken.jackson.io.JacksonDeserializer`
- `io.jsonwebtoken.io.OrgJsonSerializer` -> `io.jsonwebtoken.orgjson.io.OrgJsonSerializer`
- `io.jsonwebtoken.io.OrgJsonDeserializer` -> `io.jsonwebtoken.orgjson.io.OrgJsonDeserializer`
A backward compatibility modules has been created using the `deprecated` classifier (`io.jsonwebtoken:jjwt-jackson:0.11.0:deprecated` and `io.jsonwebtoken:jjwt-orjson:0.11.0:deprecated` ), if you are compiling against these classes directly, otherwise you will be unaffected.
#### Backwards Compatibility Warning
Due to this package move, if you are currently using one of the above four existing (pre 0.11.0) classes with `compile` scope, you must either:
1. change your code to use the newer package classes (recommended), or
1. change your build/dependency configuration to use the `deprecated` dependency classifier to use the existing classes, as follows:
**Maven**
```xml
< dependency >
< groupId > io.jsonwebtoken< / groupId >
< artifactId > jjwt-jackson< / artifactId >
< version > 0.11.0< / version >
< classifier > deprecated< / classifier >
< scope > compile< / scope >
< / dependency >
```
**Gradle**
```groovy
compile 'io.jsonwebtoken:jjwt-jackson:0.11.0:deprecated'
```
**Note:** that the first option is recommended since the second option will not be available starting with the 1.0 release.
2019-09-25 14:28:34 -04:00
2020-02-04 03:10:39 -05:00
### 0.10.8
This patch release:
* Ensures that SignatureAlgorithms `PS256` , `PS384` , and `PS512` work properly on JDK 11 and later without the need
for BouncyCastle. Previous releases referenced a BouncyCastle-specific
algorithm name instead of the Java Security Standard Algorithm Name of
[`RSASSA-PSS` ](https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html#signature-algorithms ).
This release ensures the standard name is used moving forward.
2020-02-04 17:29:16 -05:00
* Fixes a backwards-compatibility [bug ](https://github.com/jwtk/jjwt/issues/536 ) when parsing compressed JWTs
created from 0.10.6 or earlier using the `DEFLATE` compression algorithm.
2020-02-04 03:10:39 -05:00
2018-10-13 16:42:37 -04:00
### 0.10.7
2019-07-11 19:57:19 -04:00
This patch release:
* Adds a new [Community section ](https://github.com/jwtk/jjwt#community ) in the documentation discussing asking
questions, using Slack and Gittr, and opening new issues and pull requests.
* Fixes a [memory leak ](https://github.com/jwtk/jjwt/issues/392 ) found in the DEFLATE compression
2018-10-13 16:42:37 -04:00
codec implementation.
2019-07-11 19:57:19 -04:00
* Updates the Jackson dependency version to [2.9.9.1 ](https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.9#patches )
2019-07-11 16:05:52 -04:00
to address three security vulnerabilities in Jackson:
[CVE-2019-12086 ](https://nvd.nist.gov/vuln/detail/CVE-2019-12086 ),
[CVE-2019-12384 ](https://nvd.nist.gov/vuln/detail/CVE-2019-12384 ), and
[CVE-2019-12814 ](https://nvd.nist.gov/vuln/detail/CVE-2019-12814 ).
2019-07-11 19:57:19 -04:00
* Fixes a [bug ](https://github.com/jwtk/jjwt/issues/397 ) when Jackson is in the classpath but the `jjwt-jackson` .jar is not.
* Fixes various documentation and typo fixes.
2019-07-11 16:05:52 -04:00
2019-02-25 13:27:30 -05:00
### 0.10.6
This patch release updates the jackson-databind version to 2.9.8 to address a critical security vulnerability in that
2018-10-13 16:42:37 -04:00
library.
2019-02-25 13:27:30 -05:00
2018-08-15 10:28:28 -04:00
### 0.10.5
This patch release fixed an Android `org.json` library compatibility [issue ](https://github.com/jwtk/jjwt/issues/388 ).
2018-08-14 12:35:46 -04:00
### 0.10.4
This patch release fixed an [outstanding issue ](https://github.com/jwtk/jjwt/issues/381 ) with JCA name
case-sensitivity that impacted Android that was not caught in the 0.10.3 release.
2018-08-02 17:30:18 -04:00
### 0.10.3
This is a minor patch release that fixed a key length assertion for `SignatureAlgorithm.forSigningKey` that was
failing in Android environments. The Android dependencies and ProGuard exclusions documentation was updated as
well to reflect Android Studio 3.0 conventions.
2018-08-07 13:29:55 -04:00
### 0.10.2
This is a minor patch release that ensures the `OrgJsonSerializer` and `OrgJsonDeserializer` implementations are
compatible with Android's older `org.json` API. Previously JJWT used newer `org.json` APIs that are not
available on Android.
2018-08-02 15:31:13 -04:00
### 0.10.1
This is a minor point release that ensures the BouncyCastle dependency is optional and not pulled in as a transitive
dependency into projects.
Internal implementation code (not impacting the JJWT API) and documentation was also updated to reflect that all
Elliptic Curve algorithms are standard on the JDK and do not require Bouncy Castle.
Bouncy Castle is only needed when using PS256, PS384, and PS512 signature algorithms on < JDK 11 .
[JDK 11 and later ](https://bugs.openjdk.java.net/browse/JDK-8146293 ) supports these algorithms natively.
2018-07-07 15:28:23 -04:00
### 0.10.0
2018-07-30 19:07:17 -04:00
This is a fairly large feature enhancement release that enables the following:
* Modular project structure resulting in pluggable JJWT dependencies ([Issue 348](https://github.com/jwtk/jjwt/issues/348))
* Auto-configuration for Jackson or JSON-Java [JSON processors ](https://github.com/jwtk/jjwt#json ).
* [Automatic SignatureAlgorithm selection ](https://github.com/jwtk/jjwt#jws-create-key ) based on specified signing Key.
* Algorithm and Key [Strength Assertions ](https://github.com/jwtk/jjwt#jws-key )
* [Simplified Key generation ](https://github.com/jwtk/jjwt#jws-key-create )
* Deterministic [Base64(URL) support ](https://github.com/jwtk/jjwt#base64 ) on all JDK and Android platforms
* [Custom JSON processing ](https://github.com/jwtk/jjwt#json-custom )
* Complete [documentation ](https://github.com/jwtk/jjwt )
* and a bunch of other [minor fixes and enhancements ](https://github.com/jwtk/jjwt/milestone/11 ).
**BACKWARDS-COMPATIBILITY NOTICE:**
JJWT's new modular design utilizes distinctions between compile and runtime dependencies to ensure you only depend
on the public APIs that are safe to use in your application. All internal/private implementation classes have
been moved to a new `jjwt-impl` runtime dependency.
If you depended on any internal implementation classes in the past, you have two choices:
1. Refactor your code to use the public-only API classes and interfaces in the `jjwt-api` .jar. Any functionality
you might have used in the internal implementation should be available via newer cleaner interfaces and helper
classes in that .jar.
2. Specify the new `jjwt-impl` .jar not as a runtime dependency but as a compile dependency. This would make your
upgrade to JJWT 0.10.0 fully backwards compatible, but you do so _at your own risk_ . JJWT will make **NO**
semantic version compatibility guarantees in the `jjwt-impl` .jar moving forward. Semantic versioning will be
very carefully adhered to in all other JJWT dependencies however.
2018-07-07 15:28:23 -04:00
2018-07-05 18:22:23 -04:00
### 0.9.1
This is a minor patch release that updates the Jackson dependency to 2.9.6 to address Jackson CVE-2017-17485.
2017-10-10 15:04:34 -04:00
### 0.9.0
This is a minor release that includes changes to dependencies and plugins to allow for building jjwt with Java 9.
Javadocs in a few classes were updated as well to support proper linting in both Java 8 and Java 9.
2017-09-26 13:08:01 -04:00
### 0.8.0
This is a minor feature enhancement, dependency version update and build update release. We switched from Jacoco to
OpenClover as OpenClover delivers a higher quality of test metrics. As an interim measure, we introduced a new
repository that has an updated version of the coveralls-maven-plugin which includes support for Clover reporting to
Coveralls. Once this change has been merged and released to the official coveralls-maven-plugin on maven central,
this repository will be removed. The following dependencies were updated to the latest release version: maven
compiler, maven enforcer, maven failsafe, maven release, maven scm provider, maven bundle, maven gpg, maven source,
maven javadoc, jackson, bouncy castle, groovy, logback and powermock. Of significance, is the upgrade for jackson as
a security issue was addressed in its latest release.
An `addClaims` method is added to the `JwtBuilder` interface in this release. It adds all given name/value pairs to
the JSON Claims in the payload.
Additional tests were added to improve overall test coverage.
2016-09-12 20:20:47 -04:00
### 0.7.0
This is a minor feature enhancement and bugfix release. One of the bug fixes is particularly important if using
2016-09-12 20:23:18 -04:00
elliptic curve signatures, please see below.
2016-09-12 20:20:47 -04:00
#### Elliptic Curve Signature Length Bug Fix
Previous versions of JJWT safely calculated and verified Elliptic Curve signatures (no security risks), however, the
signatures were encoded using the JVM's default ASN.1/DER format. The JWS specification however
requires EC signatures to be in a R + S format. JJWT >= 0.7.0 now correctly represents newly computed EC signatures in
this spec-compliant format.
What does this mean for you?
Signatures created from previous JJWT versions can still be verified, so your existing tokens will still be parsed
correctly. HOWEVER, new JWTs with EC signatures created by JJWT >= 0.7.0 are now spec compliant and therefore can only
be verified by JJWT >= 0.7.0 (or any other spec compliant library).
**This means that if you generate JWTs using Elliptic Curve Signatures after upgrading to JJWT >= 0.7.0, you _must_
also upgrade any applications that parse these JWTs to upgrade to JJWT >= 0.7.0 as well.**
#### Clock Skew Support
When parsing a JWT, you might find that `exp` or `nbf` claims fail because the clock on the parsing machine is not
perfectly in sync with the clock on the machine that created the JWT. You can now account for these differences
(usually no more than a few minutes) when parsing using the new `setAllowedClockSkewSeconds` method on the parser.
For example:
```java
long seconds = 3 * 60; //3 minutes
Jwts.parser().setAllowedClockSkewSeconds(seconds).setSigningKey(key).parseClaimsJws(jwt);
```
This ensures that clock differences between machines can be ignored. Two or three minutes should be more than enough; it
would be very strange if a machine's clock was more than 5 minutes difference from most atomic clocks around the world.
#### Custom Clock Support
Timestamps created during parsing can now be obtained via a custom time source via an implementation of
the new `io.jsonwebtoken.Clock` interface. The default implementation simply returns `new Date()` to reflect the time
when parsing occurs, as most would expect. However, supplying your own clock could be useful, especially during test
cases to guarantee deterministic behavior.
#### Android RSA Private Key Support
Previous versions of JJWT required RSA private keys to implement `java.security.interfaces.RSAPrivateKey` , but Android
6 RSA private keys do not implement this interface. JJWT now asserts that RSA keys are instances of both
`java.security.interfaces.RSAKey` and `java.security.PrivateKey` which should work fine on both Android and all other
'standard' JVMs as well.
#### Library version updates
The few dependencies JWWT has (e.g. Jackson) have been updated to their latest stable versions at the time of release.
2016-09-12 20:22:41 -04:00
#### Issue List
For all completed issues, please see the [0.7.0 Milestone List ](https://github.com/jwtk/jjwt/milestone/7?closed=1 )
2016-06-17 17:30:47 -04:00
### 0.6.0
#### Enforce JWT Claims when Parsing
You can now enforce that JWT claims have expected values when parsing a compact JWT string.
For example, let's say that you require that the JWT you are parsing has a specific `sub` (subject) value,
otherwise you may not trust the token. You can do that by using one of the `require` methods on the parser builder:
```java
try {
Jwts.parser().requireSubject("jsmith").setSigningKey(key).parseClaimsJws(s);
} catch(InvalidClaimException ice) {
2023-09-13 16:22:44 -04:00
// the sub claim was missing or did not have a 'jsmith' value
2016-06-17 17:30:47 -04:00
}
```
If it is important to react to a missing vs an incorrect value, instead of catching `InvalidClaimException` , you can catch either `MissingClaimException` or `IncorrectClaimException` :
```java
try {
Jwts.parser().requireSubject("jsmith").setSigningKey(key).parseClaimsJws(s);
} catch(MissingClaimException mce) {
2023-09-13 16:22:44 -04:00
// the parsed JWT did not have the sub claim
2016-06-17 17:30:47 -04:00
} catch(IncorrectClaimException ice) {
2023-09-13 16:22:44 -04:00
// the parsed JWT had a sub claim, but its value was not equal to 'jsmith'
2016-06-17 17:30:47 -04:00
}
```
2023-09-13 16:22:44 -04:00
You can also require custom claims by using the `require(claimName, requiredValue)` method - for example:
2016-06-17 17:30:47 -04:00
```java
try {
2023-09-13 16:22:44 -04:00
Jwts.parser().require("myClaim", "myRequiredValue").setSigningKey(key).parseClaimsJws(s);
2016-06-17 17:30:47 -04:00
} catch(InvalidClaimException ice) {
2023-09-13 16:22:44 -04:00
// the 'myClaim' claim was missing or did not have a 'myRequiredValue' value
2016-06-17 17:30:47 -04:00
}
```
(or, again, you could catch either MissingClaimException or IncorrectClaimException instead)
#### Body Compression
**This feature is NOT JWT specification compliant**, *but it can be very useful when you parse your own tokens* .
If your JWT body is large and you have size restrictions (for example, if embedding a JWT in a URL and the URL must be under a certain length for legacy browsers or mail user agents), you may now compress the JWT body using a `CompressionCodec` :
```java
Jwts.builder().claim("foo", "someReallyLongDataString...")
.compressWith(CompressionCodecs.DEFLATE) // or CompressionCodecs.GZIP
.signWith(SignatureAlgorithm.HS256, key)
.compact();
```
2018-07-07 15:28:23 -04:00
This will set a new `zip` header with the name of the compression algorithm used so that parsers can see that value and decompress accordingly.
2016-06-17 17:30:47 -04:00
The default parser implementation will automatically decompress DEFLATE or GZIP compressed bodies, so you don't need to set anything on the parser - it looks like normal:
```java
Jwts.parser().setSigningKey(key).parseClaimsJws(compact);
```
##### Custom Compression Algorithms
If the DEFLATE or GZIP algorithms are not sufficient for your needs, you can specify your own Compression algorithms by implementing the `CompressionCodec` interface and setting it on the parser:
```java
Jwts.builder().claim("foo", "someReallyLongDataString...")
.compressWith(new MyCompressionCodec())
.signWith(SignatureAlgorithm.HS256, key)
.compact();
```
2018-07-07 15:28:23 -04:00
You will then need to specify a `CompressionCodecResolver` on the parser, so you can inspect the `zip` header and return your custom codec when discovered:
2016-06-17 17:30:47 -04:00
```java
Jwts.parser().setSigningKey(key)
.setCompressionCodecResolver(new MyCustomCompressionCodecResolver())
.parseClaimsJws(compact);
```
*NOTE*: Because body compression is not JWT specification compliant, you should only enable compression if both your JWT builder and parser are JJWT versions >= 0.6.0, or if you're using another library that implements the exact same functionality. This feature is best reserved for your own use cases - where you both create and later parse the tokens. It will likely cause problems if you compressed a token and expected a 3rd party (who doesn't use JJWT) to parse the token.
### 0.5.1
- Minor [bug ](https://github.com/jwtk/jjwt/issues/31 ) fix [release ](https://github.com/jwtk/jjwt/issues?q=milestone%3A0.5.1+is%3Aclosed ) that ensures correct Base64 padding in Android runtimes.
### 0.5
- Android support! Android's built-in Base64 codec will be used if JJWT detects it is running in an Android environment. Other than Base64, all other parts of JJWT were already Android-compliant. Now it is fully compliant.
- Elliptic Curve signature algorithms! `SignatureAlgorithm.ES256` , `ES384` and `ES512` are now supported.
- Super convenient key generation methods, so you don't have to worry how to do this safely:
- `MacProvider.generateKey(); //or generateKey(SignatureAlgorithm)`
- `RsaProvider.generateKeyPair(); //or generateKeyPair(sizeInBits)`
- `EllipticCurveProvider.generateKeyPair(); //or generateKeyPair(SignatureAlgorithm)`
The `generate` * methods that accept an `SignatureAlgorithm` argument know to generate a key of sufficient strength that reflects the specified algorithm strength.
Please see the full [0.5 closed issues list ](https://github.com/jwtk/jjwt/issues?q=milestone%3A0.5+is%3Aclosed ) for more information.
### 0.4
- [Issue 8 ](https://github.com/jwtk/jjwt/issues/8 ): Add ability to find signing key by inspecting the JWS values before verifying the signature.
This is a handy little feature. If you need to parse a signed JWT (a JWS) and you don't know which signing key was used to sign it, you can now use the new `SigningKeyResolver` concept.
A `SigningKeyresolver` can inspect the JWS header and body (Claims or String) _before_ the JWS signature is verified. By inspecting the data, you can find the key and return it, and the parser will use the returned key to validate the signature. For example:
```java
SigningKeyResolver resolver = new MySigningKeyResolver();
Jws< Claims > jws = Jwts.parser().setSigningKeyResolver(resolver).parseClaimsJws(compact);
```
2023-09-13 16:22:44 -04:00
The signature is still validated, and the JWT instance will still not be returned if the jwt string is invalid, as
expected. You just get to 'see' the JWT data for key discovery before the parser validates. Nice.
2016-06-17 17:30:47 -04:00
2023-09-13 16:22:44 -04:00
This of course requires that you put some sort of information in the JWS when you create it so that your
`SigningKeyResolver` implementation can look at it later and look up the key. The *standard* way to do this is to
use the JWS `kid` ('key id') header parameter, for example:
2016-06-17 17:30:47 -04:00
```java
Jwts.builder().setHeaderParam("kid", your_signing_key_id_NOT_THE_SECRET).build();
```
2023-09-13 16:22:44 -04:00
You could of course set any other header parameter or claims instead of setting `kid` if you want -
that's just the default parameter reserved for signing key identification. If you can locate the signing key based
on other information in the header or claims, you don't need to set the `kid` parameter - just make sure your
resolver implementation knows how to look up the key.
2016-06-17 17:30:47 -04:00
2023-09-13 16:22:44 -04:00
Finally, a nice `SigningKeyResolverAdapter` is provided to allow you to write quick and simple subclasses or
anonymous classes instead of having to implement the `SigningKeyResolver` interface directly. For example:
2016-06-17 17:30:47 -04:00
```java
Jws< Claims > jws = Jwts.parser().setSigningKeyResolver(new SigningKeyResolverAdapter() {
@Override
public byte[] resolveSigningKeyBytes(JwsHeader header, Claims claims) {
//inspect the header or claims, lookup and return the signing key
2023-09-13 16:22:44 -04:00
String keyId = header.getKeyId(); //or any other parameter that you need to inspect
2016-06-17 17:30:47 -04:00
return getSigningKey(keyId); //implement me
}})
.parseClaimsJws(compact);
```
### 0.3
2023-09-13 16:22:44 -04:00
- [Issue 6 ](https://github.com/jwtk/jjwt/issues/6 ): Parsing an expired Claims JWT or JWS (as determined by the `exp`
claim) will now throw an `ExpiredJwtException` .
- [Issue 7 ](https://github.com/jwtk/jjwt/issues/7 ): Parsing a premature Claims JWT or JWS (as determined by the `nbf`
claim) will now throw a `PrematureJwtException` .
2016-06-17 17:30:47 -04:00
### 0.2
#### More convenient Claims building
This release adds convenience methods to the `JwtBuilder` interface so you can set claims directly on the builder without having to create a separate Claims instance/builder, reducing the amount of code you have to write. For example, this:
```java
Claims claims = Jwts.claims().setSubject("Joe");
String compactJwt = Jwts.builder().setClaims(claims).signWith(HS256, key).compact();
```
can now be written as:
```java
String compactJwt = Jwts.builder().setSubject("Joe").signWith(HS256, key).compact();
```
A Claims instance based on the specified claims will be created and set as the JWT's payload automatically.
#### Type-safe handling for JWT and JWS with generics
The following < 0.2 code produced a JWT as expected:
```java
Jwt jwt = Jwts.parser().setSigningKey(key).parse(compact);
```
But you couldn't easily determine if the `jwt` was a `JWT` or `JWS` instance or if the body was a `Claims` instance or a plaintext `String` without resorting to a bunch of yucky `instanceof` checks. In 0.2, we introduce the `JwtHandler` when you don't know the exact format of the compact JWT string ahead of time, and parsing convenience methods when you do.
##### JwtHandler
If you do not know the format of the compact JWT string at the time you try to parse it, you can determine what type it is after parsing by providing a `JwtHandler` instance to the `JwtParser` with the new `parse(String compactJwt, JwtHandler handler)` method. For example:
```java
T returnVal = Jwts.parser().setSigningKey(key).parse(compact, new JwtHandler< T > () {
@Override
public T onPlaintextJwt(Jwt< Header , String > jwt) {
//the JWT parsed was an unsigned plaintext JWT
//inspect it, then return an instance of T (see returnVal above)
}
@Override
public T onClaimsJwt(Jwt< Header , Claims > jwt) {
//the JWT parsed was an unsigned Claims JWT
//inspect it, then return an instance of T (see returnVal above)
}
@Override
public T onPlaintextJws(Jws< String > jws) {
//the JWT parsed was a signed plaintext JWS
//inspect it, then return an instance of T (see returnVal above)
}
@Override
public T onClaimsJws(Jws< Claims > jws) {
//the JWT parsed was a signed Claims JWS
//inspect it, then return an instance of T (see returnVal above)
}
});
```
Of course, if you know you'll only have to parse a subset of the above, you can use the `JwtHandlerAdapter` and implement only the methods you need. For example:
```java
T returnVal = Jwts.parser().setSigningKey(key).parse(plaintextJwt, new JwtHandlerAdapter< Jwt < Header , T > >() {
@Override
public T onPlaintextJws(Jws< String > jws) {
//the JWT parsed was a signed plaintext JWS
//inspect it, then return an instance of T (see returnVal above)
}
@Override
public T onClaimsJws(Jws< Claims > jws) {
//the JWT parsed was a signed Claims JWS
//inspect it, then return an instance of T (see returnVal above)
}
});
```
##### Known Type convenience parse methods
If, unlike above, you are confident of the compact string format and know which type of JWT or JWS it will produce, you can just use one of the 4 new convenience parsing methods to get exactly the type of JWT or JWS you know exists. For example:
```java
//for a known plaintext jwt string:
Jwt< Header , String > jwt = Jwts.parser().parsePlaintextJwt(compact);
//for a known Claims JWT string:
Jwt< Header , Claims > jwt = Jwts.parser().parseClaimsJwt(compact);
//for a known signed plaintext JWT (aka a plaintext JWS):
Jws< String > jws = Jwts.parser().setSigningKey(key).parsePlaintextJws(compact);
//for a known signed Claims JWT (aka a Claims JWS):
Jws< Claims > jws = Jwts.parser().setSigningKey(key).parseClaimsJws(compact);
```