From 707f7bc046b363ac6262f43bdc0885ff04f35f1c Mon Sep 17 00:00:00 2001 From: Aaron Davidson Date: Sat, 26 Mar 2016 12:17:26 -0700 Subject: [PATCH] Change assert to require hmac --- src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java b/src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java index 81e113ce..3a945454 100644 --- a/src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java +++ b/src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java @@ -309,11 +309,8 @@ public class DefaultJwtParser implements JwtParser { if (!Objects.isEmpty(keyBytes)) { - Assert.isTrue(!algorithm.isRsa(), - "Key bytes cannot be specified for RSA signatures. Please specify a PublicKey or PrivateKey instance."); - - Assert.isTrue(!algorithm.isEllipticCurve(), - "Key bytes cannot be specified for ECDSA signatures. Please specify a PublicKey instance."); + Assert.isTrue(algorithm.isHmac(), + "Key bytes can only be specified for HMAC signatures. Please specify a PublicKey or PrivateKey instance."); key = new SecretKeySpec(keyBytes, algorithm.getJcaName()); }