mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
use some placeholder data for agile key
This commit is contained in:
parent
b26d764624
commit
4dedcd23dd
|
@ -632,9 +632,9 @@ void DirTree::debug()
|
||||||
|
|
||||||
// =========== StorageIO ==========
|
// =========== StorageIO ==========
|
||||||
|
|
||||||
StorageIO::StorageIO(Storage *st, char *bytes, std::size_t length)
|
StorageIO::StorageIO(Storage *st, std::uint8_t *bytes, std::size_t length)
|
||||||
: storage(st),
|
: storage(st),
|
||||||
filedata(reinterpret_cast<std::uint8_t *>(bytes)),
|
filedata(bytes),
|
||||||
dataLength(length),
|
dataLength(length),
|
||||||
result(Storage::Ok),
|
result(Storage::Ok),
|
||||||
opened(false),
|
opened(false),
|
||||||
|
@ -1064,7 +1064,7 @@ void StreamIO::updateCache()
|
||||||
|
|
||||||
// =========== Storage ==========
|
// =========== Storage ==========
|
||||||
|
|
||||||
Storage::Storage(char *bytes, std::size_t length)
|
Storage::Storage(std::uint8_t *bytes, std::size_t length)
|
||||||
: io(new StorageIO(this, bytes, length))
|
: io(new StorageIO(this, bytes, length))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace POLE
|
||||||
/**
|
/**
|
||||||
* Constructs a storage with name filename.
|
* Constructs a storage with name filename.
|
||||||
**/
|
**/
|
||||||
Storage( char* bytes, std::size_t length );
|
Storage(std::uint8_t *bytes, std::size_t length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the storage.
|
* Destroys the storage.
|
||||||
|
@ -279,7 +279,7 @@ namespace POLE
|
||||||
|
|
||||||
std::list<Stream*> streams;
|
std::list<Stream*> streams;
|
||||||
|
|
||||||
StorageIO( Storage* storage, char* bytes, std::size_t length );
|
StorageIO( Storage* storage, std::uint8_t *bytes, std::size_t length );
|
||||||
~StorageIO();
|
~StorageIO();
|
||||||
|
|
||||||
bool open();
|
bool open();
|
||||||
|
|
|
@ -386,8 +386,7 @@ std::vector<std::uint8_t> decrypt_xlsx(
|
||||||
throw xlnt::exception("empty file");
|
throw xlnt::exception("empty file");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<char> as_chars(bytes.begin(), bytes.end());
|
POLE::Storage storage(const_cast<std::uint8_t *>(bytes.data()), bytes.size());
|
||||||
POLE::Storage storage(as_chars.data(), static_cast<unsigned long>(bytes.size()));
|
|
||||||
|
|
||||||
if (!storage.open())
|
if (!storage.open())
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,35 @@ encryption_info generate_encryption_info(const std::u16string &password)
|
||||||
{
|
{
|
||||||
encryption_info result;
|
encryption_info result;
|
||||||
|
|
||||||
|
result.is_agile = true;
|
||||||
|
|
||||||
|
result.agile = encryption_info::agile_encryption_info{};
|
||||||
|
|
||||||
|
result.agile.key_data.block_size = 16;
|
||||||
|
result.agile.key_data.cipher_algorithm = "AES";
|
||||||
|
result.agile.key_data.cipher_chaining = "CBC";
|
||||||
|
result.agile.key_data.hash_algorithm = "SHA512";
|
||||||
|
result.agile.key_data.hash_size = 64;
|
||||||
|
result.agile.key_data.key_bits = 128;
|
||||||
|
result.agile.key_data.salt_size = 10;
|
||||||
|
result.agile.key_data.salt_value = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||||
|
|
||||||
|
result.agile.data_integrity.hmac_key = { 1, 2, 3 };
|
||||||
|
result.agile.data_integrity.hmac_value = { 3, 4, 5 };
|
||||||
|
|
||||||
|
result.agile.key_encryptor.spin_count = 100000;
|
||||||
|
result.agile.key_encryptor.block_size = 16;
|
||||||
|
result.agile.key_encryptor.cipher_algorithm = "AES";
|
||||||
|
result.agile.key_encryptor.cipher_chaining = "CBC";
|
||||||
|
result.agile.key_encryptor.hash = xlnt::detail::hash_algorithm::sha512;
|
||||||
|
result.agile.key_encryptor.hash_size = 64;
|
||||||
|
result.agile.key_encryptor.key_bits = 128;
|
||||||
|
result.agile.key_encryptor.salt_size = 10;
|
||||||
|
result.agile.key_encryptor.salt_value = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||||
|
result.agile.key_encryptor.verifier_hash_input = { 1, 2, 3 };
|
||||||
|
result.agile.key_encryptor.verifier_hash_value = { 1, 2, 3 };
|
||||||
|
result.agile.key_encryptor.encrypted_key_value = { 3, 4, 5 };
|
||||||
|
|
||||||
result.agile.key_data.salt_value.assign(
|
result.agile.key_data.salt_value.assign(
|
||||||
reinterpret_cast<const std::uint8_t *>(password.data()),
|
reinterpret_cast<const std::uint8_t *>(password.data()),
|
||||||
reinterpret_cast<const std::uint8_t *>(password.data() + password.size()));
|
reinterpret_cast<const std::uint8_t *>(password.data() + password.size()));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user