title: ECDSA Not Signing/Verifying Correctly
body: <p>I am currently having trouble signing/verifying a string with Crypto++. I have tried methods listed on this website among others, for months, with no success. I have previously tried the C style solution posted here: <a href="http://www.cryptopp.com/wiki/Elliptic_Curve_Digital_Signature_Algorithm" rel="nofollow noreferrer">http://www.cryptopp.com/wiki/Elliptic_Curve_Digital_Signature_Algorithm</a>, but am currently working on the implementation using filters.</p>
  
  <p>My attempt below is a modification of the solution posted here: <a href="https://stackoverflow.com/questions/21024399/get-ecdsa-signature-with-crypto">Get ECDSA signature with Crypto++</a>.</p>
  
  <p>The following code outputs the error:
  <code>ERROR: VerifierFilter: digital signature not valid</code></p>
  
  <pre><code>ECDSA&lt;ECP, SHA256&gt;::PrivateKey privateKey;
  ECDSA&lt;ECP, SHA256&gt;::PublicKey publicKey;
  
  AutoSeededRandomPool prng, rrng;
  
  privateKey.Initialize(prng, CryptoPP::ASN1::secp256k1());
  
  privateKey.MakePublicKey(publicKey);
  
  string signature;
  
  signature.erase();
  
  string message = "Do or do not. There is no try.";
  
  StringSource(message, true,
       new SignerFilter(rrng,
       ECDSA&lt;ECP, SHA256&gt;::Signer(privateKey),
       new StringSink(signature)));
  
   try
   {
       StringSource(signature + message, true,
           new SignatureVerificationFilter(
           ECDSA&lt;ECP, SHA256&gt;::Verifier(publicKey), NULL,
           SignatureVerificationFilter::THROW_EXCEPTION
           ) // SignatureVerificationFilter   
           ); // StringSource 
   }
   catch (CryptoPP::Exception&amp; e)
   {
       std::cerr &lt;&lt; "\n\nERROR: " &lt;&lt; e.what() &lt;&lt; std::endl;
   }
  </code></pre>
  
  <p>Any help is appreciated, thanks.</p>