private static ProtoKeySerialization[] createInvalidKeySerializations() {
    try {
      com.google.crypto.tink.proto.AesCtrHmacStreamingKey validKey =
          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();

      return new ProtoKeySerialization[] {
        // Wrong version
        ProtoKeySerialization.create(
            "type.googleapis.com/google.crypto.tink.AesCtrHmacStreamingKey",
            validKey.toBuilder().setVersion(1).build().toByteString(),
            KeyMaterialType.SYMMETRIC,
            OutputPrefixType.RAW,
            /* idRequirement= */ null),
        // Wrong Hash type
        ProtoKeySerialization.create(
            "type.googleapis.com/google.crypto.tink.AesCtrHmacStreamingKey",
            validKey.toBuilder()
                .setParams(validKey.getParams().toBuilder().setHkdfHashType(HashType.SHA224))
                .build()
                .toByteString(),
            KeyMaterialType.SYMMETRIC,
            OutputPrefixType.RAW,
            /* idRequirement= */ null),
        // Wrong Hash type
        ProtoKeySerialization.create(
            "type.googleapis.com/google.crypto.tink.AesCtrHmacStreamingKey",
            validKey.toBuilder()
                .setParams(validKey.getParams().toBuilder().setHkdfHashType(HashType.SHA384))
                .build()
                .toByteString(),
            KeyMaterialType.SYMMETRIC,
            OutputPrefixType.RAW,
            /* idRequirement= */ null),
        // Key Shorter than derivedKeySize
        ProtoKeySerialization.create(
            "type.googleapis.com/google.crypto.tink.AesCtrHmacStreamingKey",
            validKey.toBuilder()
                .setKeyValue(KEY_BYTES_37_AS_BYTE_STRING.substring(0, 20))
                .setParams(validKey.getParams().toBuilder().setDerivedKeySize(32))
                .build()
                .toByteString(),
            KeyMaterialType.SYMMETRIC,
            OutputPrefixType.RAW,
            /* idRequirement= */ null),
        // Short CiphertextSegmentSize
        ProtoKeySerialization.create(
            "type.googleapis.com/google.crypto.tink.AesCtrHmacStreamingKey",
            validKey.toBuilder()
                .setParams(validKey.getParams().toBuilder().setCiphertextSegmentSize(24))
                .build()
                .toByteString(),
            KeyMaterialType.SYMMETRIC,
            OutputPrefixType.RAW,
            /* idRequirement= */ null)
      };
    } catch (GeneralSecurityException e) {
      throw new RuntimeException(e);
    }
  }
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