Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ibodrov committed Oct 4, 2024
1 parent e27e123 commit 2e3f46d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Concord

test

![](https://img.shields.io/maven-central/v/com.walmartlabs.concord/parent.svg)

- Website: https://concord.walmartlabs.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Base64;

public final class SecretUtils {

Expand Down Expand Up @@ -72,7 +73,9 @@ public static byte[] decrypt(byte[] input, byte[] password, byte[] salt, HashAlg
} catch (IOException e) {
Throwable t = e.getCause() == null ? e : e.getCause();
if (t instanceof BadPaddingException) {
throw new SecurityException("Error decrypting a secret: " + t.getMessage() + ". Invalid input data and/or a password.");
throw new SecurityException("Error decrypting a secret: " + t.getMessage() + ". Invalid input data and/or a password. " +
"Password: " + Base64.getEncoder().encodeToString(password) + ", salt: " + Base64.getEncoder().encodeToString(salt) +
"algorithm: " + hashAlgorithm.getName());
}
throw new SecurityException("Error decrypting a secret: " + e.getMessage(), t);
}
Expand All @@ -87,7 +90,9 @@ public static InputStream decrypt(InputStream input, byte[] password, byte[] sal
Cipher c = init(password, salt, Cipher.DECRYPT_MODE, hashAlgorithm);
return new CipherInputStream(input, c);
} catch (BadPaddingException e) {
throw new SecurityException("Error decrypting a secret: " + e.getMessage() + ". Invalid input data and/or a password.");
throw new SecurityException("Error decrypting a secret: " + e.getMessage() + ". Invalid input data and/or a password. " +
"Password: " + Base64.getEncoder().encodeToString(password) + ", salt: " + Base64.getEncoder().encodeToString(salt) +
"algorithm: " + hashAlgorithm.getName());
} catch (GeneralSecurityException e) {
throw new SecurityException("Error decrypting a secret: " + e.getMessage());
}
Expand Down

0 comments on commit 2e3f46d

Please sign in to comment.