Skip to content

Commit

Permalink
HIVE-28030: LLAP util code refactor (Denys Kuzmenko, reviewed by Ayus…
Browse files Browse the repository at this point in the history
…h Saxena)

Closes apache#5030
  • Loading branch information
deniskuzZ authored and dengzhhu653 committed Mar 7, 2024
1 parent 1ede328 commit 1372acb
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -18,7 +18,7 @@
package org.apache.hadoop.hive.llap.security;

import java.io.IOException;
import java.util.Arrays;
import java.security.MessageDigest;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
Expand Down Expand Up @@ -58,7 +58,9 @@ public SignedMessage serializeAndSign(Signable message) throws IOException {
public void checkSignature(byte[] message, byte[] signature, int keyId)
throws SecurityException {
byte[] expectedSignature = secretManager.signWithKey(message, keyId);
if (Arrays.equals(signature, expectedSignature)) return;
if (MessageDigest.isEqual(signature, expectedSignature)) {
return;
}
throw new SecurityException("Message signature does not match");
}

Expand Down

0 comments on commit 1372acb

Please sign in to comment.