You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While decrypting I get the error : The operation couldnot be performed RNCryptorError 1
I dont understand what I am doing wrong. Here is my block of code
The text was updated successfully, but these errors were encountered:
Please just post code into the question rather than a screenshot. I can't compile a screenshot, and they're very hard to read.
Error 1 is an HMAC error. Either your data is corrupted or your password is incorrect. Most likely, the data in encodedData is not precisely the data that came out of the encryptor. You should verify that it is.
Note that NSException never makes sense in Swift. Switch can't catch them. They only make sense in ObjC if you're going to crash the program shortly after. They're not memory-safe in ObjC. You meant to use Swift's throw and ErrorType, which are unrelated to raise or NSException.
class func decrypt(message: String) -> String {
print("the message to decrypt is (message)")
let data1: NSData = NSData(base64EncodedString: message, options: NSDataBase64DecodingOptions(rawValue: 0))!
do {
let decData : NSData = try RNCryptor.decryptData(data1, password: password)
print("The decrypted data is now now \(decData)")
let tokenString: String = NSString(data: decData, encoding: NSUTF8StringEncoding)! as String
return tokenString
}
catch let error as NSError {
print("The error description is \(error.localizedDescription)")
print("The main error is \(error.description)")
debugPrint("The main main main eror :\(error)")
return ""
}
}
While decrypting I get the error : The operation couldnot be performed RNCryptorError 1
I dont understand what I am doing wrong. Here is my block of code
The text was updated successfully, but these errors were encountered: