@Test
  public void serializeParseKey_simple() throws Exception {
    AesCtrHmacStreamingParameters parameters =
        AesCtrHmacStreamingParameters.builder()
            .setKeySizeBytes(37)
            .setDerivedKeySizeBytes(32)
            .setHkdfHashType(AesCtrHmacStreamingParameters.HashType.SHA256)
            .setCiphertextSegmentSizeBytes(1024 * 1024)
            .setHmacHashType(AesCtrHmacStreamingParameters.HashType.SHA1)
            .setHmacTagSizeBytes(16)
            .build();

    AesCtrHmacStreamingKey key = AesCtrHmacStreamingKey.create(parameters, KEY_BYTES_37);

    com.google.crypto.tink.proto.AesCtrHmacStreamingKey protoKey =
        com.google.crypto.tink.proto.AesCtrHmacStreamingKey.newBuilder()
            .setVersion(0)
            .setKeyValue(KEY_BYTES_37_AS_BYTE_STRING)
            .setParams(
                com.google.crypto.tink.proto.AesCtrHmacStreamingParams.newBuilder()
                    .setCiphertextSegmentSize(1024 * 1024)
                    .setDerivedKeySize(32)
                    .setHkdfHashType(HashType.SHA256)
                    .setHmacParams(HmacParams.newBuilder().setHash(HashType.SHA1).setTagSize(16)))
            .build();

    ProtoKeySerialization serialization =
        ProtoKeySerialization.create(
            "type.googleapis.com/google.crypto.tink.AesCtrHmacStreamingKey",
            protoKey.toByteString(),
            KeyMaterialType.SYMMETRIC,
            OutputPrefixType.RAW,
            /* idRequirement= */ null);

    ProtoKeySerialization serialized =
        registry.serializeKey(key, ProtoKeySerialization.class, InsecureSecretKeyAccess.get());
    assertEqualWhenValueParsed(
        com.google.crypto.tink.proto.AesCtrHmacStreamingKey.parser(), serialized, serialization);

    Key parsed = registry.parseKey(serialization, InsecureSecretKeyAccess.get());
    assertThat(parsed.equalsKey(key)).isTrue();
  }
Test that if "OutputPrefixType" is set to CRUNCHY, we just ignore it.
java_src/src/test/java/com/google/crypto/tink/streamingaead/internal/AesCtrHmacStreamingProtoSerializationTest.java