Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-28030: LLAP util code refactor #5030

Merged
merged 2 commits into from Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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