diff --git a/src/_zkapauthorizer/_storage_server.py b/src/_zkapauthorizer/_storage_server.py
index ddefca32a617843073e22331c072ae2f1152c503..8c832827a38d0f44a023140b5b256eb6d852ce33 100644
--- a/src/_zkapauthorizer/_storage_server.py
+++ b/src/_zkapauthorizer/_storage_server.py
@@ -512,7 +512,7 @@ def get_storage_index_share_size(sharepath):
     # share data is structured.  A lot of this seems to be wrong.
     # storage/immutable.py appears to have the correct information.
     fmt = ">LL"
-    with open(sharepath) as share_file:
+    with open(sharepath, "rb") as share_file:
         header = share_file.read(calcsize(fmt))
 
     if len(header) != calcsize(fmt):
@@ -570,7 +570,7 @@ def get_slot_share_size(sharepath):
 
     :return int: The data size of the share in bytes.
     """
-    with open(sharepath) as share_file:
+    with open(sharepath, "rb") as share_file:
         share_data_length_bytes = share_file.read(92)[-8:]
         (share_data_length,) = unpack('>Q', share_data_length_bytes)
         return share_data_length
@@ -598,7 +598,7 @@ def get_stat(sharepath):
     This is necessary to differentiate between buckets and slots.
     """
     # Figure out if it is a storage index or a slot.
-    with open(sharepath) as share_file:
+    with open(sharepath, "rb") as share_file:
         magic = share_file.read(32)
         if magic == "Tahoe mutable container v1\n" + "\x75\x09\x44\x03\x8e":
             return stat_slot