Skip to content

Commit

Permalink
Merge pull request #2092 from xjusko/ELY-2639
Browse files Browse the repository at this point in the history
[ELY-2639] Add a test for MaskCommand.decryptMasked method
  • Loading branch information
Skyllarr committed Feb 28, 2024
2 parents 9a0a4ca + a7651af commit 5ecf106
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tool/src/test/java/org/wildfly/security/tool/MaskCommandTest.java
Expand Up @@ -189,4 +189,18 @@ public void testDuplicateOptions() {
Assert.assertTrue(output.contains("Option \"secret\" specified more than once. Only the first occurrence will be used."));
Assert.assertFalse(output.contains("Option \"iteration\" specified more than once. Only the first occurrence will be used"));
}

@Test
public void testDecryptMasked() throws Exception {
final String originalSecret = "super_secret";
final String salt = "ASDF1234";
final int iterationCount = 123;
final String preGeneratedMaskedPassword = "MASK-088WUKotOwu7VOS8xRj.Rr;ASDF1234;123";

char[] decryptedSecret = MaskCommand.decryptMasked(preGeneratedMaskedPassword);

Assert.assertNotNull("Decrypted secret should not be null", decryptedSecret);
Assert.assertEquals("Decrypted secret should match the original secret", originalSecret, new String(decryptedSecret));
}

}

0 comments on commit 5ecf106

Please sign in to comment.