2 * Copyright (c) 2015, Facebook, Inc.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
10 #include <folly/wangle/ssl/PasswordInFile.h>
12 #include <folly/FileUtil.h>
18 PasswordInFile::PasswordInFile(const string& file)
20 folly::readFile(file.c_str(), password_);
21 auto p = password_.find('\0');
22 if (p != std::string::npos) {
27 PasswordInFile::~PasswordInFile() {
28 OPENSSL_cleanse((char *)password_.data(), password_.length());