Encrypt json data with secret key on IOS and decrypt it with node js -


i need protect api csrf on post , put requests.

to that, think mobile device (example ios) need send api server (node.js) token. token must encrypted , contain json data decrypted server side.

to decrypt data, mobile device use same secret key sever know.

for example : {_csrf: 123456789} decrypted token sent via mobile device , checked api if match.

  1. is right way ? if not right way ?

  2. how can encrypt jon data on ios , decrypt on node.js ? (jwt token not have library ios)

can provide me example code encrypt data on ios et decrypt on node.js ?

just use https, encrypts everything, query string.

the content encrypted random symmetric key , key encrypted asymmetric key certificate. additionally symmetric key has short lifetime. additionally not have implements , encryption routines.

also note ios9 default require https used connections, http connections need white-listed in plist.

if own encryption have problem sharing encryption key between device , server. not easy problem solve.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -