-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
SQLiteCipher NSData key support #172
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
Conversation
Adds key and rekey methods that accept a key of type NSData. This allows the database to be easily keyed with a key generated by Security.framework: let keyData = NSMutableData(length: 64)! let result = SecRandomCopyBytes(kSecRandomDefault, 64, UnsafeMutablePointer<UInt8>(keyData.mutableBytes)) db.key(keyData)
Thanks for the pull request! A few small things and I'd love to merge this.
|
@agisboye Any update here? If you don't want to make the changes I'll try to implement them when I have the chance. |
@stephencelis Sorry for the delay. I've switched to SQLite.Blob and fixed the whitespace. I haven't gotten around to the tests yet I'm afraid. |
Looking good! Let me know if you need any direction getting some tests written! |
@@ -62,6 +62,10 @@ public struct Blob { | |||
public init(bytes: UnsafePointer<Void>, length: Int) { | |||
data = NSData(bytes: bytes, length: length) | |||
} | |||
|
|||
public init (data: NSData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance we can get rid of this convenience initializer? The swift-2
branch actually uses a fully Swift implementation of Blob
(no reliance on Foundation
/NSData
), which I may back-port, at which point you can still create a blob from NSData
like this:
// data: NSData
let blob = Blob(bytes: data.bytes, length: data.length)
Any update here? Would love to merge this if you have time to add some tests! |
Closing in favor of #317. |
Adds key and rekey methods that accept a key of type NSData.
This allows the database to be easily keyed with a key generated by
Security.framework: