Snow3G(const BytesVector &key, const BytesVector &IV, const uint64_t &output_size) : output_size(output_size) { setIV(IV); setKey(key); keySetup(); }
void CipherKeyImpl::generateKey() { ByteVec vec; getRandomBytes(vec, keySize()); setKey(vec); getRandomBytes(vec, ivSize()); setIV(vec); }
bool FileNode::setName(const char *plaintextName_, const char *cipherName_, uint64_t iv, bool setIVFirst) { // Lock _lock( mutex ); if (cipherName_ != nullptr) { VLOG(1) << "calling setIV on " << cipherName_; } if (setIVFirst) { if (fsConfig->config->externalIVChaining && !setIV(io, iv)) { return false; } // now change the name.. if (plaintextName_ != nullptr) { this->_pname = plaintextName_; } if (cipherName_ != nullptr) { this->_cname = cipherName_; io->setFileName(cipherName_); } } else { std::string oldPName = _pname; std::string oldCName = _cname; if (plaintextName_ != nullptr) { this->_pname = plaintextName_; } if (cipherName_ != nullptr) { this->_cname = cipherName_; io->setFileName(cipherName_); } if (fsConfig->config->externalIVChaining && !setIV(io, iv)) { _pname = oldPName; _cname = oldCName; return false; } } return true; }