NSString from NSData #37

Closed
pepibumur opened this Issue Jul 7, 2013 · 3 comments

Projects

None yet

3 participants

@pepibumur

Hello,
I'm having troubles to retrieve NSString from a previous generated NSData from RNCryptor.
In my app I generate an NSData from NSString using RNCryptor. This NSData is stored in Keychain ( previously converted to base 64 NSString ).
When I need this information, I retrieve this NSString from keychaing and convert to NSData ( using reverse base 64 ).

Once I have this NSDate I apply RNDecryptor in order to have the original NSString.
The problem I have is that RNDecryptor returns an NSData that I try to convert into NSString using NSUTF8StringEncoding but it returns an error.

 NSData *data=[RNDecryptor decryptData:datafrombase64 withPassword:pass error:&error];
    if(error){
        return NO;
    }
    NSString *srcString=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

Does someone know the way to retrieve NSString?
Thanks

@abc2mit
abc2mit commented Sep 2, 2014

This seems like a problem with using the RNCryptor library and isn't related to any issues with SSKeychain.

@abc2mit
abc2mit commented Sep 2, 2014

But if you want to know the answer to this, you can take a look at my post here:
http://stackoverflow.com/questions/2467844/convert-utf-8-encoded-nsdata-to-nsstring/23748853#23748853

or see the other posts for alternate answers.

@soffes
Owner
soffes commented Jun 19, 2015

Thanks @abc2mit!

@soffes soffes closed this Jun 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment