Skip to content
Advertisement

platform.win32.Win32Exception: The data is invalid | Java

I was writing this code to restore the user’s saved chrome passwords and display them on the console. I was able to decode Base64 encoded. But I am failing in decrying from this Crypt32Util.cryptUnprotectData any help … I am a beginner. 🙂 Main.java

JavaScript

Output

JavaScript

Advertisement

Answer

decoder.decode() returns binary data. You cannot create a String from binary data.

If you want a byte[] with the first 5 bytes from the byte[] returned by decoder.decode(), use Arrays.copyOfRange():

JavaScript

However, I doubt that is correct. Why do you believe the master password could be encrypted to only 5 bytes, and what is all the rest then?

It’s far more likely that all the bytes are encrypted version of the master key:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement