Ciphertext length was wrong.
[crypto_lab2.git] / labo2-fsharp / CryptoFileTests / Tests.fs
index aeea186..03b5c4a 100644 (file)
@@ -72,7 +72,7 @@ let doSomeTests () =
             | error -> assert (error :? UnableToDecryptKeys)
     printfn ""
 
-    let cyphertextLength = (int (FileInfo (cipherFilename)).Length) + API.hmacSize + API.signatureSize + API.keysSize
+    let cyphertextLength = (int (FileInfo (cipherFilename)).Length) - API.hmacSize - API.signatureSize - API.keysSize
     printfn "== Altering the cyphertext... (%d bytes)" cyphertextLength
     for i in 0 .. cyphertextLength do 
         printf "."
@@ -88,4 +88,4 @@ let doSomeTests () =
     File.Delete cipherFilename
     File.Delete plainFilename
 
-    printfn "===== API tests OK"
+    printfn "===== API tests OK"
\ No newline at end of file