darling-dmg icon indicating copy to clipboard operation
darling-dmg copied to clipboard

Support of encrypted DMG?

Open tomkoen opened this issue 6 years ago • 6 comments

AES-128 and AES-256. Is it actually possible? Thanks.

tomkoen avatar Dec 19 '17 11:12 tomkoen

Do you mean FileValut, so using something like this? https://github.com/libyal/libfvde

LubosD avatar Dec 19 '17 11:12 LubosD

This is already implemented here: https://github.com/sgan81/apfs-fuse/blob/master/ApfsLib/DeviceDMG.cpp You could use this approach.

tomkoen avatar Apr 23 '18 19:04 tomkoen

What do you think? EncryptedReader.cpp EncryptedReader.h

tomkoen avatar Apr 29 '18 11:04 tomkoen

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

tomkoen avatar Apr 29 '18 11:04 tomkoen

Looks good to me!

LubosD avatar Apr 30 '18 16:04 LubosD

I'll make a pull request soon then

kleuter avatar Apr 30 '18 17:04 kleuter