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

WIP: UBSecureStorage #27

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

WIP: UBSecureStorage #27

wants to merge 5 commits into from

Conversation

stmitt
Copy link
Collaborator

@stmitt stmitt commented Jun 7, 2022

UBSecureStorage is a drop in replacement for the iOS Keychain. Instead of saving each value individually on the keychain only the key is stored there. The actual encrypted data is stored in the documents directory

UBSecureStorage is a drop in replacement for the iOS Keychain. Instead of saving each value individually on the keychain only the key is stored there. The actual encrypted data is stored in the documents directory
@github-actions
Copy link

github-actions bot commented Jun 7, 2022

Unit Test Results

    1 files  ±0      3 suites  ±0   2m 20s ⏱️ +15s
166 tests +1  166 ✔️ +1  0 💤 ±0  0 ❌ ±0 

Results for commit 96946ae. ± Comparison against base commit 98b7079.

♻️ This comment has been updated with latest results.

var error: Unmanaged<CFError>?
guard
let access =
SecAccessControlCreateWithFlags(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

option für secure enclave mit FaceID?

import Foundation

@available(iOS 11.0, *)
public class UBEnclave: UBEnclaveProtocol {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

eher key provider


self.logger = UBLogging.frameworkLoggerFactory(category: "UBSecureStorage[\(fileName)]")

let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
Copy link
Collaborator Author

@stmitt stmitt Jun 10, 2022

Choose a reason for hiding this comment

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

backup flag, file protection

private func loadDict() -> Result<[String: Data], UBSecureStorageError> {
dispatchPrecondition(condition: .onQueue(queue))

guard FileManager.default.fileExists(atPath: filePath.path) else {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

file protection check

}

let key: SecKey
switch loadOrGenerateKey() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hier sollte der key nie generiert werden, das file wurde ja schon geschrieben

return .failure(.enclaveError(error))
}

switch enclave.verify(data: wrapper.encrypedData, signature: wrapper.signature, with: key) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

verify ist nicht notwenig (nicht security relevant)

}

let key: SecKey
switch loadOrGenerateKey() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nur generieren wenn file nicht existiert!

case let .success(value):
return value
case .failure:
return defaultValue
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fallback auf default value ist bei vielen fehler nicht cool

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nur bei notFound ok

@stmitt
Copy link
Collaborator Author

stmitt commented Jun 10, 2022

  • Unit Tests, Profiling mit performance
  • Unit Tests
  • async api

@sonarcloud
Copy link

sonarcloud bot commented Aug 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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.

None yet

1 participant