Challenge:
The following go code implements the ECDSA signatures but it has a devastating bug. To give you a small tip an adversary by exploiting the bug can write a code snippet to enforce the API to sign two arbitrary messages with the same private signing key. In reality that can happen by having an adversary obtaining signatures on different messages by the buggy backend signature library intercepting public traffic. Using only publicly available information (signatures and public keys) you can use it to extract the secret signing key and sign messages on your own!!! Can you find it ? The main code shows an example API on how to sign messages with the underlying ECDSA lib. You homework is to print out the secret key (not by copy pasting it) and verifying it is equal to the original one.
Hints :hand_with_index_and_middle_fingers_crossed:
Write in pensil and paper the equations in order to extract the nonce from the two signatures and then use that nonce $k$ to extract the secret key $x$ from the signature by identifying the bug in the code.
Apply in code the equations by issuing 2 signatures in arbitraty messages.
//based on https://arm-software.github.io/golang-utils/pkg/crypto/ecdsa.html
package main