Skip to content

Commit

Permalink
Fix variable public key algorithm name - EC and ECDSA
Browse files Browse the repository at this point in the history
Signed-off-by: Marko Strukelj <[email protected]>
  • Loading branch information
mstruk committed Jan 15, 2020
1 parent 2b24715 commit b676a31
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public TokenInfo validate(String token) {
keywrap.setKid(kid);

log.debug("Signature algorithm used: [" + pub.getAlgorithm() + "]");
AsymmetricSignatureVerifierContext ctx = "EC".equals(pub.getAlgorithm()) ?
AsymmetricSignatureVerifierContext ctx = isAlgorithmEC(pub.getAlgorithm()) ?
new ECDSASignatureVerifierContext(keywrap) :
new AsymmetricSignatureVerifierContext(keywrap);
tokenVerifier.verifierContext(ctx);
Expand All @@ -214,6 +214,10 @@ public TokenInfo validate(String token) {
return new TokenInfo(t, token);
}

private static boolean isAlgorithmEC(String algorithm) {
return "EC".equals(algorithm) || "ECDSA".equals(algorithm);
}


/**
* Use daemon thread for refresh job
Expand Down

0 comments on commit b676a31

Please sign in to comment.