Skip to content
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

Encrypt Plain text Db (expose sqlcipher_export) #1101

Closed
mahsha opened this issue Dec 8, 2021 · 5 comments
Closed

Encrypt Plain text Db (expose sqlcipher_export) #1101

mahsha opened this issue Dec 8, 2021 · 5 comments
Milestone

Comments

@mahsha
Copy link

mahsha commented Dec 8, 2021

I Hope you expose these functions in sqlite swift API to encrypt plain text DB

try dbConnection.execute("ATTACH DATABASE '\(encryptedPath)' AS encrypted KEY '\(password)';")
try dbConnection.execute("SELECT sqlcipher_export('encrypted');")
try dbConnection.execute("DETACH DATABASE encrypted;")
@jberkel
Copy link
Collaborator

jberkel commented Dec 9, 2021

Yes, this is planned. See #1098

@jberkel jberkel changed the title Encrypt Plain text Db Encrypt Plain text Db (expose sqlcipher_export) Dec 9, 2021
@jberkel jberkel added this to the 0.14.0 milestone Jul 17, 2022
@jberkel
Copy link
Collaborator

jberkel commented Jul 19, 2022

Will get released in 0.14.0

@jberkel jberkel closed this as completed Jul 19, 2022
@liyuan116
Copy link

hi @jberkel When will 0.14.0 be released ?

@jberkel
Copy link
Collaborator

jberkel commented Sep 20, 2022

@liyuan116 I resumed working on the project, it should be some point this week

@liyuan116
Copy link

[Decrypt a SQLCipher database to a Plaintext Database](https://www.zetetic.net/sqlcipher/sqlcipher-api/#example-2-I Hope you expose these functions in sqlite swift API decrypt-a-sqlcipher-database-to-a-plaintext-database)
public func plaintext_export(_ location: Location, key: String) throws {
let schemaName = "plaintext"
let sql = "PRAGMA key = (key)"
try run(sql)
try attach(location, as: schemaName, key: "")
try run("SELECT sqlcipher_export(?)", schemaName)
try detach(schemaName)
}
@jberkel

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

No branches or pull requests

3 participants