darling-dmg
darling-dmg copied to clipboard
Support of encrypted DMG?
AES-128 and AES-256. Is it actually possible? Thanks.
Do you mean FileValut, so using something like this? https://github.com/libyal/libfvde
This is already implemented here: https://github.com/sgan81/apfs-fuse/blob/master/ApfsLib/DeviceDMG.cpp You could use this approach.
What do you think? EncryptedReader.cpp EncryptedReader.h
And here goes this
#ifdef COMPILE_WITH_DECRYPTION_SUPPORT
#include "decrypt/EncryptedReader.h"
#endif
#ifdef COMPILE_WITH_DECRYPTION_SUPPORT
DMGDisk::DMGDisk(std::shared_ptr<Reader>reader, const std::string &password)
#else
DMGDisk::DMGDisk(std::shared_ptr<Reader>reader)
#endif
: m_reader(reader), m_zone(40000)
{
#ifdef COMPILE_WITH_DECRYPTION_SUPPORT
if (EncryptedReader::isEncryptedDMG(reader))
{
auto encReader = std::make_shared<EncryptedReader>(m_reader);
if (encReader && encReader->setupEncryptionV2(password))
m_reader = encReader;
else
{
throw std::runtime_error("Invalid password specified");
}
}
#endif
Looks good to me!
I'll make a pull request soon then