title: java.security.InvalidAlgorithmParameterException on Java 8 but works on Java 11
body: <p>So let's assume you want to verify a signature using a public key that uses ECDSA algorithm with brainpoolP256r1 elliptic curve.</p>
  <p>For running the code below, follows these steps:</p>
  <ol>
  <li>generate a keypair of brainpool using these commands:</li>
  </ol>
  <pre><code>openssl ecparam -name brainpoolP256r1 -genkey -noout -out ec-brainpoolP256r1-priv-key.pem
  openssl ec -in ec-brainpoolP256r1-priv-key.pem -pubout &gt; ec-brainpoolP256r1-pub-key.pem
  openssl pkcs8 -topk8 -nocrypt -in ec-brainpoolP256r1-priv-key.pem -out ec-brainpoolP256r1-priv-key-pkcs8.pem (to read it with tomitribe PEM utility, we need the PKCS8 format)
  </code></pre>
  <ol start="2">
  <li>Run the following code after using your generated keys:</li>
  </ol>
  <pre><code>package com.test.ecdsa;
  
  import org.tomitribe.auth.signatures.PEM;
  
  import java.io.ByteArrayInputStream;
  import java.nio.charset.StandardCharsets;
  import java.security.PrivateKey;
  import java.security.PublicKey;
  import java.security.Signature;
  
  public class Main {
      public static void main(String[] args) throws Exception {
          String privateKeyPem = &quot;[use here the content from ec-brainpoolP256r1-priv-key-pkcs8.pem]&quot;;
  
          Signature signer = Signature.getInstance(&quot;SHA256withECDSA&quot;);
          PrivateKey privateKey = PEM.readPrivateKey(new ByteArrayInputStream(privateKeyPem.getBytes(StandardCharsets.UTF_8)));
  
          signer.initSign(privateKey);
          signer.update(&quot;testMessage&quot;.getBytes(StandardCharsets.UTF_8));
          byte[] signature = signer.sign();
  
          String publicKeyPem = &quot;[use here the content from ec-brainpoolP256r1-pub-key.pem]&quot;;
  
          PublicKey publicKey = PEM.readPublicKey(new ByteArrayInputStream(publicKeyPem.getBytes(StandardCharsets.UTF_8)));
          Signature signatureVerifier = Signature.getInstance(&quot;SHA256withECDSA&quot;);
          signatureVerifier.initVerify(publicKey);
          signatureVerifier.update(&quot;testMessage&quot;.getBytes(StandardCharsets.UTF_8));
  
          boolean result = signatureVerifier.verify(signature);
  
          System.out.println(result);
      }
  }
  
  </code></pre>
  <p>Running this code on java 8 will lead to:</p>
  <pre><code>Exception in thread &quot;main&quot; java.security.SignatureException: Could not sign data
      at sun.security.ec.ECDSASignature.signDigestNative(ECDSASignature.java:367)
      at sun.security.ec.ECDSASignature.engineSign(ECDSASignature.java:386)
      at java.security.Signature$Delegate.engineSign(Signature.java:1382)
      at java.security.Signature.sign(Signature.java:698)
      at com.ing.obp.jws.lib.Main.main(Main.java:29)
  Caused by: java.security.InvalidAlgorithmParameterException
      at sun.security.ec.ECDSASignature.signDigest(Native Method)
      at sun.security.ec.ECDSASignature.signDigestNative(ECDSASignature.java:364)
      ... 4 more
  </code></pre>
  <p>Using java 11 the console will print &quot;true&quot;.</p>
  <p>Why is that?</p>