SlideShare a Scribd company logo
5
  SQLite
Taro Matsuzawa aka. btm (@smellman)
  sumaben@kanto #11 Lightning Talk
SQLite

• iPhone       SQL

•
• Firefox
• JB
 •     Blob
sqlcipher
• SQLite
 • SQLite


• iPhone
1

$ sudo mkdir -p /opt/smartphone/lib
$ sudo chown -R btm:staff /opt/smartphone
$ cd /opt/smartphone/lib/
$ git clone git://github.com/sjlombardo/sqlcipher.git
$ curl -O ftp://ftp.infoscience.co.jp/pub/Crypto/SSL/openssl/source/openssl-1.0.0a.tar.gz
$ git clone git://github.com/sjlombardo/openssl-xcode.git
$ tar zxf openssl-1.0.0a.tar.gz
$ cp -fr openssl-xcode/openssl.xcodeproj openssl-1.0.0a/
$ mv openssl-1.0.0a openssl
2
•   XCode

    •
        •   SQLCIPHER_SRC       SQLCipher

            •   SQLCIPHER_SRC:/opt/smartphone/lib/sqlcipher

        •   OPENSSL_SRC       OpenSSL

            •   OPENSSL_SRC:/opt/smartphone/lib/openssl
3

•   XCode                      ->

    •   OpenSSL          openssl.xcodeproj

        •

    •        SQLCipher              sqlcipher.xcodeproj
4

•   SQLCipher    OpenSSL

    •   sqlcipher.xcodeproj                  ->

        •                   SQLCIPHER_SRC

    •   openssl.xcodeproj                   ->

        •                   OPENSSL_SRC
5
•   XCode                            ->
        "SQLCipherTest"

    •                                       +

        •   OpenSSL   crypto   SQLCipher   sqlcipher

    •
        •
            •   $(SQLCIPHER_SRC)   $(OPENSSL_SRC)
6

•   sqlcipher.xcodeproj    libsqlcipher.a



•   openssl.xcodeproj     libcrypto.a



•                                           SQLITE_HAS_CODEC=1
•   SQL

    •   PRAGMA key = 'default_key';

    •                       sqlcipher

•
•   FMDatabase

    •   FMDatabase setKey
! NSString* key = @"TaroMatsuzawaIsDead";
! NSString* newKey = [key stringByAppendingString:
             [[UIDevice currentDevice] uniqueIdentifier]];

! if (![rootViewController.encdb setKey:key])
! ! NSLog(@"> Could not set key.");
URL
•   sqlcipher

    •   http://sqlcipher.net/

•   sqlcipher document

    •   http://sqlcipher.net/documentation

•   openssl-xcode

    •   https://github.com/sjlombardo/openssl-xcode

•   FMDatabase

    •   https://github.com/ccgus/fmdb
•
$ sudo port install openssl
$ mkdir -p ~/develop/sqlcipher
$ cd ~/develop/sqlcipher
$ git clone git://github.com/sjlombardo/sqlcipher.git
$ cd sqlcipher
$ ./configure CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/opt/local/lib/libcrypto.a"
$ make

$ ~/develop/sqlcipher/sqlcipher/sqlite3 sqlite3.db
SQLite version 3.7.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read /Users/btm/develop/(      )/schema.sql
sqlite> PRAGMA key = 'default_key';

More Related Content

PPTX
NoSQL - Hands on
PDF
San Francisco Java User Group
PDF
Redis and its many use cases
PPTX
PDF
Redis for the Everyday Developer
PDF
Mongo db for c# developers
PDF
Mongo db for C# Developers
PPTX
Introduction to the new official C# Driver developed by 10gen
NoSQL - Hands on
San Francisco Java User Group
Redis and its many use cases
Redis for the Everyday Developer
Mongo db for c# developers
Mongo db for C# Developers
Introduction to the new official C# Driver developed by 10gen

What's hot (20)

