@@ -19,8 +19,9 @@ public abstract class Algorithm {
1919 *
2020 * @param key the key to use in the verify or signing instance.
2121 * @return a valid RSA256 Algorithm.
22+ * @throws IllegalArgumentException if the provided Key is null.
2223 */
23- public static Algorithm RSA256 (RSAKey key ) {
24+ public static Algorithm RSA256 (RSAKey key ) throws IllegalArgumentException {
2425 return new RSAAlgorithm ("RS256" , "SHA256withRSA" , key );
2526 }
2627
@@ -29,8 +30,9 @@ public static Algorithm RSA256(RSAKey key) {
2930 *
3031 * @param key the key to use in the verify or signing instance.
3132 * @return a valid RSA384 Algorithm.
33+ * @throws IllegalArgumentException if the provided Key is null.
3234 */
33- public static Algorithm RSA384 (RSAKey key ) {
35+ public static Algorithm RSA384 (RSAKey key ) throws IllegalArgumentException {
3436 return new RSAAlgorithm ("RS384" , "SHA384withRSA" , key );
3537 }
3638
@@ -39,8 +41,9 @@ public static Algorithm RSA384(RSAKey key) {
3941 *
4042 * @param key the key to use in the verify or signing instance.
4143 * @return a valid RSA512 Algorithm.
44+ * @throws IllegalArgumentException if the provided Key is null.
4245 */
43- public static Algorithm RSA512 (RSAKey key ) {
46+ public static Algorithm RSA512 (RSAKey key ) throws IllegalArgumentException {
4447 return new RSAAlgorithm ("RS512" , "SHA512withRSA" , key );
4548 }
4649
@@ -49,8 +52,9 @@ public static Algorithm RSA512(RSAKey key) {
4952 *
5053 * @param secret the secret to use in the verify or signing instance.
5154 * @return a valid HMAC256 Algorithm.
55+ * @throws IllegalArgumentException if the provided Secret is null.
5256 */
53- public static Algorithm HMAC256 (String secret ) {
57+ public static Algorithm HMAC256 (String secret ) throws IllegalArgumentException {
5458 return new HMACAlgorithm ("HS256" , "HmacSHA256" , secret );
5559 }
5660
@@ -59,8 +63,9 @@ public static Algorithm HMAC256(String secret) {
5963 *
6064 * @param secret the secret to use in the verify or signing instance.
6165 * @return a valid HMAC384 Algorithm.
66+ * @throws IllegalArgumentException if the provided Secret is null.
6267 */
63- public static Algorithm HMAC384 (String secret ) {
68+ public static Algorithm HMAC384 (String secret ) throws IllegalArgumentException {
6469 return new HMACAlgorithm ("HS384" , "HmacSHA384" , secret );
6570 }
6671
@@ -69,8 +74,9 @@ public static Algorithm HMAC384(String secret) {
6974 *
7075 * @param secret the secret to use in the verify or signing instance.
7176 * @return a valid HMAC512 Algorithm.
77+ * @throws IllegalArgumentException if the provided Secret is null.
7278 */
73- public static Algorithm HMAC512 (String secret ) {
79+ public static Algorithm HMAC512 (String secret ) throws IllegalArgumentException {
7480 return new HMACAlgorithm ("HS512" , "HmacSHA512" , secret );
7581 }
7682
@@ -79,8 +85,9 @@ public static Algorithm HMAC512(String secret) {
7985 *
8086 * @param key the key to use in the verify or signing instance.
8187 * @return a valid ECDSA256 Algorithm.
88+ * @throws IllegalArgumentException if the provided Key is null.
8289 */
83- public static Algorithm ECDSA256 (ECKey key ) {
90+ public static Algorithm ECDSA256 (ECKey key ) throws IllegalArgumentException {
8491 return new ECDSAAlgorithm ("ES256" , "SHA256withECDSA" , 32 , key );
8592 }
8693
@@ -89,8 +96,9 @@ public static Algorithm ECDSA256(ECKey key) {
8996 *
9097 * @param key the key to use in the verify or signing instance.
9198 * @return a valid ECDSA384 Algorithm.
99+ * @throws IllegalArgumentException if the provided Key is null.
92100 */
93- public static Algorithm ECDSA384 (ECKey key ) {
101+ public static Algorithm ECDSA384 (ECKey key ) throws IllegalArgumentException {
94102 return new ECDSAAlgorithm ("ES384" , "SHA384withECDSA" , 48 , key );
95103 }
96104
@@ -99,8 +107,9 @@ public static Algorithm ECDSA384(ECKey key) {
99107 *
100108 * @param key the key to use in the verify or signing instance.
101109 * @return a valid ECDSA512 Algorithm.
110+ * @throws IllegalArgumentException if the provided Key is null.
102111 */
103- public static Algorithm ECDSA512 (ECKey key ) {
112+ public static Algorithm ECDSA512 (ECKey key ) throws IllegalArgumentException {
104113 return new ECDSAAlgorithm ("ES512" , "SHA512withECDSA" , 66 , key );
105114 }
106115
0 commit comments