0

i have a function transferWithData(address to, uint256 amount, bytes data) it basically transfer ERC20 token but it has an additional 'data' field, in order to inject a certificate generated off-chain by an issuer.

Certificate contains:

  1. The function ID which ensures the certificate can’t be used on an other function.
  2. parameters which ensures the input parameters have been validated by the issuer.
  3. validity date which ensures the certificate can’t be used after validity date.
  4. nonce which ensures the certificate can’t be used twice.

Finally the certificate is signed by the issuer and passed as parameter in the transferWithData function.

my question is that how to verify this certificate on chain. i am able to recover the issuer address using ecrecover. but i also need to validate the certificate content. I am following this repo https://github.com/NDAXlO/ERC1400/blob/master/contracts/mocks/CertificateControllerMock.sol thanks

4
  • Does this answer your question? How does one properly use ecrecover to verify Ethereum signatures? Feb 15, 2022 at 11:17
  • no brother, i am able to use the ecrecover to recover the certificate signer. but i need to validate the content of the message(certificate) which is signed by the signer(issuer) Feb 16, 2022 at 4:47
  • A signature couldn't be used for recovering the signed message because the message is hashed and that step isn't reversible. What you could do is to validate the signature, 1/ send the full message, 2/ hash the message, 3/ ecrecover to make sure is from the expected signer. If everything is correct then you could assume the message wasn't tempered. Falsifying the message would be equivalent to breaking the hashing algorithm keccak256.
    – Ismael
    Feb 16, 2022 at 14:06
  • thank you bro for reply. i was just trying to achieve the functionality for the function "_checkCertificate" in github.com/NDAXlO/ERC1400/blob/master/contracts/mocks/… Feb 18, 2022 at 5:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.