PDF
Redis the better NoSQL
PPTX
2015 02-09 - NoSQL Vorlesung Mosbach
PDF
Couchdb w Ruby'm
PDF
PuppetCamp SEA 1 - Version Control with Puppet
PPTX
Redis Use Patterns (DevconTLV June 2014)
PDF
20110514 mongo dbチューニング
KEY
Paris js extensions
PDF
2012-03-20 - Getting started with Node.js and MongoDB on MS Azure
PPTX
19. CodeIgniter imagini in mysql
KEY
puppet @techlifecookpad
PDF
Chrome拡張開発者のためのFirefox拡張開発
PDF
チームメイトのためにdocstringを書こう! pyconjp2019
TXT
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
PPTX
20171014 tips for manipulating filesystem in julia
PDF
DEF CON 27 -OMER GULL - select code execution from using sq lite
PDF
Couchdb
PDF
Puppet Camp Amsterdam 2015: Manifests of Future Past
KEY
Redis in Practice
PDF
Drush. Secrets come out.
KEY
MongoDB
Redis the better NoSQL
2015 02-09 - NoSQL Vorlesung Mosbach
Couchdb w Ruby'm
PuppetCamp SEA 1 - Version Control with Puppet
Redis Use Patterns (DevconTLV June 2014)
20110514 mongo dbチューニング
Paris js extensions
2012-03-20 - Getting started with Node.js and MongoDB on MS Azure
19. CodeIgniter imagini in mysql
puppet @techlifecookpad
Chrome拡張開発者のためのFirefox拡張開発
チームメイトのためにdocstringを書こう! pyconjp2019
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
20171014 tips for manipulating filesystem in julia
DEF CON 27 -OMER GULL - select code execution from using sq lite
Couchdb
Puppet Camp Amsterdam 2015: Manifests of Future Past
Redis in Practice
Drush. Secrets come out.
MongoDB
Ad

Similar to スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化 (20)

PDF
Getting Started with PureScript
PDF
Mac OS X Lion で作る WordPress local 環境
PPSX
comp security lab.ppsx
PPTX
Lightweight static code analysis with semgrep
PDF
Build Time Analyzer
PPT
Live Memory Forensics on Android devices
PDF
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
PDF
Ci system part i
ODP
2017 Codemotion OWASP ZAP in CI/CD
PPTX
SQL Injection Defense in Python
PDF
How to inspect a RUNNING perl process
PDF
视觉中国的MongoDB应用实践(QConBeijing2011)
PDF
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
PDF
Доклад Михаила Егорова на PHDays
PDF
Hacking Adobe Experience Manager sites
PDF
#WeSpeakLinux Session
PDF
Osquery
PDF
窺探職場上所需之資安專業技術與能力 Tdohconf
PPT
Don’t turn your logs into cuneiform
PDF
Firebird Interbase Database engine hacks or rtfm
Getting Started with PureScript
Mac OS X Lion で作る WordPress local 環境
comp security lab.ppsx
Lightweight static code analysis with semgrep
Build Time Analyzer
Live Memory Forensics on Android devices
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
Ci system part i
2017 Codemotion OWASP ZAP in CI/CD
SQL Injection Defense in Python
How to inspect a RUNNING perl process
视觉中国的MongoDB应用实践(QConBeijing2011)
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
Доклад Михаила Егорова на PHDays
Hacking Adobe Experience Manager sites
#WeSpeakLinux Session
Osquery
窺探職場上所需之資安專業技術與能力 Tdohconf
Don’t turn your logs into cuneiform
Firebird Interbase Database engine hacks or rtfm
Ad

More from Taro Matsuzawa (16)

