// Decrypt metadata.
inputStream.Position <- 32L + 256L + 256L
use cryptoStream = Crypto.decryptAES keyAES iv inputStream
- let metadata = Metadata (cryptoStream)
+ let metadata = Metadata cryptoStream
// Create the file and write its content and metadata.
let filePath = Path.Combine (targetDirPath, metadata.get MetadataKeys.filename)
let modificationTime = DateTime (metadata.get MetadataKeys.modificationTime |> int64)
- let fileInfo = FileInfo (filePath)
+ let fileInfo = FileInfo filePath
using (fileInfo.Create ()) <| fun outputStream -> cryptoStream.CopyTo outputStream
fileInfo.LastWriteTimeUtc <- modificationTime
\ No newline at end of file
generator.GetBytes result
result
- /// Generate a new RSA key pair: (public * private).
+ /// Generates a new RSA key pair: (public * private).
let generateRSAKeysPair : Key * Key =
use rsa = new RSACryptoServiceProvider (rsaKeySize)
rsa.ToXmlString false, rsa.ToXmlString true
use aes = new AesCryptoServiceProvider (KeySize = aesKeySize)
new CryptoStream (inputStream, aes.CreateDecryptor (key, iv), CryptoStreamMode.Read)
- // Create a stream to compute the HMAC-SHA256 against all data being written.
+ // Creates a stream to compute the HMAC-SHA256 against all data being written.
let HMACStream (key: byte[]) (outputStream: Stream) : Stream * HMACSHA256 =
if key.Length <> 32 then raise KeySizeError
let hmac = new HMACSHA256 (key)