Closed MatteoCultrera closed 2 months ago
I'm looking into it. Do you use Swift version 5.10 and did your example work in version 5.9?
Currently I'm using version 5.9.2 (also on the example) and it does not work in that version sadly Tried also on swift4 but didn't worked as well
The CryptoKit Compatibility article in the documentation explains how to convert CryptoKit keys to SwiftHPKE keys and vice versa. This description is valid.
However, I never tried to seal a message with CryptoKit and open it with SwiftHPKE or seal a message with SwiftHPKE and open it with CryptoKit.
We can see that it doesn't work and I can't explain why that is so.
I will try to look further into the matter.
Thank you so much. Sadly I don't have a lot of expertise on the topic so I was not able to find the root cause of this. I tried a bunch of things (encoding with SwiftHPKE and decoding with apple library, using keys from one library to another and even not using authenticated mode but sadly the result is the same) I don't know if there could be something happening with the conversione between data and bytes (even though should not be the case) or the fact that I used strings instead of array of UInt8
I tried to modify your example to use kem: .P256_HKDF_SHA256, kdf: .HKDF_SHA256, aead: .AES_GCM_256 and guess what: It works.
I also tried to use kem: .P521_HKDF_SHA512, kdf: .HKDF_SHA512, aead: .AES_GCM_256 and it also works.
I will try to investigate what's wrong with the 384 version
I believe I found the error: A stupid copy-paste error somewhere in the code. I will publish a new release next week, where the error is corrected. Thanks, for detecting the error.
Thank you for quickly reacting to it 🙏
Fixed in release 2.5.0
Fixed in release 2.5.0
I was testing the repository to check compatibility with the new apple implementation of
HPKE
but seems is not compatible. When running this MVEIn this example I've created two pair of keys, converted them fo use this library following the documentation and tried to encrypt a simple message with the new Apple API. When decoding it using this library, an error is thrown
Thread 1: Fatal error: 'try!' expression unexpectedly raised an error: CryptoKit.CryptoKitError.authenticationFailure