PDF
タイルの話
PDF
地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2
PDF
Couchbase hackaton pomo
PDF
11月のささみ: pgRoutingって何?
PDF
OSMを使ったスマホ&Web開発入門
PDF
ゆるふわLinux-HA 〜PostgreSQL編〜
KEY
AFNetworking使ってみた
PDF
スマホ開発者も使えるWireshark
PDF
来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall
PDF
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
KEY
ベトナムにRoRを教えに行ったら大変なお土産をもらったでござる
KEY
デバッガを使おう@ブラウザ勉強会#1
PDF
(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop
KEY
デコメを送る
PDF
Mozilla コアハッカー育成計画(PDF)
ODP
Mozilla コアハッカー育成計画
タイルの話
地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2
Couchbase hackaton pomo
11月のささみ: pgRoutingって何?
OSMを使ったスマホ&Web開発入門
ゆるふわLinux-HA 〜PostgreSQL編〜
AFNetworking使ってみた
スマホ開発者も使えるWireshark
来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
ベトナムにRoRを教えに行ったら大変なお土産をもらったでござる
デバッガを使おう@ブラウザ勉強会#1
(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop
デコメを送る
Mozilla コアハッカー育成計画(PDF)
Mozilla コアハッカー育成計画

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Approach and Philosophy of On baking technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Electronic commerce courselecture one. Pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25 Week I
Per capita expenditure prediction using model stacking based on satellite ima...
Approach and Philosophy of On baking technology
Digital-Transformation-Roadmap-for-Companies.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Reach Out and Touch Someone: Haptics and Empathic Computing
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The AUB Centre for AI in Media Proposal.docx
Electronic commerce courselecture one. Pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
Dropbox Q2 2025 Financial Results & Investor Presentation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Network Security Unit 5.pdf for BCA BBA.

スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化

  • 1. 5 SQLite Taro Matsuzawa aka. btm (@smellman) sumaben@kanto #11 Lightning Talk
  • 2. SQLite • iPhone SQL • • Firefox
  • 3. • JB • Blob
  • 4. sqlcipher • SQLite • SQLite • iPhone
  • 5. 1 $ sudo mkdir -p /opt/smartphone/lib $ sudo chown -R btm:staff /opt/smartphone $ cd /opt/smartphone/lib/ $ git clone git://github.com/sjlombardo/sqlcipher.git $ curl -O ftp://ftp.infoscience.co.jp/pub/Crypto/SSL/openssl/source/openssl-1.0.0a.tar.gz $ git clone git://github.com/sjlombardo/openssl-xcode.git $ tar zxf openssl-1.0.0a.tar.gz $ cp -fr openssl-xcode/openssl.xcodeproj openssl-1.0.0a/ $ mv openssl-1.0.0a openssl
  • 6. 2 • XCode • • SQLCIPHER_SRC SQLCipher • SQLCIPHER_SRC:/opt/smartphone/lib/sqlcipher • OPENSSL_SRC OpenSSL • OPENSSL_SRC:/opt/smartphone/lib/openssl
  • 7. 3 • XCode -> • OpenSSL openssl.xcodeproj • • SQLCipher sqlcipher.xcodeproj
  • 8. 4 • SQLCipher OpenSSL • sqlcipher.xcodeproj -> • SQLCIPHER_SRC • openssl.xcodeproj -> • OPENSSL_SRC
  • 9. 5 • XCode -> "SQLCipherTest" • + • OpenSSL crypto SQLCipher sqlcipher • • • $(SQLCIPHER_SRC) $(OPENSSL_SRC)
  • 10. 6 • sqlcipher.xcodeproj libsqlcipher.a • openssl.xcodeproj libcrypto.a • SQLITE_HAS_CODEC=1
  • 11. SQL • PRAGMA key = 'default_key'; • sqlcipher • • FMDatabase • FMDatabase setKey
  • 12. ! NSString* key = @"TaroMatsuzawaIsDead"; ! NSString* newKey = [key stringByAppendingString: [[UIDevice currentDevice] uniqueIdentifier]]; ! if (![rootViewController.encdb setKey:key]) ! ! NSLog(@"> Could not set key.");
  • 13. URL • sqlcipher • http://sqlcipher.net/ • sqlcipher document • http://sqlcipher.net/documentation • openssl-xcode • https://github.com/sjlombardo/openssl-xcode • FMDatabase • https://github.com/ccgus/fmdb
  • 14. • $ sudo port install openssl $ mkdir -p ~/develop/sqlcipher $ cd ~/develop/sqlcipher $ git clone git://github.com/sjlombardo/sqlcipher.git $ cd sqlcipher $ ./configure CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/opt/local/lib/libcrypto.a" $ make $ ~/develop/sqlcipher/sqlcipher/sqlite3 sqlite3.db SQLite version 3.7.2 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .read /Users/btm/develop/( )/schema.sql sqlite> PRAGMA key = 'default_key';