Package org.apache.openejb.cipher

Examples of org.apache.openejb.cipher.PasswordCipher


        // try the FQN of the target codec
        assertNotNull(PasswordCipherFactory.getPasswordCipher(PlainTextPasswordCipher.class.getName()));
    }

    private void assertPluginClass(final String pluginName, final Class<? extends PasswordCipher> pluginClass) throws SQLException {
        final PasswordCipher plugin = PasswordCipherFactory.getPasswordCipher(pluginName);
        assertNotNull(plugin);
        assertTrue(pluginClass.isInstance(plugin));
    }
View Full Code Here


    }

    private static String decryptIfNeeded(final String replace) {
        if (replace.startsWith(CIPHER_PREFIX)) {
            final String algo = replace.substring(CIPHER_PREFIX.length(), replace.indexOf(':', CIPHER_PREFIX.length() + 1));
            PasswordCipher cipher = null;
            try {
                cipher = PasswordCipherFactory.getPasswordCipher(algo);
            } catch (final PasswordCipherException ex) {
                try {
                    cipher = PasswordCipher.class.cast(Thread.currentThread().getContextClassLoader().loadClass(algo).newInstance());
                } catch (final Exception e) {
                    throw new IllegalArgumentException(e);
                }
            }
            return cipher.decrypt(replace.substring(CIPHER_PREFIX.length() + algo.length()).toCharArray());
        }
        return replace;
    }
View Full Code Here

                return super.dataSource;
            }

            // check password codec if available
            if (null != passwordCipher) {
                final PasswordCipher cipher = PasswordCipherFactory.getPasswordCipher(passwordCipher);
                final String plainPwd = cipher.decrypt(password.toCharArray());

                // override previous password value
                super.setPassword(plainPwd);
            }
View Full Code Here

                return super.dataSource;
            }

            // check password codec if available
            if (null != passwordCipher) {
                final PasswordCipher cipher = PasswordCipherFactory.getPasswordCipher(passwordCipher);
                final String plainPwd = cipher.decrypt(password.toCharArray());

                // override previous password value
                super.setPassword(plainPwd);
            }
View Full Code Here

TOP

Related Classes of org.apache.openejb.cipher.PasswordCipher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.