Friday, 15 April 2011

ios - Get encrypted text as NSString instead of NSData -



ios - Get encrypted text as NSString instead of NSData -

how can encrypted info string instead of nsdata object in objectice -c? need send encrypted text >net method , decryption procedures handles in .net code. or can help me encrypt text in ios , decrypt in >net ?

adding comment - zaph using code:

stringencryption *crypto = [[stringencryption alloc] init]; nsdata *_secretdata = [searchkey datausingencoding:nsutf8stringencoding]; ccoptions padding = kccoptionpkcs7padding; nsdata *key = [_key datausingencoding:nsutf8stringencoding]; nsdata *encrypteddata = [crypto encrypt:_secretdata key:key padding:&padding];

i need send encrypteddata .net. dnt know how send nsdata .net method , tried convert encrypteddata nsstring, unfortunately gives me nil. tried base64encodedstringwithoptions,its giving error when decrypting.

you can convert nsdata base of operations 64 string. ios 7, nsdata has these 2 methods: (direct quotes apple doc)

base64encodeddatawithoptions : create base-64, utf-8 encoded nsdata receiver's contents using given options.

base64encodedstringwithoptions : create base-64 encoded nsstring receiver's contents using given options.

ios aes

No comments:

Post a Comment