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

ECDH keys not working very well on sync #25

Open
notasecret opened this issue May 26, 2020 · 0 comments
Open

ECDH keys not working very well on sync #25

notasecret opened this issue May 26, 2020 · 0 comments
Assignees

Comments

@notasecret
Copy link
Collaborator

notasecret commented May 26, 2020

To repro:
Switch test org to use ECDH 256,

Then run sync test,

Note that this error happens:

Test Case '-[Peacemakr_iOS_Tests.SDKIntegrationTests testEncryptDecrypt]' started.
Test Org API Key:  Btc+XtUWde6/fWhJPFTN3nch+8+B5ADhi88HN4BTCcA= nil
Test Case '-[Peacemakr_iOS_Tests.SDKIntegrationTests testEncryptDecrypt]' passed (170.804 seconds).
Test Case '-[Peacemakr_iOS_Tests.SDKIntegrationTests testRegister]' started.
Test Org API Key:  Btc+XtUWde6/fWhJPFTN3nch+8+B5ADhi88HN4BTCcA= nil
no error
Test Case '-[Peacemakr_iOS_Tests.SDKIntegrationTests testRegister]' passed (0.711 seconds).
Test Case '-[Peacemakr_iOS_Tests.SDKIntegrationTests testSync]' started.
Test Org API Key:  Btc+XtUWde6/fWhJPFTN3nch+8+B5ADhi88HN4BTCcA= nil
no error
symmetric_decrypt: 197 - error:00000000:lib(0):func(0):reason(0)

When running this blob:

          // If ECDH then do the keygen
          var decryptKey: PeacemakrKey
          if myPrivKey.getConfig().asymmCipher.rawValue >= AsymmetricCipher.ECDH_P256.rawValue {
            guard let ecdhKey = PeacemakrKey(symmCipher: deserializedCfg.1.symmCipher, myKey: myPrivKey, peerKey: pKey!) else {
              Logger.error("Unable to perform ECDH Keygen")
              completion(NSError(domain: "Unable to perform ECDH Keygen", code: -12, userInfo: nil))
              return
            }
            decryptKey = ecdhKey
          } else {
            decryptKey = myPrivKey
          }

And then the key failed to decrypt the downloaded ciphertext of the delivered keys for a sync. Or maybe no client key updates work.

Happens only after loading Simulator with one set of keys, and switching the client config from RSA -> ECDH.

@notasecret notasecret self-assigned this May 26, 2020
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

No branches or pull requests

1 participant