Search in sources :

Example 1 with StaticDESPasswordCipher

use of org.apache.openejb.cipher.StaticDESPasswordCipher in project tomee by apache.

the class PasswordCodecTest method testStaticDesCodec.

public void testStaticDesCodec() {
    final PasswordCipher cipher = new StaticDESPasswordCipher();
    final char[] tmp = cipher.encrypt(PLAIN_PWD);
    assertEquals(PLAIN_PWD, cipher.decrypt(tmp));
}
Also used : StaticDESPasswordCipher(org.apache.openejb.cipher.StaticDESPasswordCipher) PlainTextPasswordCipher(org.apache.openejb.cipher.PlainTextPasswordCipher) PasswordCipher(org.apache.openejb.cipher.PasswordCipher) StaticDESPasswordCipher(org.apache.openejb.cipher.StaticDESPasswordCipher)

Example 2 with StaticDESPasswordCipher

use of org.apache.openejb.cipher.StaticDESPasswordCipher in project tomee by apache.

the class ClientContextCipheringTest method customCipher.

@Test
public void customCipher() throws NamingException {
    final JNDIContext jndiContext = new JNDIContext();
    final Hashtable<String, Object> env = new Hashtable<>();
    env.put(Context.PROVIDER_URL, "cipher:Static3DES:" + String.valueOf(new StaticDESPasswordCipher().encrypt("ejbd://localhost:1234")));
    jndiContext.getInitialContext(env);
    Assert.assertEquals("ejbd://localhost:1234", jndiContext.getEnvironment().get(Context.PROVIDER_URL).toString());
}
Also used : StaticDESPasswordCipher(org.apache.openejb.cipher.StaticDESPasswordCipher) Hashtable(java.util.Hashtable) JNDIContext(org.apache.openejb.client.JNDIContext) Test(org.junit.Test)

Aggregations

StaticDESPasswordCipher (org.apache.openejb.cipher.StaticDESPasswordCipher)2 Hashtable (java.util.Hashtable)1 PasswordCipher (org.apache.openejb.cipher.PasswordCipher)1 PlainTextPasswordCipher (org.apache.openejb.cipher.PlainTextPasswordCipher)1 JNDIContext (org.apache.openejb.client.JNDIContext)1 Test (org.junit.Test)1