mike.tihonchik
mike.tihonchik

Reputation: 6933

Convert HEX string back to AES

Here is the problem I am facing. There is a mechanism running on Server A (that is IBM i740 main frame) that takes secure data and uses AES to encrypt it. Now I, I want to get that ENCRYPTED data (AES encrypted string), but since it uses garbled characters, it can't be transmitted over http. So in order for me to get it, there is a web service exposed that finds that AES encrypted string, HEX'es and returns me a HEX string, like F51A751CC72124EE95518BECBA1F47C4. My question is, is there any way for me to convert (preferably, in Java) that HEX value back to AES encrypted string (I DON'T WANT TO DECRYPT THE STRING, just get it back to original encrypted value)? thanks

Upvotes: 0

Views: 1141

Answers (1)

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137547

So to summarize, the problem you are facing is that you want to transmit binary data over HTTP. (This has nothing to do with encryption; that just complicates the issue.) The funny thing is, we transmit binary data over HTTP all the time! (Images, etc.)

You need to clarify how exactly you are planning on transmitting the data. Are you including it in an HTTP POST? If so, then you need to encode the data. Base64 would be ideal here.

Otherwise, you can probably transmit it in binary, it's just a matter of explaining how you need to transmit it, so the proper things (eg. Mime type?) can be setup so the data is not corrupted in the transmission.

Upvotes: 2

Related Questions