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
<Properties>
- <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
- <MonoDevelop.Ide.Workbench ActiveDocument="CryptoFileTests/Program.fs">
+ <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|x86" />
+ <MonoDevelop.Ide.Workbench ActiveDocument="CryptoFile/API.fs">
<Files>
- <File FileName="CryptoFile/Crypto.fs" Line="1" Column="1" />
- <File FileName="CryptoFileTests/Program.fs" Line="14" Column="14" />
- <File FileName="CryptoFile/Tests.fs" Line="20" Column="20" />
+ <File FileName="CryptoFile/Types.fs" Line="1" Column="1" />
+ <File FileName="CryptoFile/API.fs" Line="36" Column="36" />
+ <File FileName="CryptoFile/Crypto.fs" Line="97" Column="97" />
+ <File FileName="CryptoFile/Tests.fs" Line="25" Column="25" />
+ <File FileName="CryptoFileTests/AssemblyInfo.fs" Line="7" Column="7" />
+ <File FileName="CryptoFileTests/Program.fs" Line="5" Column="5" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State expanded="True">
- <Node name="CryptoFile" expanded="True" />
- <Node name="CryptoFileTests" expanded="True" selected="True" />
+ <Node name="CryptoFile" expanded="True" selected="True" />
+ <Node name="CryptoFileTests" expanded="True" />
</State>
</Pad>
</Pads>