#include "crypto/symmetric_key.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <utility>
#include "base/check_op.h"
#include "base/notreached.h"
#include "crypto/openssl_util.h"
#include "third_party/boringssl/src/include/openssl/evp.h"
#include "third_party/boringssl/src/include/openssl/rand.h"
namespace crypto {
namespace {
bool CheckDerivationParameters(SymmetricKey::Algorithm algorithm,
size_t key_size_in_bits) { … }
}
SymmetricKey::~SymmetricKey() { … }
std::unique_ptr<SymmetricKey> SymmetricKey::GenerateRandomKey(
Algorithm algorithm,
size_t key_size_in_bits) { … }
std::unique_ptr<SymmetricKey> SymmetricKey::DeriveKeyFromPasswordUsingPbkdf2(
Algorithm algorithm,
const std::string& password,
const std::string& salt,
size_t iterations,
size_t key_size_in_bits) { … }
std::unique_ptr<SymmetricKey> SymmetricKey::DeriveKeyFromPasswordUsingScrypt(
Algorithm algorithm,
const std::string& password,
const std::string& salt,
size_t cost_parameter,
size_t block_size,
size_t parallelization_parameter,
size_t max_memory_bytes,
size_t key_size_in_bits) { … }
std::unique_ptr<SymmetricKey> SymmetricKey::Import(Algorithm algorithm,
const std::string& raw_key) { … }
SymmetricKey::SymmetricKey() = default;
}