                       (with-open [counter (io/output-stream nonce-counter)]
                         ;; FIXME: What's a good initial value?
                         (.write counter (byte-array 8))))
+                    (println "Opening" nonce-counter)
                     (log/debug "Opening" nonce-counter)
-                    (with-open [counter (io/reader nonce-counter)]
+                    (with-open [counter (io/input-stream nonce-counter)]
+                      (println "Nonce counter file opened for reading")
                       (log/debug "Nonce counter file opened for reading")
                       (let [bytes-read (.read counter data 0 8)]
+                        (println "Read the 8 bytes")
                         (when (not= bytes-read 8)
                           (throw (ex-info "Nonce counter file too small"
                                           {::contents (b-t/->string data)

  ;; just going to use the built-in AES encryption
  [^SecretKey secret-key
   ^bytes clear-text]
  ;; Q: Which cipher mode is appropriate here?
  (let [cipher (Cipher/getInstance "AES/CBC/PKCS5Padding")
        ;; FIXME: Read https://www.synopsys.com/blogs/software-security/proper-use-of-javas-securerandom/

           ::nonce-key]
    :as this}
   random-portion]
  {:pre [::nonce-key]}
  (b-t/byte-copy! data random-portion)
  (let [secret-key (generate-symmetric-key "AES" 192)
        ;; Note that this is never(?) decrypted.
        ;; Q: Is there any reason for using this instead
