title: ECDSA Signatures always return false on verification
body: <p>I have 3 test keys — RSA, DSA and ECDSA. The RSA and DSA key-based signatures return true when verified. But the ECDSA-based signature always returns false (even when the signatures match).</p>
  
  <p>The same code is used to verify all 3 test keys (apart from the differences in the provider object passed to <code>Signature.getInstance()</code>). My code is as follows:</p>
  
  <pre><code>Signature ecdsa = Signature.getInstance("SHA1withECDSA");
  ecdsa.initSign(pk);
  ecdsa.update(rawKeyBytes);
  byte[] signatureBytes = ecdsa.sign(); 
  
  Signature ecdsa3 = Signature.getInstance("SHA1WithECDSA");
  ecdsa3.initVerify(puk);  
  ecdsa3.update(rawKeyBytes);
  System.out.println("Verifying: "+ecdsa3.verify(signatureBytes));
  </code></pre>
  
  <p>The output of the program is always <code>Verifying: false</code>. When I change the provider to <code>SHA1WithRSA</code> and use an RSA key (using the same code above), the verification returns true, same with DSA-based keys. Someone mentioned it had something to do with the <code>ECPoint</code> passed to the <code>ECPublicKeySpec()</code> constructor, when trying to create a public key from the private key like this:</p>
  
  <pre><code>ECPrivateKey ec = (ECPrivateKey) privateKey;
  ECPublicKeySpec ecKeySpec = new ECPublicKeySpec(
      ec.getParams().getGenerator(),
      ec.getParams()
  );
  </code></pre>
  
  <p>Someone mentioned that signature verification (using the public key) would fail if a different <code>ECPoint</code> was used from the private key. But I actually get the <code>ECPoint</code> from the <code>PrivateKey</code> object (<code>ec</code>). Any solutions, please?</p>