使用RNCryptor Library解密时遇到问题

时间:2021-10-14 21:54:39

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 使用RNCryptor Library解密时遇到问题

解密时我得到错误:无法执行操作RNCryptorError 1我不明白我做错了什么。这是我的代码块

1 个解决方案

#1


1  

For anyone who might search here: this is a duplicate of RNCryptor#174, and you may want to read there as well.

对于可能在此搜索的任何人:这是RNCryptor#174的副本,您也可以在那里阅读。

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.

错误1是HMAC错误。您的数据已损坏或密码不正确。

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.

请注意,NSException在Swift中永远不会有意义。 Switch无法捕获它们。它们只在ObjC中才有意义,如果你不久之后就要崩溃了。它们在ObjC中不是内存安全的。你的意思是使用Swift的throw和ErrorType,它们与raise或NSException无关。

#1


1  

For anyone who might search here: this is a duplicate of RNCryptor#174, and you may want to read there as well.

对于可能在此搜索的任何人:这是RNCryptor#174的副本,您也可以在那里阅读。

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.

错误1是HMAC错误。您的数据已损坏或密码不正确。

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.

请注意,NSException在Swift中永远不会有意义。 Switch无法捕获它们。它们只在ObjC中才有意义,如果你不久之后就要崩溃了。它们在ObjC中不是内存安全的。你的意思是使用Swift的throw和ErrorType,它们与raise或NSException无关。