spolavarpau1 commented on code in PR #612:
URL: https://github.com/apache/ranger/pull/612#discussion_r2216247249
##########
kms/src/main/java/org/apache/hadoop/crypto/key/RangerMasterKey.java:
##########
@@ -308,6 +308,13 @@ public boolean reencryptMKWithFipsAlgo(String mkPassword) {
init();
PBEKeySpec newPbeKeySpec = getPBEParameterSpec(mkPassword,
encrCryptoAlgo);
byte[] masterKeyToDB = encryptKey(oldKeyMaterial,
newPbeKeySpec);
+ byte[] decryptedMaterialWithNewAlgo =
decryptKey(masterKeyToDB, newPbeKeySpec);
+ // This is just a sanity check but important to ensure that
returned key material after re-encryption is same as old MK key material.
+ if
(!Base64.encode(oldKeyMaterial).equals(Base64.encode(decryptedMaterialWithNewAlgo)))
{
Review Comment:
Should we also check for null for oldKeyMaterial &
decryptMaterialWithNewAlgo?
--
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]