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
Post a Comment