Examples of PasswordAdapter


Examples of com.sun.enterprise.security.store.PasswordAdapter

        final File passwordAliases = layout.getPasswordAliasKeystore();

        //Change the password of the keystore alias file
        if (passwordAliases.exists()) {
            try {
                PasswordAdapter p = new PasswordAdapter(passwordAliases.getAbsolutePath(),
                        oldPassword.toCharArray());
                p.changePassword(newPassword.toCharArray());
            }
            catch (Exception ex) {
                throw new RepositoryException(
                        _strMgr.getString("passwordAliasPasswordNotChanged", passwordAliases), ex);
            }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

    protected final String readFromMasterPasswordFile() {
        File mpf = getMasterPasswordFile();
        if (mpf == null)
            return null;   // no master password  saved
        try {
            PasswordAdapter pw = new PasswordAdapter(mpf.getAbsolutePath(),
                    "master-password".toCharArray()); // fixed key
            return pw.getPasswordForAlias("master-password");
        }
        catch (Exception e) {
            logger.log(Level.FINER, "master password file reading error: {0}", e.getMessage());
            return null;
        }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

     * @throws RepositoryException if any error occurs in creation.
     */
    void createPasswordAliasKeystore(File pwFile, String password)
            throws RepositoryException {
        try {
            PasswordAdapter p = new PasswordAdapter(pwFile.getAbsolutePath(),
                    password.toCharArray());
            p.writeStore();
        }
        catch (Exception ex) {
            throw new RepositoryException(_strMgr.getString("passwordAliasKeystoreNotCreated", pwFile), ex);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

        throws RepositoryException
    {
        final PEFileLayout layout = getFileLayout(config);
        final File pwdFile = layout.getMasterPasswordFile();                    
        try {                   
            PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(),
                getMasterPasswordPassword(config));
            p.setPasswordForAlias(MASTER_PASSWORD_ALIAS, masterPassword.getBytes());
            chmod("600", pwdFile);
        } catch (Exception ex) {                       
            throw new RepositoryException(_strMgr.getString("masterPasswordFileNotCreated", pwdFile),
                ex);
        }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

    {              
        final PEFileLayout layout = getFileLayout(config);
        final File pwdFile = layout.getMasterPasswordFile();       
        if (pwdFile.exists()) {           
            try {                   
                PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(),
                    getMasterPasswordPassword(config));
                return p.getPasswordForAlias(MASTER_PASSWORD_ALIAS);
            } catch (Exception ex) {           
                throw new RepositoryException(_strMgr.getString("masterPasswordFileNotRead", pwdFile),
                    ex);
            }
        } else {
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

            }
        } catch (final Exception e) { //underlying code is unsafe!
            return (at);
        }
        final String          an = RelativePathResolver.getAlias(at);
        final PasswordAdapter pa = masterPasswordHelper.getMasterPasswordAdapter(); // use default password store
        final boolean     exists = pa.aliasExists(an);
        if (!exists) {
            final StringManager lsm = StringManager.getManager(RelativePathResolver.class);
            final String msg = lsm.getString("no_such_alias", an, at);
            throw new IllegalArgumentException(msg);
        }
        final String real = pa.getPasswordForAlias(an);
        return ( real );
    }   
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

    protected final String readFromMasterPasswordFile() {
        File mpf = getMasterPasswordFile();
        if (mpf == null)
            return null;   // no master password  saved
        try {
            PasswordAdapter pw = new PasswordAdapter(mpf.getAbsolutePath(),
                    "master-password".toCharArray()); // fixed key
            return pw.getPasswordForAlias("master-password");
        }
        catch (Exception e) {
            logger.log(Level.FINER, "master password file reading error: {0}", e.getMessage());
            return null;
        }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

     * @throws CommandException
     */
    protected void createMasterPasswordFile() throws CommandException {
        final File pwdFile = new File(this.getServerDirs().getAgentDir(), MASTER_PASSWORD_ALIAS);
        try {
            PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(),
                MASTER_PASSWORD_ALIAS.toCharArray());
            p.setPasswordForAlias(MASTER_PASSWORD_ALIAS, newPassword.getBytes());
            pwdFile.setReadable(true);
            pwdFile.setWritable(true);
        } catch (Exception ex) {
            throw new CommandException(strings.get("masterPasswordFileNotCreated", pwdFile),
                ex);
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

   
    private PasswordAdapter pa = null;
   
    protected final void init(final String pathToAliasStore, final char[] storePassword)
            throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException {
        pa = new PasswordAdapter(pathToAliasStore, storePassword);
    }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

     */
    public void execute(AdminCommandContext context) {
        final ActionReport report = context.getActionReport();
       
        try {
            PasswordAdapter pa = masterPasswordHelper.getMasterPasswordAdapter();
            if (pa.getPasswordForAlias(aliasName) != null) {
                report.setMessage(localStrings.getLocalString(
                    "create.password.alias.alreadyexists",
                    "Password alias with the specified name already exists. " +
                    "Please use the update-password-alias command to change it",
                    aliasName));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return;
            }

            pa.setPasswordForAlias(aliasName,aliasPassword.getBytes());

        } catch (Exception ex) {
            ex.printStackTrace();
            report.setMessage(localStrings.getLocalString(
                "create.password.alias.fail",
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.