test_class.file: java_src/src/test/java/com/google/crypto/tink/subtle/EcdsaSignJceTest.java
test_class.identifier: EcdsaSignJceTest
test_case.body: @Test
    public void testBasic() throws Exception {
      ECParameterSpec ecParams = EllipticCurves.getNistP256Params();
      KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC");
      keyGen.initialize(ecParams);
      KeyPair keyPair = keyGen.generateKeyPair();
      ECPublicKey pub = (ECPublicKey) keyPair.getPublic();
      ECPrivateKey priv = (ECPrivateKey) keyPair.getPrivate();
  
      // Sign with EcdsaSign.
      String message = "Hello";
      EcdsaSignJce signer = new EcdsaSignJce(priv, HashType.SHA256, EcdsaEncoding.DER);
      byte[] signature = signer.sign(message.getBytes("UTF-8"));
  
      // Verify with JCE's Signature.
      Signature verifier = Signature.getInstance("SHA256WithECDSA");
      verifier.initVerify(pub);
      verifier.update(message.getBytes("UTF-8"));
      assertTrue(verifier.verify(signature));
    }
test_case.class_method_signature: EcdsaSignJceTest.testBasic()
test_case.full_signature: @Test public void testBasic()
test_case.identifier: testBasic
test_case.invocations: getNistP256Params getInstance initialize generateKeyPair getPublic getPrivate sign getBytes getInstance initVerify update getBytes assertTrue verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBasic()
focal_class.declarator: privateKey
focal_class.modifier: private final
focal_class.original_string: private final ECPrivateKey privateKey;
focal_class.type: ECPrivateKey
focal_class.var_name: privateKey
focal_class.declarator: signatureAlgorithm
focal_class.modifier: private final
focal_class.original_string: private final String signatureAlgorithm;
focal_class.type: String
focal_class.var_name: signatureAlgorithm
focal_class.declarator: encoding
focal_class.modifier: private final
focal_class.original_string: private final EcdsaEncoding encoding;
focal_class.type: EcdsaEncoding
focal_class.var_name: encoding
focal_class.file: java_src/src/main/java/com/google/crypto/tink/subtle/EcdsaSignJce.java
focal_class.identifier: EcdsaSignJce
focal_class.interfaces: implements PublicKeySign
focal_class.class_method_signature: EcdsaSignJce.EcdsaSignJce(final ECPrivateKey priv, HashType hash, EcdsaEncoding encoding)
focal_class.full_signature: public  EcdsaSignJce(final ECPrivateKey priv, HashType hash, EcdsaEncoding encoding)
focal_class.identifier: EcdsaSignJce
focal_class.modifiers: public
focal_class.parameters: (final ECPrivateKey priv, HashType hash, EcdsaEncoding encoding)
focal_class.signature:  EcdsaSignJce(final ECPrivateKey priv, HashType hash, EcdsaEncoding encoding)
focal_class.class_method_signature: EcdsaSignJce.sign(final byte[] data)
focal_class.full_signature: @Override public byte[] sign(final byte[] data)
focal_class.identifier: sign
focal_class.modifiers: @Override public
focal_class.parameters: (final byte[] data)
focal_class.return: byte[]
focal_class.signature: byte[] sign(final byte[] data)
focal_method.body: @Override
    public byte[] sign(final byte[] data) throws GeneralSecurityException {
      Signature signer = EngineFactory.SIGNATURE.getInstance(signatureAlgorithm);
      signer.initSign(privateKey);
      signer.update(data);
      byte[] signature = signer.sign();
      if (encoding == EcdsaEncoding.IEEE_P1363) {
        EllipticCurve curve = privateKey.getParams().getCurve();
        signature =
            EllipticCurves.ecdsaDer2Ieee(signature, 2 * EllipticCurves.fieldSizeInBytes(curve));
      }
      return signature;
    }
focal_method.class_method_signature: EcdsaSignJce.sign(final byte[] data)
focal_method.full_signature: @Override public byte[] sign(final byte[] data)
focal_method.identifier: sign
focal_method.invocations: getInstance initSign update sign getCurve getParams ecdsaDer2Ieee fieldSizeInBytes
focal_method.modifiers: @Override public
focal_method.parameters: (final byte[] data)
focal_method.return: byte[]
focal_method.signature: byte[] sign(final byte[] data)