-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encrypt in java and Decrypt in IOS - Not working #48
Comments
If compiling for iOS 7 and above, you no longer need the NSData+Base64 files. Here is an updated m file that compiles in iOS10 Now to test: `+ (void)test{
} Remember, the RandomIV has to be the same on both sides so you will need to figure out how to pass it to whatever device is doing the decrypt. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to compile this pkg in IOS it doesn't compile . But if I add
In NSData+Base64.h programpile
But when I use
NSString * _secret = @"This the sample text has to be encrypted"; // this is the text that you want to encrypt.
NSString * key = @"shared secret"; //secret key for encryption. To make encryption stronger, we will not use this key directly. We'll first hash the key next step and then use it.
NSString * _key = [[StringEncryption alloc] sha256:key length:32]; //this is very important, 32 bytes = 256 bit
NSString * iv = [[[[StringEncryption alloc] generateRandomIV:11] base64EncodingWithLineLength:0] substringToIndex:16];
NSData * encryptedData = [[StringEncryption alloc] encrypt:[_secret dataUsingEncoding:NSUTF8StringEncoding] key:_key iv:iv];
NSLog(@"encrypted data:: %@", [encryptedData base64EncodingWithLineLength:0]); //print the encrypted text
I get coredump
The text was updated successfully, but these errors were encountered: