test_class.declarator: GOOGLE_SIGNING_EC_V2_PRIVATE_KEY_PKCS8_BASE64 =
        "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgKvEdSS8f0mjTCNKev"
            + "aKXIzfNC5b4A104gJWI9TsLIMqhRANCAAT/X7ccFVJt2/6Ps1oCt2AzKhIAz"
            + "jfJHJ3Op2DVPGh1LMD3oOPgxzUSIqujHG6dq9Ui93Eacl4VWJPMW/MVHHIL"
test_class.modifier: private static final
test_class.original_string: private static final String GOOGLE_SIGNING_EC_V2_PRIVATE_KEY_PKCS8_BASE64 =
        "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgKvEdSS8f0mjTCNKev"
            + "aKXIzfNC5b4A104gJWI9TsLIMqhRANCAAT/X7ccFVJt2/6Ps1oCt2AzKhIAz"
            + "jfJHJ3Op2DVPGh1LMD3oOPgxzUSIqujHG6dq9Ui93Eacl4VWJPMW/MVHHIL";
test_class.type: String
test_class.var_name: GOOGLE_SIGNING_EC_V2_PRIVATE_KEY_PKCS8_BASE64
test_class.declarator: GOOGLE_SIGNING_EC_V2_INTERMEDIATE_PUBLIC_KEY_X509_BASE64 =
        "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/1+3HBVSbdv+j7NaArdgMyoSAM43yR"
            + "ydzqdg1TxodSzA96Dj4Mc1EiKroxxunavVIvdxGnJeFViTzFvzFRxyCw=="
test_class.modifier: private static final
test_class.original_string: private static final String GOOGLE_SIGNING_EC_V2_INTERMEDIATE_PUBLIC_KEY_X509_BASE64 =
        "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/1+3HBVSbdv+j7NaArdgMyoSAM43yR"
            + "ydzqdg1TxodSzA96Dj4Mc1EiKroxxunavVIvdxGnJeFViTzFvzFRxyCw==";
test_class.type: String
test_class.var_name: GOOGLE_SIGNING_EC_V2_INTERMEDIATE_PUBLIC_KEY_X509_BASE64
test_class.file: apps/paymentmethodtoken/src/test/java/com/google/crypto/tink/apps/paymentmethodtoken/SenderIntermediateCertFactoryTest.java
test_class.identifier: SenderIntermediateCertFactoryTest
test_case.body: @Test
    public void shouldProduceSenderIntermediateCertJson() throws Exception {
      String encoded =
          new SenderIntermediateCertFactory.Builder()
              .protocolVersion(PaymentMethodTokenConstants.PROTOCOL_VERSION_EC_V2)
              .senderIntermediateSigningKey(GOOGLE_SIGNING_EC_V2_INTERMEDIATE_PUBLIC_KEY_X509_BASE64)
              .addSenderSigningKey(GOOGLE_SIGNING_EC_V2_PRIVATE_KEY_PKCS8_BASE64)
              .expiration(123456)
              .build()
              .create();
  
      JSONObject decodedSignedIntermediateSigningKey = new JSONObject(encoded);
      assertTrue(decodedSignedIntermediateSigningKey.get("signedKey") instanceof String);
      assertTrue(decodedSignedIntermediateSigningKey.get("signatures") instanceof JSONArray);
      assertEquals(2, decodedSignedIntermediateSigningKey.length());
      JSONObject signedKey =
          new JSONObject(decodedSignedIntermediateSigningKey.getString("signedKey"));
      assertTrue(signedKey.get("keyValue") instanceof String);
      assertTrue(signedKey.get("keyExpiration") instanceof String);
      assertEquals(2, signedKey.length());
      assertEquals(
          GOOGLE_SIGNING_EC_V2_INTERMEDIATE_PUBLIC_KEY_X509_BASE64, signedKey.getString("keyValue"));
      assertEquals("123456", signedKey.getString("keyExpiration"));
      assertEquals(1, decodedSignedIntermediateSigningKey.getJSONArray("signatures").length());
      assertNotEquals(
          0, decodedSignedIntermediateSigningKey.getJSONArray("signatures").getString(0).length());
    }
