diff --git a/AppVeyor.Tools.SecureFile.sln b/AppVeyor.Tools.SecureFile.sln deleted file mode 100644 index fb4ce39..0000000 --- a/AppVeyor.Tools.SecureFile.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppVeyor.Tools.SecureFile", "AppVeyor.Tools.SecureFile\AppVeyor.Tools.SecureFile.csproj", "{B58065DF-A076-4940-8D05-F33EEA996E2C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{669E4036-190E-4FFD-AE16-758DA5C129D6}" - ProjectSection(SolutionItems) = preProject - appveyor.yml = appveyor.yml - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B58065DF-A076-4940-8D05-F33EEA996E2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B58065DF-A076-4940-8D05-F33EEA996E2C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B58065DF-A076-4940-8D05-F33EEA996E2C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B58065DF-A076-4940-8D05-F33EEA996E2C}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/AppVeyor.Tools.SecureFile/AppVeyor.Tools.SecureFile.csproj b/AppVeyor.Tools.SecureFile/AppVeyor.Tools.SecureFile.csproj deleted file mode 100644 index 38d4eff..0000000 --- a/AppVeyor.Tools.SecureFile/AppVeyor.Tools.SecureFile.csproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Debug - AnyCPU - {B58065DF-A076-4940-8D05-F33EEA996E2C} - Exe - Properties - AppVeyor.Tools.SecureFile - secure-file - v4.5 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AppVeyor.Tools.SecureFile/Program.cs b/AppVeyor.Tools.SecureFile/Program.cs deleted file mode 100644 index 2080858..0000000 --- a/AppVeyor.Tools.SecureFile/Program.cs +++ /dev/null @@ -1,228 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; - -namespace AppVeyor.Tools.SecureFile -{ - class Program - { - private static string Salt = "{E4E66F59-CAF2-4C39-A7F8-46097B1C461B}"; - - static void Main(string[] args) - { - string operation = null; - string fileName = null; - string secret = null; - string outFileName = null; - - try - { - #region parse parameters - if (args.Length == 0) - { - throw new Exception("No arguments specified."); - } - - int pos = 0; - while (pos < args.Length) - { - var p = args[pos]; - if (p.Equals("-decrypt", StringComparison.OrdinalIgnoreCase)) - { - // is it last parameter? - if (pos == args.Length - 1) - { - throw new Exception("Input file name is missing."); - } - else - { - operation = "decrypt"; - fileName = args[++pos]; - } - } - else if (p.Equals("-encrypt", StringComparison.OrdinalIgnoreCase)) - { - // is it last parameter? - if (pos == args.Length - 1) - { - throw new Exception("Input file name is missing."); - } - else - { - operation = "encrypt"; - fileName = args[++pos]; - } - } - else if (p.Equals("-secret", StringComparison.OrdinalIgnoreCase)) - { - // is it last parameter? - if (pos == args.Length - 1) - { - throw new Exception("Secret passphrase is missing."); - } - else - { - secret = args[++pos]; - } - } - else if (p.Equals("-out", StringComparison.OrdinalIgnoreCase)) - { - // is it last parameter? - if (pos == args.Length - 1) - { - throw new Exception("Out file name is missing."); - } - else - { - outFileName = args[++pos]; - } - } - - pos++; - } - - if(operation == null) - { - throw new Exception("No operation specified. It should be either -encrypt or -decrypt."); - } - #endregion - - #region validate file names - if (outFileName == null && operation == "encrypt") - { - outFileName = fileName + ".enc"; - } - else if (outFileName == null && operation == "decrypt") - { - if (Path.GetExtension(fileName).Equals(".enc", StringComparison.OrdinalIgnoreCase)) - { - outFileName = fileName.Substring(0, fileName.Length - 4); // trim .enc - } - else - { - outFileName = fileName + ".dec"; - } - } - - var basePath = Environment.CurrentDirectory; - - // convert relative paths to absolute - if (!Path.IsPathRooted(fileName)) - { - fileName = Path.GetFullPath(Path.Combine(basePath, fileName)); - } - - if (!Path.IsPathRooted(outFileName)) - { - outFileName = Path.GetFullPath(Path.Combine(basePath, outFileName)); - } - - // in and out file names should not be the same - if (fileName.Equals(outFileName, StringComparison.OrdinalIgnoreCase)) - { - throw new Exception("Input and output files cannot be the same."); - } - - if (!File.Exists(fileName)) - { - throw new Exception("File not found: " + fileName); - } - #endregion - } - catch(Exception ex) - { - Console.WriteLine("Error: " + ex.Message); - - Console.WriteLine(@" -USAGE: - -Encrypting file: - - secure-file -encrypt -secret -out [filename.ext.enc] - -Decrypting file: - - secure-file -decrypt -secret -out [filename.ext] -"); - Environment.Exit(1); - } - - if(operation == "encrypt") - { - try - { - Encrypt(fileName, outFileName, secret); - } - catch(Exception ex) - { - Console.WriteLine("Error encrypting file: " + ex.Message); - Environment.Exit(2); - } - } - else if (operation == "decrypt") - { - try - { - Decrypt(fileName, outFileName, secret); - } - catch (CryptographicException) - { - Console.WriteLine("Error decrypting file."); - Environment.Exit(3); - } - catch (Exception ex) - { - Console.WriteLine("Error decrypting file: " + ex.Message); - Environment.Exit(3); - } - } - } - - private static void Encrypt(string fileName, string outFileName, string secret) - { - var alg = GetRijndael(secret); - - using(var inStream = File.OpenRead(fileName)) - { - using(var outStream = File.Create(outFileName)) - { - using (var cryptoStream = new CryptoStream(outStream, alg.CreateEncryptor(), CryptoStreamMode.Write)) - { - inStream.CopyTo(cryptoStream); - } - } - } - } - - private static void Decrypt(string fileName, string outFileName, string secret) - { - var alg = GetRijndael(secret); - - using (var inStream = File.OpenRead(fileName)) - { - using (var outStream = File.Create(outFileName)) - { - using (var cryptoStream = new CryptoStream(outStream, alg.CreateDecryptor(), CryptoStreamMode.Write)) - { - inStream.CopyTo(cryptoStream); - } - } - } - } - - private static Rijndael GetRijndael(string secret) - { - Rfc2898DeriveBytes pbkdf2 = new Rfc2898DeriveBytes(secret, Encoding.UTF8.GetBytes(Salt), 10000); - - Rijndael alg = Rijndael.Create(); - alg.Key = pbkdf2.GetBytes(32); - alg.IV = pbkdf2.GetBytes(16); - - return alg; - } - } -} diff --git a/AppVeyor.Tools.SecureFile/Properties/AssemblyInfo.cs b/AppVeyor.Tools.SecureFile/Properties/AssemblyInfo.cs deleted file mode 100644 index d638ddf..0000000 --- a/AppVeyor.Tools.SecureFile/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("File encryption utility")] -[assembly: AssemblyDescription("Command-line utility for encrypting/decrypting files with Rijndael algorithm.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("AppVeyor")] -[assembly: AssemblyProduct("AppVeyor CI")] -[assembly: AssemblyCopyright("Copyright © 2015 by Appveyor Systems Inc.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c79ff23d-d229-4117-8685-da39aaef53d3")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AppVeyor.Tools.SecureFile/secure-file.nuspec b/AppVeyor.Tools.SecureFile/secure-file.nuspec deleted file mode 100644 index 4c76d93..0000000 --- a/AppVeyor.Tools.SecureFile/secure-file.nuspec +++ /dev/null @@ -1,21 +0,0 @@ - - - - secure-file - $version$ - File encryption utility - Appveyor Systems Inc. - Appveyor Systems Inc. - - https://github.com/appveyor/secure-file - false - Command-line utility for encrypting/decrypting files with Rijndael algorithm. - Initial release. - Copyright © 2015 by Appveyor Systems Inc. - appveyor encryption tools - - - - - \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index b0facb3..de66b39 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,8 +7,6 @@ skip_branch_with_pr: true skip_tags: true init: -- set OUT_DIR=_dist -- set BUILD_DIR=_build - set appveyor_full_version=%secure_file_version%.%appveyor_build_number% - appveyor UpdateBuild -Version %appveyor_full_version% @@ -23,6 +21,7 @@ dotnet_csproj: build_script: - build.cmd +- 7z a secure-file.zip build\* - appveyor PushArtifact secure-file.zip test: off