Skip to content

Conversation

@agisboye
Copy link
Collaborator

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)!
SecRandomCopyBytes(kSecRandomDefault, 64,
UnsafeMutablePointer<UInt8>(keyData.mutableBytes))
db.key(Blob(bytes: keyData.bytes, length: keyData.length))

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to key against keyData?

@stephencelis
Copy link
Owner

This is great! Found a small typo, but it's good to merge otherwise. @mikemee and I are in the process of extracting SQLiteCipher.swift into its own repo, so we'd like to get this in before #314 gets merged!

@agisboye
Copy link
Collaborator Author

I knew I'd missed something. Here we go. :-)

@stephencelis
Copy link
Owner

Thanks!

stephencelis added a commit that referenced this pull request Jan 10, 2016
SQLiteCipher NSData key support
@stephencelis stephencelis merged commit 4a0fa9c into stephencelis:master Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants