github-advanced-security[bot] commented on code in PR #1645:
URL: https://github.com/apache/cxf/pull/1645#discussion_r1450734270


##########
rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/PbesHmacAesWrapKeyEncryptionAlgorithm.java:
##########
@@ -129,19 +128,23 @@
     }
     static byte[] createDerivedKey(String keyAlgoJwt, int keySize,
                                    byte[] password, byte[] saltInput, int 
pbesCount) {
-        byte[] saltValue = createSaltValue(keyAlgoJwt, saltInput);
-        final Digest digest;
-        int macSigSize = PBES_HMAC_MAP.get(keyAlgoJwt);
-        if (macSigSize == 256) {
-            digest = new SHA256Digest();
-        } else if (macSigSize == 384) {
-            digest = new SHA384Digest();
-        } else {
-            digest = new SHA512Digest();
+        try {
+            byte[] saltValue = createSaltValue(keyAlgoJwt, saltInput);
+            int macSigSize = PBES_HMAC_MAP.get(keyAlgoJwt);
+                
+            String algorithm = "PBKDF2WithHmacSHA" + macSigSize;
+            PBEKeySpec pbeSpec = new PBEKeySpec(new 
String(password).toCharArray(), saltValue, pbesCount, keySize * 8);
+            SecretKeyFactory keyFact = 
SecretKeyFactory.getInstance(algorithm); 

Review Comment:
   ## Use of a potentially broken or risky cryptographic algorithm
   
   Cryptographic algorithm [PBKDF2WithHmacSHA](1) may not be secure, consider 
using a different algorithm.
   
   [Show more 
details](https://github.com/apache/cxf/security/code-scanning/1985)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to