public AesGcmHkdfStreamingParameters build() throws GeneralSecurityException {
      if (keySizeBytes == null) {
        throw new GeneralSecurityException("keySizeBytes needs to be set");
      }
      if (derivedAesGcmKeySizeBytes == null) {
        throw new GeneralSecurityException("derivedAesGcmKeySizeBytes needs to be set");
      }
      if (hkdfHashType == null) {
        throw new GeneralSecurityException("hkdfHashType needs to be set");
      }
      if (ciphertextSegmentSizeBytes == null) {
        throw new GeneralSecurityException("ciphertextSegmentSizeBytes needs to be set");
      }

      if (derivedAesGcmKeySizeBytes != 16 && derivedAesGcmKeySizeBytes != 32) {
        throw new GeneralSecurityException(
            "derivedAesGcmKeySizeBytes needs to be 16 or 32, not " + derivedAesGcmKeySizeBytes);
      }
      if (keySizeBytes < derivedAesGcmKeySizeBytes) {
        throw new GeneralSecurityException(
            "keySizeBytes needs to be at least derivedAesGcmKeySizeBytes, i.e., "
                + derivedAesGcmKeySizeBytes);
      }
      if (ciphertextSegmentSizeBytes <= derivedAesGcmKeySizeBytes + 24) {
        throw new GeneralSecurityException(
            "ciphertextSegmentSizeBytes needs to be at least derivedAesGcmKeySizeBytes + 25, i.e., "
                + (derivedAesGcmKeySizeBytes + 25));
      }
      return new AesGcmHkdfStreamingParameters(
          keySizeBytes, derivedAesGcmKeySizeBytes, hkdfHashType, ciphertextSegmentSizeBytes);
    }
Checks restrictions as on the devsite
java_src/src/main/java/com/google/crypto/tink/streamingaead/AesGcmHkdfStreamingParameters.java