Tales From The (En)Crypt (And Decrypt)

Tales from the Crypt Keeper

I didn’t expect it today, but I finally cracked (for want of a better word) the problem of encrypted communication between Java and PHP.

The problem was that I was not correctly encoding the String data that I was passing to the PHP page, passing either a completely unencoded String of bytes, or a non-url encoded Base64 String that included the invalid characters ‘+’, ‘/’ and or ‘=’.

That’s been sorted now, and the diagram below shows the correct Java code workflow:

Java Encryption for POST

So that is Java code encrypting the data with a public key, provided by the PHP server . This encrypted data is then sent securely to the server, which then decodes with the private key. Successfully protected, secure, data.

Quite pleased with this.

Now I just have to plug this in to my licence verification stuff, and DiagramBuilder may soon be ready to go out the door! (Not forgetting stuff like windows/mac installers, ProGuard builds, etc. etc.)

 

TRP

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s