Read passphrase from a file. This should only ever be
    used by our built in integration tests. At this time,
    during normal operation, only pinentry is supported for
    entry of passwords.
546841
def passphrase_file(passphrase=None):
    """"""
    cmd = []
    pass_file = None
    if not passphrase and 'CRYPTORITO_PASSPHRASE_FILE' in os.environ:
        pass_file = os.environ['CRYPTORITO_PASSPHRASE_FILE']
        if not os.path.isfile(pass_file):
            raise CryptoritoError('CRYPTORITO_PASSPHRASE_FILE is invalid')
    elif passphrase:
        tmpdir = ensure_tmpdir()
        pass_file = "%s/p_pass" % tmpdir
        p_handle = open(pass_file, 'w')
        p_handle.write(passphrase)
        p_handle.close()

    if pass_file:
        cmd = cmd + ["--batch", "--passphrase-file", pass_file]

        vsn = gpg_version()
        if vsn[0] >= 2 and vsn[1] >= 1:
            cmd = cmd + ["--pinentry-mode", "loopback"]

    return cmd
360794
public String promptForPassword(String arg) {

		char[] pass1 = console.readPassword(CommandUtils.getMessage("password.enterText", arg) + " ");		
		char[] pass2 = console.readPassword(CommandUtils.getMessage("password.reenterText", arg) + " ");
		
		if (pass1 == null && pass2 == null) {
            throw new IllegalArgumentException("Unable to read either entry. Aborting prompt.");
        }
		if (pass1 == null || pass2 == null) {
            stdout.println(CommandUtils.getMessage("password.readError"));
            return promptForPassword(arg);
        }
				
		String password1 =  String.valueOf(pass1);
		String password2 =  String.valueOf(pass2);
		
       if (password1.equals(password2)) {
            return password1;
        } else {
            stdout.println(CommandUtils.getMessage("password.entriesDidNotMatch"));
            return promptForPassword(arg);
        }		
	}
1133630
def password(self, password):
        
        from boiler.user.util.passlib import passlib_context
        password = str(password)
        encrypted = passlib_context.encrypt(password)
        self._password = encrypted
962361
def get_password_from_keyring(entry=None, username=None):
    

    if username is None:
        username = get_username()

    has_keychain = initialize_keychain()

    # Unlock the user's keychain otherwise, if running under SSH, 'security(1)' will thrown an error.
    unlock_keychain(username)

    if has_keychain and entry is not None:
        try:
            return keyring.get_password(entry, username)
        except Exception as e:
            log.warn("Unable to get password from keyring. Continuing..")
            log.debug(e)

    return None
1102897
def create_passphrase(bits_of_entropy=None, num_words=None,
                      language='english', word_source='wiktionary'):
    
    wordlist = get_wordlist(language, word_source)

    if not num_words:
        if not bits_of_entropy:
            bits_of_entropy = 80
        num_words = get_num_words_with_entropy(bits_of_entropy, wordlist)

    return ' '.join(pick_random_words_from_wordlist(wordlist, num_words))
49346
def hash_password(password):
    
    if use_double_hash():
        password = get_hmac(password).decode('ascii')

    return _pwd_context.hash(
        password,
        **config_value('PASSWORD_HASH_OPTIONS', default={}).get(
            _security.password_hash, {})
    )
1318674
private void parseKeystorePassword() throws Exception {
        lookahead = st.nextToken();
        if (lookahead == '\"') {
            if (keystorePasswordURL == null) {
                keystorePasswordURL = st.sval;
            }
        } else {
            throw new Exception("ER033: [\"keystore_password\"] expected.");
        }
        lookahead = st.nextToken();
        if (lookahead == ';') {
            return;
        } else {
            throw new Exception("ER034: [;] expected at the end of keystorePasswordURL entry.");
        }
    }
637447
public static void convertFile(File keyFile, String passphrase,
			String comment, int toFormat, File toFile) throws IOException,
			InvalidPassphraseException {

		SshPrivateKeyFile pub = parse(new FileInputStream(keyFile));

		createFile(pub.toKeyPair(passphrase), passphrase, comment, toFormat,
				toFile);
	}
44749
private void readKeyStore(Configuration conf) throws IOException, FormatNotUnderstoodException {
	if ((this.hocr.getCryptKeystoreFile()!=null) && (!"".equals(this.hocr.getCryptKeystoreFile()))) {
		LOG.info("Using keystore to obtain credentials instead of passwords");
		HadoopKeyStoreManager hksm = new HadoopKeyStoreManager(conf);
		try {
			hksm.openKeyStore(new Path(this.hocr.getCryptKeystoreFile()), this.hocr.getCryptKeystoreType(), this.hocr.getCryptKeystorePassword());
			String pw="";
			if ((this.hocr.getCryptKeystoreAlias()!=null) && (!"".equals(this.hocr.getCryptKeystoreAlias()))) {
				pw=hksm.getPassword(this.hocr.getCryptKeystoreAlias(), this.hocr.getCryptKeystorePassword());
			} else {
				pw=hksm.getPassword(this.hocr.getFileName(), this.hocr.getCryptKeystorePassword());
			}
			this.hocr.setPassword(pw);
		} catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IllegalArgumentException | UnrecoverableEntryException | InvalidKeySpecException e) {
			LOG.error("Cannopt read keystore. Exception: ",e);
			throw new FormatNotUnderstoodException("Cannot read keystore to obtain credentials to access encrypted documents "+e);
		}
		
	}
}
832884
private function _readPassword()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if (!$this->_readDataOnly) {
			// offset: 0; size: 2; 16-bit hash value of password
			$password = strtoupper(dechex(self::_GetInt2d($recordData, 0))); // the hashed password
			$this->_phpSheet->getProtection()->setPassword($password, true);
		}
	}
