assertEquals("hello", s);
}
public void testRoundTripEncryptionBlowfishWithKeyFactory() throws Exception
{
SecretKeyEncryptionStrategy ske = new SecretKeyEncryptionStrategy();
ske.setAlgorithm("Blowfish");
ske.setKeyFactory(new SecretKeyFactory()
{
public byte[] getKey()
{
return "shhhh".getBytes();
}
});
ske.initialise();
byte[] b = ske.encrypt("hello".getBytes(), null);
assertNotSame(new String(b), "hello");
String s = new String(ske.decrypt(b, null), "UTF-8");
assertEquals("hello", s);
}