Questions tagged [apple-cryptokit]

52 questions
13
votes
1 answer

CryptoKit craches app on phones with iOS version below 13

I've just started using CryptoKit to replace an old library. My plan was to replace it on phones running iOS 13 and above, and still use the old library on iOS versions below 13. However I can't get the app to even start in iOS 12.4 without…
Sebastian
  • 333
  • 1
  • 3
  • 13
10
votes
1 answer

Unknown 116-byte ECDSA private key format

iOS 13's CryptoKit framework provides a .rawRepresentation value for ECDSA public and private keys. I've been trying to reverse-engineer the rawRepresentation data type to convert between it and JWK. Judging by the 64-byte length of the public key…
Potassium Ion
  • 2,075
  • 1
  • 22
  • 39
8
votes
1 answer

Cross platform AES Encryption between iOS and Kotlin/Java using Apples CryptoKit

I want to send encrypted data form a server running a kotlin application to an iOS App using Apples CryptoKit. I have problems to initialize a AES.GCM.SealedBox and decrypt the data. In general I don't understand what Sealboxstag is for. So first…
HansDeBeer
  • 197
  • 2
  • 10
8
votes
1 answer

iOS CryptoKit in Java

I am looking for settings/parameters of CryptoKit which will allow me to share data between iOS App and a Java Application. The flow would be something like below: - Use CryptoKit to encrypt a text using a fixed key and random initialization vector…
Amit Bajaj
  • 171
  • 1
  • 10
7
votes
1 answer

Apple, iOS 13, CryptoKit, Secure Enclave - Enforce biometric authentication ahead of private key usage

I am working with Apple's new cryptokit library and am trying to get a basic use case to work. Goal: I would like to create a private key in the secure enclave via the cryptokit, store the key's reference in the iOS device's key chain and ensure…
Robin
  • 1,208
  • 8
  • 17
6
votes
0 answers

How to access the code of a HashedAuthenticationCode (as a String)?

Given the following HashedAuthenticationCode: import CryptoKit let key = SymmetricKey(size: .bits256) let message = "Hello world!".data(using: .utf8)! let authenticationCode = HMAC.authenticationCode(for: message, using:…
Noel
  • 2,061
  • 4
  • 31
  • 47
6
votes
4 answers

How do I access the underlying key of a SymmetricKey in CryptoKit?

I am messing about with Apple's new CryptoKit framework on Xcode 11.0 beta 2. I want to create a SymmetricKey, then obtain the raw bytes of the key. I would like to use those bytes to create the same key, then check to make sure the keys are equal.…
Eugene
  • 3,417
  • 5
  • 25
  • 49
5
votes
1 answer

swift CryptoKit on Ubuntu

I am trying to compile a small swift program, "main.swift" to an executable on Ubuntu 18.08. I use the Swift Package Manager to manage my dependencies. In this very simple case I only have one dependency, namely this open-source CryptoKit. I have…
Whir
  • 305
  • 3
  • 16
5
votes
0 answers

Open chachapoly sealed box after removing and recreating a symmetric key (iOS)?

I am in a bit of a roadblock on my iOS app (first app for me), I want to encrypt data that I send to a server. In order to do so I generate a symmetric key that I store in the keychain. The key is generated in the following way: SymmetricKey(data:…
Sir Sirae
  • 51
  • 2
4
votes
2 answers

SHA-256 of large file using CryptoKit

Does anyone know a way to calculate de SHA-256 hash of a file without having to load the entire file on memory? I would be ideal to use apple's CryptoKit library
Santiago Alvarez
  • 167
  • 1
  • 12
3
votes
1 answer

P384 Public Key getting "IncorrectParameterSize"

I am working on the ECDSA Algorithm where i am taking signature from the APIs and i have one local public key inside constant file. Below is my code when i am trying to run this and verify the signature then i am getting error in this link let…
Mayank Patel
  • 3,868
  • 10
  • 36
  • 59
3
votes
1 answer

CryptoKit authenticationFailure when try decrypt

I'm trying to decrypt payload using SymmetricKey. I've tried ChaChaPoly and AES.GCM to open sealedBox but I'm still getting CryptoKit.CryptoKitError.authenticationFailure here is my implementation: let iv: [UInt8] = [0x00, 0x01, 0x02, 0x03, …
Gorthez
  • 391
  • 3
  • 12
3
votes
1 answer

HMAC update on CryptoKit

I'm new to CryptoKit, and I'm struggling to translate this code from Node.js to Swift (using CryptoKit). // create a sha256 hmac with the secret var hmac = crypto.createHmac('sha256', key); return hmac.update(what).digest('base64'); What I'm doing…
Pataquer
  • 283
  • 1
  • 14
3
votes
0 answers

How to decrypt Swift CryptoKit chacha20-poly1305 cipher in JavaScript?

I encrypted a string in swift using CryptoKit's ChaChaPoly: // Swift let txt: Data? = "secret message".data(using: .utf8) let key = SymmetricKey(data: SHA256.hash(data: "password".data(using: .utf8)!)) let sealedBoxData = try!…
user2779114
  • 51
  • 1
  • 6
3
votes
2 answers

Testing CryptoKit's data validation

I want to verify some downloaded data is unmodified. My expectation is that if I modify the original data, the signature would fail. While this is true in some cases (data2) it's surprisingly not working in others (data3). Using hashes/Digest…
1
2 3 4