{"action":"created","issue":{"url":"https://api.github.com/repos/Tencent/wcdb/issues/371","repository_url":"https://api.github.com/repos/Tencent/wcdb","labels_url":"https://api.github.com/repos/Tencent/wcdb/issues/371/labels{/name}","comments_url":"https://api.github.com/repos/Tencent/wcdb/issues/371/comments","events_url":"https://api.github.com/repos/Tencent/wcdb/issues/371/events","html_url":"https://github.com/Tencent/wcdb/issues/371","id":355915987,"node_id":"MDU6SXNzdWUzNTU5MTU5ODc=","number":371,"title":"如何对单个字段进行加密","user":{"login":"iDivines","id":16111063,"node_id":"MDQ6VXNlcjE2MTExMDYz","avatar_url":"https://avatars2.githubusercontent.com/u/16111063?v=4","gravatar_id":"","url":"https://api.github.com/users/iDivines","html_url":"https://github.com/iDivines","followers_url":"https://api.github.com/users/iDivines/followers","following_url":"https://api.github.com/users/iDivines/following{/other_user}","gists_url":"https://api.github.com/users/iDivines/gists{/gist_id}","starred_url":"https://api.github.com/users/iDivines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iDivines/subscriptions","organizations_url":"https://api.github.com/users/iDivines/orgs","repos_url":"https://api.github.com/users/iDivines/repos","events_url":"https://api.github.com/users/iDivines/events{/privacy}","received_events_url":"https://api.github.com/users/iDivines/received_events","type":"User","site_admin":false},"labels":[{"id":625532546,"node_id":"MDU6TGFiZWw2MjU1MzI1NDY=","url":"https://api.github.com/repos/Tencent/wcdb/labels/iOS/macOS","name":"iOS/macOS","color":"A8A8A8","default":false},{"id":602831112,"node_id":"MDU6TGFiZWw2MDI4MzExMTI=","url":"https://api.github.com/repos/Tencent/wcdb/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-31T09:55:46Z","updated_at":"2018-09-01T01:50:19Z","closed_at":null,"author_association":"NONE","body":"各位开发大大，我不想开启数据库的全局加密，请问下怎么对数据库的单个字段进行加密呢？主要是想实现coredata那样加解密对用户是透明的，请问有什么好的解决方案吗？希望有人能回答下，非常感谢！！"},"comment":{"url":"https://api.github.com/repos/Tencent/wcdb/issues/comments/417824531","html_url":"https://github.com/Tencent/wcdb/issues/371#issuecomment-417824531","issue_url":"https://api.github.com/repos/Tencent/wcdb/issues/371","id":417824531,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzgyNDUzMQ==","user":{"login":"iDivines","id":16111063,"node_id":"MDQ6VXNlcjE2MTExMDYz","avatar_url":"https://avatars2.githubusercontent.com/u/16111063?v=4","gravatar_id":"","url":"https://api.github.com/users/iDivines","html_url":"https://github.com/iDivines","followers_url":"https://api.github.com/users/iDivines/followers","following_url":"https://api.github.com/users/iDivines/following{/other_user}","gists_url":"https://api.github.com/users/iDivines/gists{/gist_id}","starred_url":"https://api.github.com/users/iDivines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iDivines/subscriptions","organizations_url":"https://api.github.com/users/iDivines/orgs","repos_url":"https://api.github.com/users/iDivines/repos","events_url":"https://api.github.com/users/iDivines/events{/privacy}","received_events_url":"https://api.github.com/users/iDivines/received_events","type":"User","site_admin":false},"created_at":"2018-09-01T01:50:19Z","updated_at":"2018-09-01T01:50:19Z","author_association":"NONE","body":"hi,RingoD:\r\n    the problems have been solved. i have a NSString property, define a EncString the subclass of NSString. final use WCTColumnCoding.\r\n\r\n@implementation EncString (WCTColumnCoding)\r\n\r\n+ (instancetype)unarchiveWithWCTValue:(NSString *)value\r\n{\r\n    NSError *error = nil;\r\n    NSData *indata = [Base64 decode:value];\r\n    NSData *data = [NSData decryptData:indata];\r\n    if (error) {\r\n        return @\"\";\r\n    }else{\r\n        return [[NSMutableString alloc] initWithData:data encoding:NSUTF8StringEncoding];\r\n    }\r\n    \r\n}\r\n\r\n- (NSString *)archivedWCTValue\r\n{\r\n    NSError *error = nil;\r\n    NSData *indata = [self dataUsingEncoding:NSUTF8StringEncoding];\r\n    NSData *outData= [NSData encryptData:indata];\r\n    if (error) {\r\n        return @\"\";\r\n    }\r\n    return [Base64 encode:outData];\r\n}\r\n\r\n+ (WCTColumnType)columnTypeForWCDB\r\n{\r\n    return WCTColumnTypeString;\r\n}\r\n\r\n@end\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"iDivines"}}