2020import io .jsonwebtoken .lang .Classes ;
2121import io .jsonwebtoken .lang .Registry ;
2222import io .jsonwebtoken .security .AeadAlgorithm ;
23- import io .jsonwebtoken .security .AeadRequest ;
24- import io .jsonwebtoken .security .AeadResult ;
25- import io .jsonwebtoken .security .DecryptAeadRequest ;
26- import io .jsonwebtoken .security .DecryptionKeyRequest ;
2723import io .jsonwebtoken .security .KeyAlgorithm ;
2824import io .jsonwebtoken .security .KeyPairBuilderSupplier ;
29- import io .jsonwebtoken .security .KeyRequest ;
3025import io .jsonwebtoken .security .MacAlgorithm ;
3126import io .jsonwebtoken .security .Password ;
32- import io .jsonwebtoken .security .Request ;
3327import io .jsonwebtoken .security .SecretKeyAlgorithm ;
3428import io .jsonwebtoken .security .SecureDigestAlgorithm ;
35- import io .jsonwebtoken .security .SecureRequest ;
3629import io .jsonwebtoken .security .SignatureAlgorithm ;
37- import io .jsonwebtoken .security .VerifyDigestRequest ;
38- import io .jsonwebtoken .security .VerifySecureDigestRequest ;
3930import io .jsonwebtoken .security .X509Builder ;
4031
4132import javax .crypto .SecretKey ;
42- import java .io .InputStream ;
43- import java .io .OutputStream ;
4433import java .security .Key ;
4534import java .security .PrivateKey ;
4635import java .security .PublicKey ;
@@ -93,18 +82,6 @@ public static final class ENC {
9382 private static final String IMPL_CLASSNAME = "io.jsonwebtoken.impl.security.StandardEncryptionAlgorithms" ;
9483 private static final Registry <String , AeadAlgorithm > REGISTRY = Classes .newInstance (IMPL_CLASSNAME );
9584
96- // @since 0.13.0
97- private static final Supplier <AeadRequest .Builder > REQUEST_BUILDER_SUPPLIER =
98- Classes .newInstance ("io.jsonwebtoken.impl.security.DefaultAeadRequest$Builder$Supplier" );
99-
100- // @since 0.13.0
101- private static final Supplier <DecryptAeadRequest .Builder > DECRYPT_REQUEST_BUILDER_SUPPLIER =
102- Classes .newInstance ("io.jsonwebtoken.impl.security.DefaultDecryptAeadRequest$Builder$Supplier" );
103-
104- // @since 0.13.0
105- private static final Supplier <AeadResult .Builder > RESULT_BUILDER_SUPPLIER =
106- Classes .newInstance ("io.jsonwebtoken.impl.security.DefaultAeadResult$Builder$Supplier" );
107-
10885 /**
10986 * Returns all standard JWA <a href="https://www.rfc-editor.org/rfc/rfc7518.html#section-5">Cryptographic
11087 * Algorithms for Content Encryption</a> defined in the
@@ -162,42 +139,6 @@ private ENC() {
162139 * algorithm requires a 256-bit (32 byte) key.
163140 */
164141 public static final AeadAlgorithm A256GCM = get ().forKey ("A256GCM" );
165-
166- /**
167- * Returns a new builder to create {@link AeadRequest}s used for AEAD encryption via
168- * {@link AeadAlgorithm#encrypt(AeadRequest, AeadResult)}
169- *
170- * @return a new builder to create {@link AeadRequest}s used for AEAD encryption via
171- * {@link AeadAlgorithm#encrypt(AeadRequest, AeadResult)}
172- * @since 0.13.0
173- */
174- public static AeadRequest .Builder request () {
175- return REQUEST_BUILDER_SUPPLIER .get ();
176- }
177-
178- /**
179- * Returns a new builder to create {@link DecryptAeadRequest}s used for AEAD decryption via
180- * {@link AeadAlgorithm#decrypt(DecryptAeadRequest, OutputStream)}
181- *
182- * @return a new builder to create {@link DecryptAeadRequest}s used for AEAD decryption via
183- * {@link AeadAlgorithm#decrypt(DecryptAeadRequest, OutputStream)}
184- * @since 0.13.0
185- */
186- public static DecryptAeadRequest .Builder decryptRequest () {
187- return DECRYPT_REQUEST_BUILDER_SUPPLIER .get ();
188- }
189-
190- /**
191- * Returns a new builder to create {@link AeadResult}s used to store AEAD encryption results when calling
192- * {@link AeadAlgorithm#encrypt(AeadRequest, AeadResult)}
193- *
194- * @return a new builder to create {@link AeadResult}s used to store AEAD encryption results when calling
195- * {@link AeadAlgorithm#encrypt(AeadRequest, AeadResult)}
196- * @since 0.13.0
197- */
198- public static AeadResult .Builder result () {
199- return RESULT_BUILDER_SUPPLIER .get ();
200- }
201142 }
202143
203144 /**
@@ -221,14 +162,6 @@ public static final class SIG {
221162 private static final String IMPL_CLASSNAME = "io.jsonwebtoken.impl.security.StandardSecureDigestAlgorithms" ;
222163 private static final Registry <String , SecureDigestAlgorithm <?, ?>> REGISTRY = Classes .newInstance (IMPL_CLASSNAME );
223164
224- // @since 0.13.0
225- private static final Supplier <SecureRequest .Builder <InputStream , ?>> REQUEST_BUILDER_SUPPLIER =
226- Classes .newInstance ("io.jsonwebtoken.impl.security.DefaultSecureRequest$Builder$Supplier" );
227-
228- // @since 0.13.0
229- private static final Supplier <VerifySecureDigestRequest .Builder <?>> VERIFY_REQUEST_BUILDER_SUPPLIER =
230- Classes .newInstance ("io.jsonwebtoken.impl.security.DefaultVerifySecureDigestRequest$Builder$Supplier" );
231-
232165 //prevent instantiation
233166 private SIG () {
234167 }
@@ -369,34 +302,6 @@ private SIG() {
369302 * classpath.</b></p>
370303 */
371304 public static final SignatureAlgorithm EdDSA = Jwts .get (REGISTRY , "EdDSA" );
372-
373- /**
374- * Returns a new builder to create {@link SecureRequest}s used to compute a mac or signature via
375- * {@link SecureDigestAlgorithm#digest(Request)}.
376- *
377- * @param <K> the type of key used by the algorithm to compute the mac or signature.
378- * @return a new builder to create {@link SecureRequest}s used to compute a mac or signature via
379- * {@link SecureDigestAlgorithm#digest(Request)}.
380- * @since 0.13.0
381- */
382- @ SuppressWarnings ("unchecked" )
383- public static <K extends Key > SecureRequest .Builder <InputStream , K > request () {
384- return (SecureRequest .Builder <InputStream , K >) REQUEST_BUILDER_SUPPLIER .get ();
385- }
386-
387- /**
388- * Returns a new builder to create {@link VerifySecureDigestRequest}s used to verify a mac or signature via
389- * {@link SecureDigestAlgorithm#verify(VerifyDigestRequest)}.
390- *
391- * @param <K> the type of key used by the algorithm to verify the mac or signature.
392- * @return a new builder to create {@link VerifySecureDigestRequest}s used to verify a mac or signature via
393- * {@link SecureDigestAlgorithm#verify(VerifyDigestRequest)}.
394- * @since 0.13.0
395- */
396- @ SuppressWarnings ("unchecked" )
397- public static <K extends Key > VerifySecureDigestRequest .Builder <K > verifyRequest () {
398- return (VerifySecureDigestRequest .Builder <K >) VERIFY_REQUEST_BUILDER_SUPPLIER .get ();
399- }
400305 }
401306
402307 /**
@@ -418,14 +323,6 @@ public static final class KEY {
418323 private static final String IMPL_CLASSNAME = "io.jsonwebtoken.impl.security.StandardKeyAlgorithms" ;
419324 private static final Registry <String , KeyAlgorithm <?, ?>> REGISTRY = Classes .newInstance (IMPL_CLASSNAME );
420325
421- // @since 0.13.0
422- private static final Supplier <KeyRequest .Builder <?>> REQUEST_BUILDER_SUPPLIER =
423- Classes .newInstance ("io.jsonwebtoken.impl.security.DefaultKeyRequest$Builder$Supplier" );
424-
425- // @since 0.13.0
426- private static final Supplier <DecryptionKeyRequest .Builder <?>> VERIFY_REQUEST_BUILDER_SUPPLIER =
427- Classes .newInstance ("io.jsonwebtoken.impl.security.DefaultDecryptionKeyRequest$Builder$Supplier" );
428-
429326 /**
430327 * Returns all standard JWA standard <a href="https://www.rfc-editor.org/rfc/rfc7518.html#section-4">Cryptographic
431328 * Algorithms for Key Management</a>..
@@ -1029,34 +926,6 @@ public static final class KEY {
1029926 */
1030927 public static final KeyAlgorithm <PublicKey , PrivateKey > ECDH_ES_A256KW = Jwts .get (REGISTRY , "ECDH-ES+A256KW" );
1031928
1032- /**
1033- * Returns a new builder to create {@link KeyRequest}s used to get a JWE encryption key via
1034- * {@link KeyAlgorithm#getEncryptionKey(KeyRequest)}.
1035- *
1036- * @param <K> the type of key used by the {@link KeyAlgorithm} to get a JWE encryption key.
1037- * @return a new builder to create {@link KeyRequest}s used to get a JWE encryption key via
1038- * {@link KeyAlgorithm#getEncryptionKey(KeyRequest)}.
1039- * @since 0.13.0
1040- */
1041- @ SuppressWarnings ("unchecked" )
1042- public static <K extends Key > KeyRequest .Builder <K > request () {
1043- return (KeyRequest .Builder <K >) REQUEST_BUILDER_SUPPLIER .get ();
1044- }
1045-
1046- /**
1047- * Returns a new builder to create {@link DecryptionKeyRequest}s used to get a JWE decryption key via
1048- * {@link KeyAlgorithm#getDecryptionKey(DecryptionKeyRequest)}.
1049- *
1050- * @param <K> the type of key used by the {@link KeyAlgorithm} to get a JWE decryption key.
1051- * @return a new builder to create {@link DecryptionKeyRequest}s used to get a JWE decryption key via
1052- * {@link KeyAlgorithm#getDecryptionKey(DecryptionKeyRequest)}.
1053- * @since 0.13.0
1054- */
1055- @ SuppressWarnings ("unchecked" )
1056- public static <K extends Key > DecryptionKeyRequest .Builder <K > decRequest () {
1057- return (DecryptionKeyRequest .Builder <K >) VERIFY_REQUEST_BUILDER_SUPPLIER .get ();
1058- }
1059-
1060929 //prevent instantiation
1061930 private KEY () {
1062931 }
0 commit comments