Upgrade to Pro — share decks privately, control downloads, hide ads and more …

個人情報を扱うアプリと暗号化について

dotrikun
September 16, 2017

 個人情報を扱うアプリと暗号化について

iOSDC2017トーク

dotrikun

September 16, 2017
Tweet

More Decks by dotrikun

Other Decks in Technology

Transcript

  1. • ࢯ໊ • ϝʔϧΞυϨε • ೥ྸ • ੑผ • ॅॴ

    • ి࿩൪߸ • إࣸਅೖΓͷΞΠίϯը૾ • Ґஔ৘ใ ~ͳͲͷ૊Έ߹Θͤ
  2. ϩʔΧϧʹอଘ͢ΔϑΝΠϧʹ͍ͭͯ - ϑΝΠϧ࡞੒ ϑΝΠϧอޢͷछྨ extension FileProtectionType { @available(iOS 4.0, *)

    public static let none: FileProtectionType @available(iOS 4.0, *) public static let complete: FileProtectionType @available(iOS 5.0, *) public static let completeUnlessOpen: FileProtectionType @available(iOS 5.0, *) public static let completeUntilFirstUserAuthentication: FileProtectionType } // ϑΝΠϧอޢͳ͠ // ୺຤ͷϩοΫ࣌ʹ҉߸Խ // ʢϑΝΠϧΛopenͨ͠ঢ়ଶͷ৔߹Λআ͖ʣ୺຤ͷϩοΫ࣌ʹ҉߸Խ // ୺຤ͷϩοΫ͔࣌ΒϢʔβ͕ϩοΫղআ͢Δ·Ͱ҉߸Խ
  3. ϩʔΧϧʹอଘ͢ΔϑΝΠϧʹ͍ͭͯ - ϑΝΠϧ࡞੒ iOS 7Ҏ߱ɺΞϓϦͷϑΝΠϧ࡞੒࣌ͷσϑΥϧτ͸҉߸Խ͕ઃఆ͞ Ε͍ͯΔ try FileManager.default.createFile(atPath: filePath, contents:

    nil, attributes: nil) __C.FileAttributeKey(_rawValue: NSFileProtectionKey): NSFileProtectionCompleteUntilFirstUserAuthentication ʢϑΝΠϧ࡞੒ʣ ʢϩάͰϑΝΠϧଐੑΛ֬ೝʣ
  4. ϩʔΧϧʹอଘ͢ΔϑΝΠϧʹ͍ͭͯ - Data Protection Data ProtectionΛ༗ޮʹͯ͠ϑΝΠϧΛ࡞੒͢ΔͱσϑΥϧτ͕มΘ Δ try FileManager.default.createFile(atPath: filePath,

    contents: nil, attributes: nil) __C.FileAttributeKey(_rawValue: NSFileProtectionKey): NSFileProtectionComplete ʢϑΝΠϧ࡞੒ʣ ʢϩάͰϑΝΠϧଐੑΛ֬ೝʣ
  5. ϩʔΧϧʹอଘ͢Δσʔλ • KeyChainαʔϏε ‣ σʔλΛOSʹ༬͔ͬͯ΋Β͑Δ ‣ ಉ͡σϕϩούͷ App ؒͰ͋Ε͹ڞ༗Ͱ͖Δ ‣

    ΞϓϦΛΞϯΠϯετʔϧͯ͠΋ফ͑ͳ͍ ‣ େ͖ͳαΠζͷσʔλ͸ѻ͑ͳ͍ • UserDefaults ‣ ࣮ࡍ͸plistʹอଘ͞Ε͍ͯΔͷͰϑΝΠϧͱಉ͡
  6. ϩʔΧϧʹอଘ͢Δσʔλ- Database - • CoreData ‣ ϑΝΠϧͷ҉߸Խ • Realm ‣

    ҉߸Խػೳ͕͋Δ • FMDB/SQLite ‣ SQLCipherʢϥΠϒϥϦʣͰ҉߸Խ