I think it will be legal if you didn't signed agreement that you will not try to read it, and you didn't stolen device.
But this is not a trivial task. If you want to get memory dump, you're needs to find people who has access to electron microscope. As I know it is possible to reverse protected memory content by using layer-by-layer etching and analysis of charges in each cell of the memory block. But such a task may require several instances of chips with the same content, because it's complicated process and the chip can be easily damaged.
And as I know some chips with extended security may have some measures which make memory content extraction problematic, for example it can have self damage fixtures which triggering when someone trying layer-by-layer etching. Some of security chip can have even internal power source and intrusion detectors which triggers self erase procedure.
Another way is to use current consumption and electormagnetic field detectors in order to analyze what kind of operation happens inside chip to restore code sequence, but this is much more complicated and difficult way. It will be much more cheaper and easy to hire new developers and design a new firmware than reverse existing one in such way.
In any way such memory dump extraction will cost you much more than to pay software engineers to develop a new firmware.