@Test
  public void signLegacy_works() throws Exception {
    EcdsaParameters parameters =
        EcdsaParameters.builder()
            .setSignatureEncoding(EcdsaParameters.SignatureEncoding.IEEE_P1363)
            .setCurveType(EcdsaParameters.CurveType.NIST_P256)
            .setHashType(EcdsaParameters.HashType.SHA256)
            .setVariant(EcdsaParameters.Variant.LEGACY)
            .build();

    KeysetHandle handle = KeysetHandle.generateNew(parameters);
    PublicKeySign signer = handle.getPrimitive(PublicKeySign.class);

    PublicKeyVerify verifier =
        EcdsaVerifyJce.create((EcdsaPublicKey) handle.getPublicKeysetHandle().getAt(0).getKey());

    byte[] data = "data".getBytes(UTF_8);
    byte[] sig = signer.sign(data);

    verifier.verify(sig, data);
  }
We test all variants for legacy reasons.
java_src/src/test/java/com/google/crypto/tink/signature/PublicKeySignWrapperTest.java