-
Notifications
You must be signed in to change notification settings - Fork 280
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
并发时,SecItemCopyMatching方法会返回errSecItemNotFound #50
Comments
@caocongcong are we supposed to google translate your text? |
我也遇到了 请问你解决了吗 |
我也遇见了,请问怎么解决. |
RSA 在这个地方使用了公共的资源: https://github.com/ideawu/Objective-C-RSA/blob/master/RSA.m#L131 所以不是线程安全的. 目前的解决方案是在你的代码中避免多线程调用 encryptString(). |
本来RSA加解密比较耗时的,不放在多线程中,感觉不太好. |
dispatch_queue_t queue = dispatch_queue_create("test", DISPATCH_QUEUE_CONCURRENT);
for (int i = 0; i< 100; i++) {
dispatch_async(queue, ^{
NSString *test = [[params md5String] uppercaseString];
NSString *test1 = [self p_publicKey];
NSString *test2 = [RSA encryptString:test publicKey:test1];
if (test2.length == 0) {
NSLog(@"出错啦");
NSLog(@"md5===%@", test);
NSLog(@"pubkey===%@", test1);
NSLog(@"encrypted===%@", test2);
} else {
NSLog(@"任务ccc===%@", test2);
}
});
}
会有出现test2为空的情况
The text was updated successfully, but these errors were encountered: