示例#1
0
        /// <inheritdoc cref="IAesCryptor"/>
        /// <summary>
        /// Encrypts the file.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="password">The password.</param>
        public void EncryptFile(string fileName, string password)
        {
            var encryptedFile = GetEncryptedFileName(fileName);

            DeleteFileIfExists(encryptedFile);
            Crypt.Encrypt(password, fileName, encryptedFile);
            DeleteFileIfExists(fileName);
        }
        /// <inheritdoc cref="IFileCryptor"/>
        /// <summary>
        /// Encrypts the file.
        /// </summary>
        /// <param name="fileName">The file name.</param>
        /// <param name="outputFolder">The output folder.</param>
        /// <returns>An <see cref="UploadItem"/>.</returns>
        /// <seealso cref="IFileCryptor"/>
        public UploadItem EncryptFile(string fileName, string outputFolder)
        {
            CheckFileName(fileName);
            var password    = this.randomizer.GetRandomPassword();
            var newFileName = this.GetNewFileName(fileName, outputFolder);

            AESCrypt.Encrypt(password, fileName, newFileName);
            var documentationFile = GetDocumentationFileName(fileName, outputFolder);

            return(GetNewUploadItem(fileName, documentationFile, newFileName, password));
        }