Search in sources :

Example 1 with PasswordBasedEncryptionStrategy

use of org.mule.runtime.core.internal.security.PasswordBasedEncryptionStrategy in project mule by mulesoft.

the class EncryptionTransformerTestCase method doSetUp.

@Override
protected void doSetUp() throws Exception {
    strat = new PasswordBasedEncryptionStrategy();
    strat.setPassword("mule");
    strat.initialise();
}
Also used : PasswordBasedEncryptionStrategy(org.mule.runtime.core.internal.security.PasswordBasedEncryptionStrategy)

Example 2 with PasswordBasedEncryptionStrategy

use of org.mule.runtime.core.internal.security.PasswordBasedEncryptionStrategy in project mule by mulesoft.

the class PbeEncryptionStrategyTestCase method testRoundTripEncryption.

@Test
public void testRoundTripEncryption() throws Exception {
    PasswordBasedEncryptionStrategy pbe = new PasswordBasedEncryptionStrategy();
    pbe.setPassword("test");
    pbe.initialise();
    byte[] b = pbe.encrypt("hello".getBytes(), null);
    assertNotSame(new String(b), "hello");
    String s = new String(pbe.decrypt(b, null), "UTF-8");
    assertEquals("hello", s);
}
Also used : PasswordBasedEncryptionStrategy(org.mule.runtime.core.internal.security.PasswordBasedEncryptionStrategy) Test(org.junit.Test)

Aggregations

PasswordBasedEncryptionStrategy (org.mule.runtime.core.internal.security.PasswordBasedEncryptionStrategy)2 Test (org.junit.Test)1