791593
private void readKeyStore() throws IOException, OfficeWriterException {
		if ((this.howc.getCryptKeystoreFile()!=null) && (!"".equals(this.howc.getCryptKeystoreFile()))) {
			LOG.info("Using keystore to obtain credentials instead of passwords");
			FlinkKeyStoreManager fksm = new FlinkKeyStoreManager();
			try {
				fksm.openKeyStore(new Path(this.howc.getCryptKeystoreFile()), this.howc.getCryptKeystoreType(), this.howc.getCryptKeystorePassword());
				String password="";
				if ((this.howc.getCryptKeystoreAlias()!=null) && (!"".equals(this.howc.getCryptKeystoreAlias()))) {
					password=fksm.getPassword(this.howc.getCryptKeystoreAlias(), this.howc.getCryptKeystorePassword());
				} else {
					password=fksm.getPassword(this.howc.getFileName(), this.howc.getCryptKeystorePassword());
				}
				this.howc.setPassword(password);
			} catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IllegalArgumentException | UnrecoverableEntryException | InvalidKeySpecException e) {
				LOG.error("Cannopt read keystore. Exception: ",e);
				throw new OfficeWriterException("Cannot read keystore to obtain credentials used to encrypt office documents "+e);
			}
			
		}
	}
1082807
public boolean isPassphraseProtected() {
		ByteArrayReader bar = new ByteArrayReader(keyblob);

		try {
			String type = bar.readString();

			if (type.equals("none")) {
				return false;
			}

			if (type.equalsIgnoreCase("3des-cbc")) {
				return true;
			}
		} catch (IOException ioe) {
		} finally {
			try {
				bar.close();
			} catch (IOException e) {
			}
		}

		return false;
	}
264362
func getPassphrase(ctx *cli.Context) string {
	// Look for the --passwordfile flag.
	passphraseFile := ctx.String(passphraseFlag.Name)
	if passphraseFile != "" {
		content, err := ioutil.ReadFile(passphraseFile)
		if err != nil {
			utils.Fatalf("Failed to read passphrase file '%s': %v",
				passphraseFile, err)
		}
		return strings.TrimRight(string(content), "\r\n")
	}

	// Otherwise prompt the user for the passphrase.
	return promptPassphrase(false)
}
328050
def __password(self):
        """"""
        passwd = copy(self._inp_password.value)
        self._inp_password.value = ''
        return passwd
240264
private static void processPasswdFile( BufferedReader reader )
        throws IOException
    {
        String entry = reader.readLine();
        while( null != entry )
        {
            // Skip entries other than the one for this username
            if( entry.startsWith( USERNAME ) )
            {
                // Get the shell part of the passwd entry
                int index = entry.lastIndexOf( ':' );

                if( index == -1 )
                {
                    String message = "passwd database contains malformed user entry for " + USERNAME;
                    throw new EnvironmentException( message );
                }

                m_SHELL = entry.substring( index + 1 );
                break;
            }
            entry = reader.readLine();
        }
    }
467799
public void decodePasswords() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "decodePasswords");
        Enumeration<?> e = propertyNames();

        while (e.hasMoreElements()) {
            String name = (String) e.nextElement();
            if (name.toLowerCase().indexOf("password") != -1) {
                setProperty(name, WSKeyStore.decodePassword(getProperty(name)));
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "decodePasswords");
    }
618535
public void enpass(final String password, final OutputStream os) throws IOException {
		final ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		byte[] bytes = password.getBytes();
		if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization
			dos.write(bytes);
		} else {
			
			Random r = new SecureRandom();
			int start = 0;
			byte b;
			for(int i=0;i<3;++i) {
				dos.writeByte(b=(byte)r.nextInt());
				start+=Math.abs(b);
			}
			start%=0x7;
			for(int i=0;i<start;++i) {
				dos.writeByte(r.nextInt());
			}
			dos.writeInt((int)System.currentTimeMillis());
			int minlength = Math.min(0x9,bytes.length);
			dos.writeByte(minlength); // expect truncation
			if(bytes.length<0x9) {
				for(int i=0;i<bytes.length;++i) {
					dos.writeByte(r.nextInt());
					dos.writeByte(bytes[i]);
				}
				// make sure it's long enough
				for(int i=bytes.length;i<0x9;++i) {
					dos.writeByte(r.nextInt());
				}
			} else {
				dos.write(bytes);
			}
		}
		
		// 7/21/2016 jg add AES Encryption to the mix
		exec(new AESExec() {
			@Override
			public void exec(AES aes) throws IOException {
				CipherInputStream cis = aes.inputStream(new ByteArrayInputStream(baos.toByteArray()), true);
				try {
					encode(cis,os);
				} finally {
					os.flush();
					cis.close();
				}
			}
		});
		synchronized(ENC) {
		}
	}