1

i'm trying to decrypt an url generated in javascript, this is what i find in the html page:

Base64.encrypt(Base64.decode('Zk05NUQ6YUZVcERKd3pCdlkucUIrbnFtdldTdW5mbkZnZFk5TVFpV3N0NHRaTF9FV1RWSHhjX1pFMDNacmxwUy5JalF3Yw=='));

my question is how i can decrypt it in Objective-C, i have add a Base64 in my Xcode project, and i have decode it using the function:

+ (NSData*) decode:(NSString*) string;

and decode it, but how i can encrypt it? what is the:

Base64.encrypt

how i can handle it in Objective-C?

EDIT 2:

i have tried to use the decode base 64 and the output is this:

fM95D:aFUpDJwzBvY.qB+nqmvWSunfnFgdY9MQiWst4tZL_EWTVHxc_ZE03ZrlpS.IjQwc

what i have to do then? the javascript do this Base.encrypt, what i have to do?

Piero
  • 9,173
  • 18
  • 90
  • 160

1 Answers1

1

You need to use some utility class or some category to do the decoding & conversion.

And you can find something suitable within the answers on this very related question.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • i know how do the decode, but how i can do the encypt like that script do? – Piero Dec 27 '12 at 00:29
  • If you look in the linked question, you'll see a method named "`base64DataFromString`". – Michael Dautermann Dec 27 '12 at 00:29
  • ok, that function return NSData, and then what i have to do with that Data? – Piero Dec 27 '12 at 00:30
  • and now I'm thoroughly confused as to what you are actually doing. Are you trying to *encode* or *decode* a string? What's the big picture purpose here? – Michael Dautermann Dec 27 '12 at 01:47
  • decode...but i can't understand what does Base64.encrypt...i want do the same thing in objective-c – Piero Dec 27 '12 at 01:49
  • The purpose of Base64-encoding (not encrypting) is to take a binary data stream and represent in a text format that can be included in text transmissions (e.g. JSON or XML). The Base64-decoding (not decrypting) simply takes the Base64-encoded text stream (that was presumably included in a JSON or XML transmission) and retrieves the original binary data (e.g. an image or something like that). In short, the purpose of Base64 is not to encrypt (i.e. keep the content from prying eyes), but rather to facilitate transmission via a text-based format. Base64.encrypt seems like a misnomer to me. – Rob Dec 27 '12 at 03:53