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

org.bouncycastle.crypto.InvalidCipherTextException: mac check in GCM failed #1295

Open
a1ekseev opened this issue Jan 28, 2022 · 7 comments · May be fixed by #1597
Open

org.bouncycastle.crypto.InvalidCipherTextException: mac check in GCM failed #1295

a1ekseev opened this issue Jan 28, 2022 · 7 comments · May be fixed by #1597

Comments

@a1ekseev
Copy link

I'm trying to run a test on GitLab CI, but have run into a problem.

    org.bouncycastle.crypto.InvalidCipherTextException: mac check in GCM failed
    	at org.bouncycastle.crypto.modes.GCMBlockCipher.doFinal(Unknown Source)
    	at io.minio.admin.Crypto.decrypt(Crypto.java:189)
    	at io.minio.admin.MinioAdminClient.listUsers(MinioAdminClient.java:242)

So far it has not been possible to reproduce the problem locally.
Do you have any thoughts?

@balamurugana
Copy link
Member

Seems like a network issue. Refer bcgit/bc-java#1019

@pbrw
Copy link

pbrw commented Nov 23, 2023

This is possibly the same issue as in Python SDK minio/minio-py#1343

@rafiulahad
Copy link

rafiulahad commented Nov 17, 2024

I am having the same error with minio Java admin client (https://github.com/minio/minio-java/blob/master/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java). The server is running on my MacBook Pro with Apple M3 max chip on MacOS Sequoia 15.0.1. The Java version is openjdk 21.0.2 2024-01-16. The call to listUsers() in the following code returns the error org.bouncycastle.crypto.InvalidCipherTextException: mac check in GCM failed'
All other method calls are okay.
public boolean userExists(String userName) {
Map<String,UserInfo> userInfoMap;
try {
userInfoMap = minioAdminClient.listUsers();
return userInfoMap != null && userInfoMap.get(userName) != null;
} catch (NoSuchAlgorithmException | InvalidKeyException | IOException | InvalidCipherTextException e) {
throw new RuntimeException(e);
}
}

@balamurugana
Copy link
Member

I am able to reproduce the bug with current minio-java code.

@balamurugana balamurugana reopened this Nov 17, 2024
@rafiulahad
Copy link

rafiulahad commented Nov 17, 2024

Also, In my opinion, UserInfo getUserInfo(String accessKey) should not throw an exception when the user does not exist. It should return null.

@marktheunissen
Copy link

@balamurugana here's a clue, user reporting that changing the MinIO build architecture from ARM to x86 fixes the problem, in this discussion here: minio/minio#20658

balamurugana added a commit to balamurugana/minio-java that referenced this issue Nov 18, 2024
balamurugana added a commit to balamurugana/minio-java that referenced this issue Nov 18, 2024
@balamurugana
Copy link
Member

@balamurugana here's a clue, user reporting that changing the MinIO build architecture from ARM to x86 fixes the problem, in this discussion here: minio/minio#20658

@marktheunissen There is a different issue I found in my local testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants