encryption - Encoding/Decoding client (android) and server (PHP) side -



encryption - Encoding/Decoding client (android) and server (PHP) side -

i have project in have send info android app mysql database via php webservices. of course of study want info encrypted.

we decided utilize rsa 1024 encrypt , decrypt, i've found troubles utilize public&private keys agreed use.

this code encrypting

privatekey = 'abcdefghijk'; byte[] encodedbytes = null; seek { cipher c = cipher.getinstance("rsa"); c.init(cipher.encrypt_mode, privatekey); encodedbytes = c.dofinal(thetesttext.getbytes()); } grab (exception e) { log.e(tag, "rsa encryption error"); }

and 1 decrypting

publickey = 'secretpubkey'; byte[] decodedbytes = null; seek { cipher c = cipher.getinstance("rsa"); c.init(cipher.decrypt_mode, publickey); decodedbytes = c.dofinal(encodedbytes); } grab (exception e) { log.e(tag, "rsa decryption error"); }

publickey , privatekey aren't string type, because init function asks me key type, seems can't whatever value want key type.

can help me?? give thanks you!

android encryption rsa

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -