bmwcarit / MoCOCrW

(mo)dern (c)++ (o)penssl (cr)ypto (w)rapper library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ECIES encryption algorithm parameters

dima91 opened this issue · comments

commented

Hello,
I have to use ECIES encyrption scheme to implement this communications scheme, but for me is hard to understand which parameters I must use in ECIESCtxBuilder class to create ECIESEncryptionCtx and ECIESDecryptionCtx classes.
Can you help me?

You will have to implement some additional features that we do not provide in this library to implement this scheme:

  1. We do not currently implement AES-CCM (see https://github.com/bmwcarit/MoCOCrW/blob/openssl1.1/src/mococrw/symmetric_crypto.h#L34-L39)
  2. You need to implement the mococrw::KeyDerivationFunction (see src/mococrw/kdf.h) interface for SHA256(S || counter)
  3. You need to implement SymmetricCipherI (see https://github.com/bmwcarit/MoCOCrW/blob/openssl1.1/src/mococrw/symmetric_crypto.h#L96) for E(m, k) = m ⊕ k.

Once you have those, you should be able to implement this algorithm using our abstraction by using

ECIESCtxBuilder()
  .setKDF(your_sha256_kdf)
  .setSymmetricCipherFactoryFunction([](const std::vector<uint8_t> &key) -> std::unique_ptr<XORCipher> {
    return XORCipherBuilder().setKey(key).buildEncryptor(); // or buildDecryptor(), but that'll be the same for XOR anyway
  })