Code Monkey home page Code Monkey logo

Comments (6)

klikooo avatar klikooo commented on June 12, 2024

secp256k1_ecdsa_verify() (defined in include/secp256k1.h, line 381) is the verify function, see the comment in the header file.

The function secp256k1_ecdsa_verify() is used in keys/pubkey.cpp, secp256k1/src/bench_verify.c and a test file. In keys/pubkey.cpp the function CPubKey::Verify uses the secp256k1 verify function. This might be altered to a brainpool verify function.

The Verify function of the class CPubKey is used in the class TransactionSignatureChecker in function VerifySignature in the file script/interpreter.cpp, which are thus reasons to believe that this is indeed correct. Notice that the Verify function is also used in structs/alert.cpp, protocol/handshake.cpp, protocol/multichainblock.cpp, core/init.cpp and keys/key.cpp.

from polling-station-app.

klikooo avatar klikooo commented on June 12, 2024

A public key is stored in the class CPubKey. This class is defined in pubkey.h and implemented in pubkey.cpp. The class, contains a private variable called vch, which represents the public key and is a array of chars of length 65. This must be altered to at least 80 bytes for passports produced after 9 March 2014, and might even needs to be bigger for passports prior 9 March 2014. Note that the passport produced prior 9 March 2014 might use a different curve than BrainpoolP320r1, see this, page 11.

The static method GetLen() calculates the length of the public key by looking at the first byte. In sep256k1 curves, public keys can have different lengths. We need to alter GetLen() so it returns the brainpoolP320r1 public key size. Don't know if we can look at first byte and determine the size of the public key.

The Verify() function expects two arguments: a hash and a DER signature. The hash is probably a sha256 hash. In a comment double SHA-256 is mentioned.

Besides this, we might need to alter key.c, which holds a private key. This because of the genesis block?

from polling-station-app.

landgenoot avatar landgenoot commented on June 12, 2024

Small script to verify a passport active authentication signature using crypto++:

https://gist.github.com/landgenoot/6f9a58876ea0f03a48b9485159ad7869

from polling-station-app.

klikooo avatar klikooo commented on June 12, 2024

Seems that vchDefaultKey, in the file wallet/wallet.cpp line 3435, is not fully valid in pubkey-use-brainpool branch, opposite in what happens in the master branch where vchDefaultKey is fully valid. Looking in to this now

from polling-station-app.

klikooo avatar klikooo commented on June 12, 2024

Signing and verifying now works with brainpoolP320r1. The hash to be signed is also split up in four different parts and are signed/verified separate. Next step is to clean up the code and create a transaction from a passport.

from polling-station-app.

klikooo avatar klikooo commented on June 12, 2024

See pr digital-voting-pass/e-passport-chain#2

from polling-station-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.