views:

38

answers:

2

I need to send a public key created by RSA by SMS to another phone. I am converting the 148 byte public key to base64 to be sent by SMS. But it increases the 148 bytes to 200 bytes when converted.

As byte[] cannot be directly sent by SMS, what are the other possible methods of converting them successfully to strings or equivalent which can be sent through SMS? Other than compressing, is base64 the only possible method?

+1  A: 

You can an SMS in 8bit mode - most GSM modems and gateways have this option, and some phones also expose this capability in their API.

This way you can send the entire key, and still have 12 bytes for extra data. You'll need some software on the phone which will be able read the message and use it, though.

Another option: send it in two related separate SMSes; most(?) phones know how to send and combine separate SMSes to one logical message (to understand how it exactly works you'll have to dig into the SMS protocol specifications).

adamk
You can use up to 160 characters in an SMS when encoded in the GSM 7 bit default alphabet. The total maximum payload for a short message is 140 bytes though.
paprika
+1  A: 

Adamk mentioned binary mode for sending SMS. Unfortunately this still leaves you with only 140 bytes for the payload, 8 bytes short!

If the target application is able to handle concatenated messages and it's acceptable that each key sent costs twice as much, then you should go with this solution.

paprika
@paprika: I agree :) Unless i reduce the key size of RSA (Nooo way!!) I have to live with sending two messages!
Ranhiru Cooray