Examples of PasswordCipher


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

Examples of org.apache.openejb.cipher.PasswordCipher

    }

    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

Examples of org.apache.openejb.cipher.PasswordCipher

                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

Examples of org.apache.openejb.cipher.PasswordCipher

                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

Examples of org.apache.openejb.resource.jdbc.PasswordCipher

            help(options);
            return;
        }

        try {
            PasswordCipher cipher = BasicDataSourceUtil.getPasswordCipher(cipherName);

            if (line.hasOption("decrypt")) {
                String pwdArg = (String) line.getArgList().get(0);
                char[] encryptdPassword = pwdArg.toCharArray();
                System.out.println(cipher.decrypt(encryptdPassword));

            } else { // if option neither encrypt/decrypt is specified, we assume
                     // it is encrypt.
                String plainPassword = (String) line.getArgList().get(0);
                System.out.println(new String(cipher.encrypt(plainPassword)));
            }

        } catch (SQLException e) {
            System.out.println("Could not load password cipher implementation class. Check your classpath.");
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.PasswordCipher

            help(options);
            return;
        }

        try {
            PasswordCipher cipher = BasicDataSourceUtil.getPasswordCipher(cipherName);

            if (line.hasOption("decrypt")) {
                String pwdArg = (String) line.getArgList().get(0);
                char[] encryptdPassword = pwdArg.toCharArray();
                System.out.println(cipher.decrypt(encryptdPassword));

            } else { // if option neither encrypt/decrypt is specified, we assume
                     // it is encrypt.
                String plainPassword = (String) line.getArgList().get(0);
                System.out.println(new String(cipher.encrypt(plainPassword)));
            }

        } catch (SQLException e) {
            System.out.println("Could not load password cipher implementation class. Check your classpath.");
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.cipher.PasswordCipher

                throw new SQLException(message, t);
            }
        }

        // Create an instance
        PasswordCipher cipher;
        try {
            cipher = pwdCipher.newInstance();
        } catch (Throwable t) {
            String message = "Cannot create password cipher instance";
            throw new SQLException(message, t);
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.cipher.PasswordCipher

                return super.dataSource;
            }

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

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

Examples of org.apache.openejb.resource.jdbc.cipher.PasswordCipher

                return super.dataSource;
            }

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

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

Examples of org.apache.openejb.resource.jdbc.cipher.PasswordCipher

            help(options);
            return;
        }

        try {
            PasswordCipher cipher = BasicDataSourceUtil.getPasswordCipher(cipherName);

            if (line.hasOption("decrypt")) {
                String pwdArg = (String) line.getArgList().get(0);
                char[] encryptdPassword = pwdArg.toCharArray();
                System.out.println(cipher.decrypt(encryptdPassword));

            } else { // if option neither encrypt/decrypt is specified, we assume
                     // it is encrypt.
                String plainPassword = (String) line.getArgList().get(0);
                System.out.println(new String(cipher.encrypt(plainPassword)));
            }

        } catch (SQLException e) {
            System.out.println("Could not load password cipher implementation class. Check your classpath.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.