test_case.class_method_signature: SenderIntermediateCertFactoryTest.shouldProduceSenderIntermediateCertJson()
test_case.full_signature: @Test public void shouldProduceSenderIntermediateCertJson()
test_case.identifier: shouldProduceSenderIntermediateCertJson
test_case.invocations: create build expiration addSenderSigningKey senderIntermediateSigningKey protocolVersion assertTrue get assertTrue get assertEquals length getString assertTrue get assertTrue get assertEquals length assertEquals getString assertEquals getString assertEquals length getJSONArray assertNotEquals length getString getJSONArray
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldProduceSenderIntermediateCertJson()
focal_class.declarator: signers
focal_class.modifier: private final
focal_class.original_string: private final List<PublicKeySign> signers;
focal_class.type: List<PublicKeySign>
focal_class.var_name: signers
focal_class.declarator: intermediateSigningKey
focal_class.modifier: private final
focal_class.original_string: private final String intermediateSigningKey;
focal_class.type: String
focal_class.var_name: intermediateSigningKey
focal_class.declarator: protocolVersion
focal_class.modifier: private final
focal_class.original_string: private final String protocolVersion;
focal_class.type: String
focal_class.var_name: protocolVersion
focal_class.declarator: senderId
focal_class.modifier: private final
focal_class.original_string: private final String senderId;
focal_class.type: String
focal_class.var_name: senderId
focal_class.declarator: expiration
focal_class.modifier: private final
focal_class.original_string: private final long expiration;
focal_class.type: long
focal_class.var_name: expiration
focal_class.file: apps/paymentmethodtoken/src/main/java/com/google/crypto/tink/apps/paymentmethodtoken/SenderIntermediateCertFactory.java
focal_class.identifier: SenderIntermediateCertFactory
focal_class.class_method_signature: SenderIntermediateCertFactory.SenderIntermediateCertFactory(
        String protocolVersion,
        String senderId,
        List<ECPrivateKey> senderSigningKeys,
        String intermediateSigningKey,
        long expiration)
focal_class.full_signature: private  SenderIntermediateCertFactory(
        String protocolVersion,
        String senderId,
        List<ECPrivateKey> senderSigningKeys,
        String intermediateSigningKey,
        long expiration)
focal_class.identifier: SenderIntermediateCertFactory
focal_class.modifiers: private
focal_class.parameters: (
        String protocolVersion,
        String senderId,
        List<ECPrivateKey> senderSigningKeys,
        String intermediateSigningKey,
        long expiration)
focal_class.signature:  SenderIntermediateCertFactory(
        String protocolVersion,
        String senderId,
        List<ECPrivateKey> senderSigningKeys,
        String intermediateSigningKey,
        long expiration)
focal_class.class_method_signature: SenderIntermediateCertFactory.create()
focal_class.full_signature: public String create()
focal_class.identifier: create
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String create()
focal_method.body: public String create() throws GeneralSecurityException {
      try {
        String signedKey =
            new JSONObject()
                .put(PaymentMethodTokenConstants.JSON_KEY_VALUE_KEY, intermediateSigningKey)
                .put(PaymentMethodTokenConstants.JSON_KEY_EXPIRATION_KEY, Long.toString(expiration))
                .toString();
        byte[] toSignBytes =
            PaymentMethodTokenUtil.toLengthValue(
                // The order of the parameters matters.
                senderId, protocolVersion, signedKey);
        JSONArray signatures = new JSONArray();
        for (PublicKeySign signer : signers) {
          byte[] signature = signer.sign(toSignBytes);
          signatures.put(Base64.encode(signature));
        }
        return new JSONObject()
            .put(PaymentMethodTokenConstants.JSON_SIGNED_KEY_KEY, signedKey)
            .put(PaymentMethodTokenConstants.JSON_SIGNATURES_KEY, signatures)
            .toString();
      } catch (JSONException e) {
        throw new RuntimeException("Failed to perform JSON encoding", e);
      }
    }
focal_method.class_method_signature: SenderIntermediateCertFactory.create()
focal_method.full_signature: public String create()
focal_method.identifier: create
focal_method.invocations: toString put put toString toLengthValue sign put encode toString put put
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: String
focal_method.signature: String create()