Alon Bar-Lev has posted comments on this change.
Change subject: pki: cleanup: Found reliance on default encoding
......................................................................
Patch Set 1: (2 inline comments)
....................................................
File
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/crypt/EncryptionUtils.java
Line 166: try {
Line 167: EncryptUtilParams params = new
EncryptUtilParams(keyMaterial, algorithm);
Line 168: cipher = Cipher.getInstance(params.algorithm);
Line 169: cipher.init(Cipher.ENCRYPT_MODE, params.secretKey);
Line 170: encoding = cipher.doFinal(secret.getBytes("UTF-8"));
I don't like to use apache classpath for such trivial tasks.
And the second option is exactly what the class is doing when it gets string...
so why adding more characters?
Line 171: } catch (Exception e) {
Line 172: log.error("Error in encrypting the secret", e);
Line 173: }
Line 174:
Line 216: private static class EncryptUtilParams {
Line 217: private String algorithm = null;
Line 218: private SecretKeySpec secretKey = null;
Line 219:
Line 220: public EncryptUtilParams(String keyMaterial, String
algorithm) throws UnsupportedEncodingException {
Hmm... this is a reason... for not using the string :)
As far as I can see it only convert the exception to RuntimeException, I guess
someone at java understood that these exceptions are meaningless... :)
OK, we will accept this patch for syncing the code, then I will create a new
patch to convert all my "UTF-8" to Charset.forName("UTF-8").
These are old leftovers from oooooooooold legacy....
Line 221: if (algorithm == null || "".equals(algorithm)) {
Line 222: this.algorithm = "Blowfish";
Line 223: } else {
Line 224: this.algorithm = algorithm;
--
To view, visit http://gerrit.ovirt.org/13188
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I181c9b3e26c5b941fe368b3287a7486b6b8f91e1
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Alissa Bonas <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches