docs: public static CipherInputStream encrypt(StorageObjectMetadata meta,
                                            long originalContentLength,
                                            InputStream src,
                                            RemoteStoreFileEncryptionMaterial encMat,
                                            SnowflakeStorageClient client)
    throws InvalidKeyException,
           InvalidAlgorithmParameterException,
           NoSuchAlgorithmException,
           NoSuchProviderException,
           NoSuchPaddingException,
           FileNotFoundException,
           IllegalBlockSizeException,
           BadPaddingException
    {
      final byte[] decodedKey = Base64.decode(encMat.getQueryStageMasterKey());
      final int keySize = decodedKey.length;
      final byte[] fileKeyBytes = new byte[keySize];
      final byte[] ivData;
      final CipherInputStream cis;
      final int blockSz;
      {
        final Cipher fileCipher = Cipher.getInstance(FILE_CIPHER);
        blockSz = fileCipher.getBlockSize();
  
        // Create IV
        ivData = new byte[blockSz];
        getSecRnd().nextBytes(ivData);
        final IvParameterSpec iv = new IvParameterSpec(ivData);
  
        // Create file key
        getSecRnd().nextBytes(fileKeyBytes);
        SecretKey fileKey = new SecretKeySpec(fileKeyBytes, 0, keySize, AES);
  
        // Init cipher
        fileCipher.init(Cipher.ENCRYPT_MODE, fileKey, iv);
  
        // Create encrypting input stream
        cis = new CipherInputStream(src, fileCipher);
      }
  
      // Encrypt the file key with the QRMK
      {
        final Cipher keyCipher = Cipher.getInstance(KEY_CIPHER);
        SecretKey queryStageMasterKey =
            new SecretKeySpec(decodedKey, 0, keySize, AES);
  
        // Init cipher
        keyCipher.init(Cipher.ENCRYPT_MODE, queryStageMasterKey);
        byte[] encKeK = keyCipher.doFinal(fileKeyBytes);
  
        // Store metadata
        MatDesc matDesc =
            new MatDesc(encMat.getSmkId(), encMat.getQueryId(), keySize * 8);
        // Round up length to next multiple of the block size
        // Sizes that are multiples of the block size need to be padded to next
        // multiple
        long contentLength = ((originalContentLength + blockSz) / blockSz) * blockSz;
        client.addEncryptionMetadata(meta, matDesc, ivData, encKeK, contentLength);
      }
  
      return cis;
    }