Skip to content

WhatsApp Keystore

Ben edited this page Mar 1, 2021 · 1 revision

Decrypt client_static_keypair_pwd_enc

  • Add this repository as dependency in your project.
  • Copy the client_static_keypair_pwd_enc from the keystore.xml. It will look like this:
[2,"ciphertextBase64","ivBase64","saltBase64","passwordBase64"]
  • Convert this XML-ish JSON to real JSON by replacing the HTML Entities by their real characters. That will look like this:
[2,"ciphertextBase64","ivBase64","saltBase64","passwordBase64"]
  • Decrypt your token with some code:
//Make a JSONArray from the JSON string
JSONArray jsonArr = new JSONArray("[2,\"ciphertextBase64\",\"ivBase64\",\"saltBase64\",\"passwordBase64\"]");
//Make a EncryptedClientStaticKeypair from a JSON Array object
EncryptedClientStaticKeypair enc = EncryptedClientStaticKeypair.fromJSONArray(jsonArr);
//Decrypt the keypair
byte[] client_static_keypair = enc.decrypt();
//Print the keypair as Base64 value
System.err.println(Base64.getEncoder().encodeToString(client_static_keypair));