-
Notifications
You must be signed in to change notification settings - Fork 150
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
Decryption is not working on iOS but working fine in Android and Java server. #24
Comments
HI, The Response after decrypting by using |
Encrypted data: I used this then my decrypted data is something like this Decrypted Data: Can You Please help me on this |
is there an update for this issue? thanks a lot! |
@Champioshere did you use c# sample code contained in HowToUse.cs for Java porting? |
I’m having the same issue. My encryption and decryption working fine for Android and dot net but for iOS I’m having different values. |
Try using a 32 byte IV? This is how AES encryption works generally - in 32 byte increments. |
Hi,
I'm using this library in iOS App, as well as our Android team, but at Java server its receiving the encrypted request, but when they decrypt it, its getting error "Bad padding exception: Given Final Block Not Properly Padded", but its working fine on Android.
I'm also getting a response, but the data is not Decrypting. And at Android its working fine as they use same android code on Java servers. But it's not supporting me, can you kindly help me with it.
Thanks,
Same IV and key using at JAVA server,android and IOS [hardcoded for testing].
NSString* const IV = @"288dca8258b1dd7c";
NSString* const key = @"c292a6e6c19b7403cd87949d0ad45021";
My approach as in CryptLib.m
//encrypt
(NSString_) encryptString:(NSString_)XMLRequest withKey:(NSString *)key
{
NSData * encryptedData = [[StringEncryption alloc] encrypt:[XMLRequest dataUsingEncoding:NSUTF8StringEncoding] key:key iv:IV];
NSString * encryptedXML = [encryptedData base64EncodingWithLineLength:0];
}
//decrypt
(NSData_) decryptData:(NSData_)XMLResponse withKey:(NSString *)key
{
NSString *responseString = [[NSString alloc] initWithData:XMLResponse encoding:NSUTF8StringEncoding];
NSLog(@"responseString--------------------------%@",responseString);
//
NSData * decryptedData = [[StringEncryption alloc] decrypt:XMLResponse key:key iv:IV];
//
NSString * decryptedXML = [[NSString alloc] initWithData:decryptedData encoding:NSUTF8StringEncoding];
NSLog(@"decrypted data:: %@", decryptedXML);
return decryptedData;
// this data sent for xml parsing
}
The text was updated successfully, but these errors were encountered: