X-Git-Url: http://git.euphorik.ch/?p=crypto_lab2.git;a=blobdiff_plain;f=labo2-fsharp%2FCryptoFile%2FCrypto.fs;h=21b168ec302c60f98ee154ee7497a9e68b9a4435;hp=836d636af67b37e72fabf38ed5984659b518b75a;hb=ac84e8535149dbf639a7766f110960c998b47159;hpb=137157b6dbd5efb99b486a30da6e10b0a175f530 diff --git a/labo2-fsharp/CryptoFile/Crypto.fs b/labo2-fsharp/CryptoFile/Crypto.fs index 836d636..21b168e 100644 --- a/labo2-fsharp/CryptoFile/Crypto.fs +++ b/labo2-fsharp/CryptoFile/Crypto.fs @@ -75,19 +75,8 @@ module internal Crypto = let decryptor = aes.CreateDecryptor (key, iv) new CryptoStream (inputStream, decryptor, CryptoStreamMode.Read) + // Create a stream to compute the HMAC-SHA256 against all data being written. let HMACStream (key: byte[]) (outputStream: Stream) : Stream * HMACSHA256 = assert (key.Length = 32) let hmac = new HMACSHA256 (key) - new CryptoStream (outputStream, hmac, CryptoStreamMode.Write) :> Stream, hmac - - (*type HMACStream (buffer: byte[], output: Stream) = - inherit Stream () - override this.CanRead with get () = false - override this.CanSeek with get () = false - override this.CanWrite with get () = true - override this.Length with get () = raise <| new NotSupportedException () - override this.Position with get () = raise <| new NotSupportedException () - and set _ = raise <| new NotSupportedException () - override this.Flush () = - output.Flush () - override this.Read (_: byte[], _: int, _: int) = raise <| new NotSupportedException ()*) \ No newline at end of file + new CryptoStream (outputStream, hmac, CryptoStreamMode.Write) :> Stream, hmac \ No newline at end of file