Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lecture8_security.pellekrogholt;
- import java.util.ArrayList;
- import junit.framework.Assert;
- import org.junit.Test;
- public class SymmetricCryptTest {
- private static final String password = "bdsp08-06";
- private static final String plaintext = "The quick brown fox jumps over the lazy dog.";
- private SymmetricCrypt crypt = new SymmetricCrypt(password);
- @Test
- /***
- * Static implementation of cryptation and encryption methods
- */
- public void TestCryptHelper() throws Exception {
- // Create Key
- byte key[] = password.getBytes();
- CryptHelper.writeFile( CryptHelper.encrypt(key, plaintext), "output.txt");
- CryptHelper.writeFile(plaintext.getBytes(), "unsecure.txt");
- String decrypted = CryptHelper.decrypt(key, CryptHelper.readFile("output.txt"));
- // Compare
- Assert.assertEquals(plaintext, decrypted);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement