Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encryption key should be hashed instead of making a repetition #102

Open
agudpp opened this issue Oct 8, 2020 · 0 comments
Open

encryption key should be hashed instead of making a repetition #102

agudpp opened this issue Oct 8, 2020 · 0 comments
Assignees

Comments

@agudpp
Copy link
Owner

agudpp commented Oct 8, 2020

encrypt / decrypt methods should use a hash function (key -> hash of AES_KEYLEN length)

bool
CryptoHandler::encrypt(const std::string& key, const std::string& data, std::string& result)
{
  // TODO(agudpp):
  std::string the_key = key.size() < AES_KEYLEN
      ? toolbox::StringUtils::duplicateTillNth(key, AES_KEYLEN)
      : key;
  CryptoHandler::Data crypto_data(the_key);
  CryptoHandler crypto_handler(crypto_data);
  return crypto_handler.encrypt(data, result);
}
@agudpp agudpp self-assigned this Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant