This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.6.x-fixes by this push:
new 9fea073fdb [CXF-8837] check algorithm instead of class instance type
(#1239)
9fea073fdb is described below
commit 9fea073fdb51b0fc6c2c6b99b83fcfedb60e5912
Author: Jan Bernhardt <[email protected]>
AuthorDate: Wed Apr 19 09:00:06 2023 +0200
[CXF-8837] check algorithm instead of class instance type (#1239)
---
.../java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git
a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
index cf45d0603f..a3699acee4 100644
---
a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
+++
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
@@ -114,12 +114,12 @@ public final class JwsUtils {
LOG.warning("No signature algorithm was defined");
throw new JwsException(JwsException.Error.ALGORITHM_NOT_SET);
}
- if (key instanceof ECPrivateKey) {
+ if (JsonWebKey.KEY_TYPE_ELLIPTIC.equals(key.getAlgorithm())) {
return new EcDsaJwsSignatureProvider((ECPrivateKey)key, algo);
- } else if (key instanceof RSAPrivateKey) {
+ } else if (JsonWebKey.KEY_TYPE_RSA.equals(key.getAlgorithm())) {
return new PrivateKeyJwsSignatureProvider(key, algo);
}
-
+
return null;
}
public static JwsSignatureProvider getHmacSignatureProvider(String
encodedKey, SignatureAlgorithm algo) {
@@ -178,9 +178,9 @@ public final class JwsUtils {
throw new JwsException(JwsException.Error.ALGORITHM_NOT_SET);
}
- if (key instanceof RSAPublicKey) {
+ if (JsonWebKey.KEY_TYPE_RSA.equals(key.getAlgorithm())) {
return new PublicKeyJwsSignatureVerifier(key, algo);
- } else if (key instanceof ECPublicKey) {
+ } else if (JsonWebKey.KEY_TYPE_ELLIPTIC.equals(key.getAlgorithm())) {
return new EcDsaJwsSignatureVerifier(key, algo);
}