aboutsummaryrefslogtreecommitdiffstats
path: root/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java
AgeCommit message (Collapse)AuthorFilesLines
2023-09-21Java 17 Upgradeadheli.tavares1-1/+2
Issue-ID: POLICY-4668 Change-Id: If4e79224de61d66d7514f3abbd7b8bee1c3d5681 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-05-06Fix sonars in policy-commonJim Hahn1-9/+9
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
2020-11-06Fix upcoming checkstyle issuesPamela Dragosh1-8/+8
When we upgrade to oparent, these will fail as oparent upgrades to 8.37 of puppycrawl which fixes a few bugs that should have flagged these previously. Issue-ID: POLICY-2887 Change-Id: I5618ce67d84e94321f884ed6d929c05fc33a0b3d Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-10-29Fix sonar security issue in CryptoUtilsJim Hahn1-4/+6
Sonar reports that CryptoUtils is using AES with CBC, which is known to be insecure. Switched to "AES/GCM/NoPadding". Note: values in any property files using encryption or the "enc:" prefix will have to be re-encrypted. Issue-ID: POLICY-2801 Change-Id: I41f00d4f3ee67a00b92135150120d1faa621655a Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-06Address sonar issues in commonJim Hahn1-4/+4
Addressed the following sonar issues: - missing assertion in junit test case - disable sonars about setAccessible() as it's required for jackson emulation - sleep in junit - don't use wild-cards (e.g., "*") with java.util Pattern - use re2j instead of java.util Pattern - use String methods (e.g., startsWith()) - duplicate method bodies - duplicate code in Coder classes - string concatenation in logger calls - UTF-8 encoding - return primitive instead of boxed primitive - add assertion to tests - renamed support methods from doTestXxx to verifyXxx - cognitive complexity - use AtomicRef instead of volatile - use specific Functionals (e.g., IntConsumer) - function always returns the same value - serializable vs transient Issue-ID: POLICY-2305 Change-Id: I08eb7aa495a80bdc1d26827ba17a7946c83b9828 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-10-21Add CryptoCoder interfacejhh1-7/+6
This is to allow multiple supporting implementations. Issue-ID: POLICY-1945 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I42491e5671f561fe320f034bf8ffe03848dff43f Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-10-16Removed unthrown checked exceptions from CryptoUtils.jhh1-10/+3
additional minor javadoc clean up Issue-ID: POLICY-1945 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I23927b8c4dd63ed658e8062c87b4884ea1d31825
2019-06-26Speed up CryptoUtilsTestJim Hahn1-5/+12
CryptoUtilsTest runs slowly because the SecureRandom that CryptoUtils uses to generate an "iv" takes a while to create enough randomness. However, as the "iv" is only used as a "salt", it is not necessary to use SecureRandom; the values generated by Random are sufficient. Change-Id: I1f3b03b85d28852a7969d3a83802a2691308caa5 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-12Apply simple sonar fixesJim Hahn1-11/+9
Note: A number of these were identified, by SonarLint, in the Test classes, which are not typically scanned by Sonar. Removed unnecessary imports. Removed unneeded "throws Xxx". Replaced lambda with method references. Replaced duplicate strings with constants. Replaced try-fail-catch with assert-j methods to eliminate sonar complaints about duplicate failure messages. Added missing @Override annotations. Use map.computeIfAbsent() where appropriate. Also fixed some minor checkstyle issues. Removed unneeded "volatile" declarations. Replaced some if-else constructs with "?:" construct, per sonar. Replaced Object.wait() with CountDownLatch.await(); according to sonar (and javadocs), Object.wait() can return due to "spurious wakeups". Fixed issue whereby CryptoUtilsTest wouldn't run in my Eclipse. Change-Id: Ib6b71ed65662cfd6209400dac57ed69279bf29ec Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-03-18ONAP password encryption tool sonar fixChou, Joseph1-25/+25
Update code to fix sonar scan issues Change-Id: I5ccf3d774651bd3d8df908c1e7fe83218016a007 Issue-ID: POLICY-1561 Signed-off-by: Chou, Joseph <jc2555@att.com>
2019-03-12ONAP password encryption toolChou, Joseph1-0/+259
Migrate ECOMP Policy password encryption tool to ONAP Issue-ID: POLICY-1561 Change-Id: I9020efb7698b95c36c4ebff842a318bf8beefc69 Signed-off-by: Joseph Chou <jc2555@att.com>