├── .nuget ├── NuGet.exe └── NuGet.Config ├── CryptAByte.WebUI ├── Views │ ├── _ViewStart.cshtml │ ├── Home │ │ ├── ServiceInfo.cshtml │ │ ├── About-Apps.cshtml │ │ ├── GetMessages.cshtml │ │ ├── Index.cshtml │ │ ├── Contact.cshtml │ │ ├── RequestKeys.cshtml │ │ ├── MessagesDetail.cshtml │ │ ├── SendMessage.cshtml │ │ ├── NewKeyDetails.cshtml │ │ ├── Subscribe.cshtml │ │ └── About.cshtml │ ├── Shared │ │ ├── EditorTemplates │ │ │ └── DateTime.cshtml │ │ ├── Error.cshtml │ │ └── _LogOnPartial.cshtml │ ├── Account │ │ ├── ChangePasswordSuccess.cshtml │ │ ├── LogOn.cshtml │ │ ├── ChangePassword.cshtml │ │ └── Register.cshtml │ ├── SelfDestruct │ │ ├── Read.cshtml │ │ ├── Send.cshtml │ │ └── Index.cshtml │ ├── Password │ │ └── Index.cshtml │ └── Web.config ├── favicon.ico ├── Global.asax ├── Content │ ├── images │ │ └── logo.png │ ├── CryptAByteEncryptionLibrariesAndTests.7z │ └── themes │ │ ├── base │ │ ├── images │ │ │ ├── ui-icons_222222_256x240.png │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ ├── ui-icons_454545_256x240.png │ │ │ ├── ui-icons_888888_256x240.png │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── minified │ │ │ ├── images │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ ├── ui-icons_454545_256x240.png │ │ │ │ ├── ui-icons_888888_256x240.png │ │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ ├── jquery.ui.selectable.min.css │ │ │ ├── jquery.ui.progressbar.min.css │ │ │ ├── jquery.ui.autocomplete.min.css │ │ │ ├── jquery.ui.core.min.css │ │ │ ├── jquery.ui.accordion.min.css │ │ │ ├── jquery.ui.tabs.min.css │ │ │ ├── jquery.ui.slider.min.css │ │ │ ├── jquery.ui.resizable.min.css │ │ │ ├── jquery.ui.dialog.min.css │ │ │ ├── jquery.ui.button.min.css │ │ │ └── jquery.ui.datepicker.min.css │ │ ├── jquery.ui.all.css │ │ ├── jquery.ui.selectable.css │ │ ├── jquery.ui.progressbar.css │ │ ├── jquery.ui.base.css │ │ ├── jquery.ui.accordion.css │ │ ├── jquery.ui.slider.css │ │ ├── jquery.ui.resizable.css │ │ ├── jquery.ui.autocomplete.css │ │ ├── jquery.ui.dialog.css │ │ ├── jquery.ui.tabs.css │ │ ├── jquery.ui.core.css │ │ └── jquery.ui.button.css │ │ └── cupertino │ │ └── images │ │ ├── ui-icons_2694e8_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_3d80b3_256x240.png │ │ ├── ui-icons_72a7cf_256x240.png │ │ ├── ui-icons_ffffff_256x240.png │ │ ├── ui-bg_flat_15_cd0a0a_40x100.png │ │ ├── ui-bg_glass_100_e4f1fb_1x400.png │ │ ├── ui-bg_glass_50_3baae3_1x400.png │ │ ├── ui-bg_glass_80_d7ebf9_1x400.png │ │ ├── ui-bg_highlight-hard_70_000000_1x100.png │ │ ├── ui-bg_highlight-soft_25_ffef8f_1x100.png │ │ ├── ui-bg_diagonals-thick_90_eeeeee_40x40.png │ │ ├── ui-bg_highlight-hard_100_f2f5f7_1x100.png │ │ └── ui-bg_highlight-soft_100_deedf7_1x100.png ├── Models │ ├── TemporaryDownloadKey.cs │ ├── GetMessagesModel.cs │ ├── Constraints │ │ └── ValidKeyConstraint.cs │ ├── ContactFormModel.cs │ ├── SendMessageModel.cs │ ├── SelfDestructingMessageModel.cs │ ├── NewKeyModel.cs │ ├── XmlResult.cs │ └── AccountModels.cs ├── Controllers │ ├── UtilityController.cs │ └── PasswordController.cs ├── Properties │ ├── PublishProfiles │ │ └── Release.pubxml │ └── AssemblyInfo.cs ├── Web.Debug.config ├── Web.Release.config ├── Global.asax.cs ├── Scripts │ ├── password-generator.js │ ├── jquery.unobtrusive-ajax.min.js │ └── APIUsageDemo.js ├── App_Start │ └── NinjectWebCommon.cs ├── Messages.Designer.cs └── packages.config ├── CryptoPad ├── favicon.ico ├── favicon.png ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ └── Resources.Designer.cs ├── Program.cs └── Form1.cs ├── binaries ├── CryptAByte.7z ├── CryptoPad.exe └── OneTimePad.exe ├── screenshots ├── Website.png ├── OneTimePad.png ├── WinClient.png └── cryptopad.png ├── CryptAByte.Domain.Tests ├── Test.PNG ├── KeySecurityTests.cs ├── SymetricCryptoTests.cs ├── CryptAByte.Domain.Tests.csproj ├── Properties │ └── AssemblyInfo.cs ├── App.config ├── AssymetricCryptoTests.cs └── SelfDestructingMessageRepositoryTests.cs ├── CryptAByte.Domain ├── CryptAByte.snk ├── DataContext │ ├── SelfDestructingMessageAttachment.cs │ ├── UniqueIdGenerator.cs │ ├── Subscription.cs │ ├── CryptAByteContext.cs │ └── SelfDestructingMessage.cs ├── SelfDestructingMessaging │ └── ISelfDestructingMessageRepository.cs ├── CryptAByte.Domain.csproj ├── App.config ├── KeyManager │ └── IRequestRepository.cs ├── Services │ ├── IEmailService.cs │ └── EmailService.cs ├── Functional │ ├── ITimeProvider.cs │ └── IRandomGenerator.cs ├── Properties │ └── AssemblyInfo.cs ├── Validation.cs ├── Migrations │ └── Configuration.cs └── DataAnnotations │ ├── ConditionalRequiredAttribute.cs │ └── RequiredIfAttribute.cs ├── CryptAByte.WindowsClient ├── favicon.ico ├── favicon.png ├── CryptAByte.snk ├── Resources │ └── logo.png ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ └── Resources.Designer.cs └── Program.cs ├── CryptAByte.CryptoLibrary ├── CryptAByte.snk ├── CryptoProviders │ ├── ICryptoProvider.cs │ └── RandomNumberGenerator.cs ├── CryptAByte.CryptoLibrary.csproj ├── Properties │ └── AssemblyInfo.cs ├── EncryptionLibraries │ ├── AESEncryption.cs │ └── RSAPublicKeyEncryption.cs └── Functional │ └── IRandomGenerator.cs ├── OneTimePad ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── app.manifest ├── App.config ├── Program.cs ├── packages.config └── Form1.cs ├── .github └── dependabot.yml ├── CryptAByte.WindowsClient.Tests ├── CryptAByte.WindowsClient.Tests.csproj ├── Properties │ └── AssemblyInfo.cs └── ServiceProxyTests.cs ├── CryptAByte.WebUI.Tests ├── RouteTestHelpers.cs ├── CryptAByte.WebUI.Tests.csproj ├── HomePageTests.cs ├── Controllers │ └── HomeControllerTest.cs ├── Properties │ └── AssemblyInfo.cs └── App.config ├── README.md └── .gitignore /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/.nuget/NuGet.exe -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /CryptoPad/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptoPad/favicon.ico -------------------------------------------------------------------------------- /CryptoPad/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptoPad/favicon.png -------------------------------------------------------------------------------- /binaries/CryptAByte.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/binaries/CryptAByte.7z -------------------------------------------------------------------------------- /binaries/CryptoPad.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/binaries/CryptoPad.exe -------------------------------------------------------------------------------- /binaries/OneTimePad.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/binaries/OneTimePad.exe -------------------------------------------------------------------------------- /screenshots/Website.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/screenshots/Website.png -------------------------------------------------------------------------------- /screenshots/OneTimePad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/screenshots/OneTimePad.png -------------------------------------------------------------------------------- /screenshots/WinClient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/screenshots/WinClient.png -------------------------------------------------------------------------------- /screenshots/cryptopad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/screenshots/cryptopad.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/favicon.ico -------------------------------------------------------------------------------- /CryptAByte.Domain.Tests/Test.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.Domain.Tests/Test.PNG -------------------------------------------------------------------------------- /CryptAByte.Domain/CryptAByte.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.Domain/CryptAByte.snk -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WindowsClient/favicon.ico -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WindowsClient/favicon.png -------------------------------------------------------------------------------- /CryptAByte.CryptoLibrary/CryptAByte.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.CryptoLibrary/CryptAByte.snk -------------------------------------------------------------------------------- /CryptAByte.WebUI/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="CryptAByte.WebUI.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/CryptAByte.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WindowsClient/CryptAByte.snk -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/images/logo.png -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/Resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WindowsClient/Resources/logo.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/ServiceInfo.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | 3 | @{ 4 | ViewBag.Title = "API Information"; 5 | } 6 | 7 |

title

8 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/CryptAByteEncryptionLibrariesAndTests.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/CryptAByteEncryptionLibrariesAndTests.7z -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Shared/EditorTemplates/DateTime.cshtml: -------------------------------------------------------------------------------- 1 | @model DateTime? 2 | 3 | @Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" }) -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_2694e8_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_2694e8_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_3d80b3_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_3d80b3_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_72a7cf_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_72a7cf_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_glass_50_3baae3_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_glass_50_3baae3_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Account/ChangePasswordSuccess.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Change Password"; 3 | } 4 | 5 |

Change Password

6 |

7 | Your password has been changed successfully. 8 |

9 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DavidVeksler/CryptAByte/HEAD/CryptAByte.WebUI/Content/themes/base/minified/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | Layout = null; 6 | } 7 | 8 |

9 | Sorry, an error occurred while processing your request. 10 |

11 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Shared/_LogOnPartial.cshtml: -------------------------------------------------------------------------------- 1 | @if(Request.IsAuthenticated) { 2 | Welcome @User.Identity.Name! 3 | [ @Html.ActionLink("Log Off", "LogOff", "Account") ] 4 | } 5 | else { 6 | @:[ @Html.ActionLink("Log On", "LogOn", "Account") ] 7 | } 8 | -------------------------------------------------------------------------------- /CryptoPad/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OneTimePad/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.selectable.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.selectable.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black} -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/TemporaryDownloadKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CryptAByte.WebUI.Models 4 | { 5 | public class TemporaryDownloadKey 6 | { 7 | public int MessageId { get; set; } 8 | public DateTime Expires { get; set; } 9 | public string Passphrase { get; set; } 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.progressbar.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.progressbar.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%} -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.all.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Theming 9 | */ 10 | @import "jquery.ui.base.css"; 11 | @import "jquery.ui.theme.css"; 12 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.selectable.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Selectable 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Selectable#theming 9 | */ 10 | .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } 11 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Controllers/UtilityController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace CryptAByte.WebUI.Controllers 8 | { 9 | public class UtilityController : Controller 10 | { 11 | // 12 | // GET: /Utility/ 13 | 14 | public ActionResult Index() 15 | { 16 | return View(); 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Controllers/PasswordController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace CryptAByte.WebUI.Controllers 8 | { 9 | public class PasswordController : Controller 10 | { 11 | // 12 | // GET: /Password/ 13 | 14 | public ActionResult Index() 15 | { 16 | return View(); 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.progressbar.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Progressbar 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Progressbar#theming 9 | */ 10 | .ui-progressbar { height:2em; text-align: left; overflow: hidden; } 11 | .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } -------------------------------------------------------------------------------- /CryptAByte.CryptoLibrary/CryptoProviders/ICryptoProvider.cs: -------------------------------------------------------------------------------- 1 | namespace CryptAByte.CryptoLibrary.CryptoProviders 2 | { 3 | public interface ICryptoProvider 4 | { 5 | string EncryptWithKey(string secret, string key); 6 | 7 | string DecryptWithKey(string secret, string key); 8 | 9 | // dynamic GenerateKey(); 10 | 11 | //string[] GeneratePublicPrivateKeyPair(); 12 | 13 | //string GetSecureHashForString(string original); 14 | } 15 | } -------------------------------------------------------------------------------- /CryptAByte.Domain/DataContext/SelfDestructingMessageAttachment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace CryptAByte.Domain.DataContext 5 | { 6 | public class SelfDestructingMessageAttachment 7 | { 8 | [Key] 9 | public int AttachmentId { get; set; } 10 | 11 | public int MessageId { get; set; } 12 | 13 | public string Attachment { get; set; } 14 | 15 | public DateTime? SentDate { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/GetMessagesModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace CryptAByte.WebUI.Models 4 | { 5 | public class GetMessagesModel 6 | { 7 | [Required] 8 | [StringLength(16)] 9 | [Display(Name = "Key Id")] 10 | public string KeyTokenIdentifier { get; set; } 11 | 12 | [Required] 13 | // [StringLength(128, MinimumLength = 0)] 14 | [Display(Name = "Passphrase")] 15 | public string Passphrase { get; set; } 16 | 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /CryptoPad/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace CryptoPad 5 | { 6 | internal static class Program 7 | { 8 | /// 9 | /// The main entry point for the application. 10 | /// 11 | [STAThread] 12 | private static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new Form1()); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /CryptAByte.Domain/DataContext/UniqueIdGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CryptAByte.Domain.DataContext 7 | { 8 | public static class UniqueIdGenerator 9 | { 10 | public static string GetUniqueId() 11 | { 12 | long i = 1; 13 | foreach (byte b in Guid.NewGuid().ToByteArray()) 14 | { 15 | i *= ((int)b + 1); 16 | } 17 | return string.Format("{0:x}", i - DateTime.Now.Ticks); 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CryptAByte.Domain/SelfDestructingMessaging/ISelfDestructingMessageRepository.cs: -------------------------------------------------------------------------------- 1 | using CryptAByte.Domain.DataContext; 2 | 3 | namespace CryptAByte.Domain.SelfDestructingMessaging 4 | { 5 | public interface ISelfDestructingMessageRepository 6 | { 7 | 8 | SelfDestructingMessage GetMessage(int messageId, string passphrase); 9 | SelfDestructingMessageAttachment GetAttachment(int messageId, string passphrase); 10 | int StoreMessage(SelfDestructingMessage selfDestructingMessage, string passphrase, string attachmentName = null, byte[] attachment = null); 11 | } 12 | } -------------------------------------------------------------------------------- /CryptAByte.Domain/DataContext/Subscription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace CryptAByte.Domain.DataContext 8 | { 9 | public class Subscription 10 | { 11 | public Subscription() 12 | { 13 | Created = DateTime.Now; 14 | } 15 | 16 | [Key] 17 | public int SubscriptionId { get; set; } 18 | 19 | public string Email { get; set; } 20 | 21 | public DateTime Created { get; set; } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /OneTimePad/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CryptAByte.Domain/DataContext/CryptAByteContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | using CryptAByte.Domain.KeyManager; 3 | 4 | namespace CryptAByte.Domain.DataContext 5 | { 6 | public class CryptAByteContext : DbContext 7 | { 8 | public DbSet Keys { get; set; } 9 | // public DbSet Notifications { get; set; } 10 | public DbSet Messages { get; set; } 11 | public DbSet SelfDestructingMessages { get; set; } 12 | public DbSet SelfDestructingMessageAttachments { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /OneTimePad/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace OneTimePad 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CryptAByte.CryptoLibrary/CryptAByte.CryptoLibrary.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | CryptAByte.CryptoLibrary 6 | CryptAByte.CryptoLibrary 7 | true 8 | CryptAByte.snk 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | schedule: 16 | interval: "weekly" 17 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/Constraints/ValidKeyConstraint.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Routing; 3 | 4 | namespace CryptAByte.WebUI.Constraints 5 | { 6 | public class ValidKeyConstraint : IRouteConstraint 7 | { 8 | public bool Match 9 | ( 10 | HttpContextBase httpContext, 11 | Route route, 12 | string parameterName, 13 | RouteValueDictionary values, 14 | RouteDirection routeDirection 15 | ) 16 | { 17 | return values.ContainsKey("key") && values["key"].ToString().Length == 16; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/ContactFormModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace CryptAByte.WebUI.Models 4 | { 5 | public class ContactFormModel 6 | { 7 | [Required] 8 | [StringLength(200)] 9 | public string Name { get; set; } 10 | 11 | [Required] 12 | [StringLength(200)] 13 | [RegularExpression(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Please enter a valid email address.")] 14 | public string Email { get; set; } 15 | 16 | 17 | [Required] 18 | [DataType(DataType.Text)] 19 | public string Message { get; set; } 20 | 21 | 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /CryptAByte.Domain/DataContext/SelfDestructingMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace CryptAByte.Domain.DataContext 6 | { 7 | public class SelfDestructingMessage 8 | { 9 | [Key] 10 | public int MessageId { get; set; } 11 | 12 | public string Message { get; set; } 13 | 14 | public DateTime? SentDate { get; set; } 15 | 16 | [NotMapped] 17 | public virtual SelfDestructingMessageAttachment SelfDestructingMessageAttachment { get; set; } 18 | 19 | [NotMapped] 20 | public bool HasAttachment { get; internal set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Properties/PublishProfiles/Release.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | FileSystem 9 | 10 | C:\TimeLock 11 | False 12 | 13 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.autocomplete.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.autocomplete.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-autocomplete{position:absolute;cursor:default}* html .ui-autocomplete{width:1px}.ui-menu{list-style:none;padding:2px;margin:0;display:block;float:left}.ui-menu .ui-menu{margin-top:-3px}.ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;float:left;clear:left;width:100%}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:.2em .4em;line-height:1.5;zoom:1}.ui-menu .ui-menu-item a.ui-state-hover,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px} -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/About-Apps.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | @{ 3 | ViewBag.Title = "Desktop Apps"; 4 | 5 | } 6 | 7 |

Desktop Apps

8 | 9 | 10 |

11 | Windows/Mac desktop apps are still in progress. A test version (you can send messages but not files) is available for Windows here. 13 |

14 | 15 |

16 | You can build this project yourself from the GitHub repository. 17 |

18 | 19 |

20 | Please subscribe or follow the Facebook 21 | page for the latest update. 22 |

23 | 24 | 25 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.base.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Theming 9 | */ 10 | @import url("jquery.ui.core.css"); 11 | 12 | @import url("jquery.ui.accordion.css"); 13 | @import url("jquery.ui.autocomplete.css"); 14 | @import url("jquery.ui.button.css"); 15 | @import url("jquery.ui.datepicker.css"); 16 | @import url("jquery.ui.dialog.css"); 17 | @import url("jquery.ui.progressbar.css"); 18 | @import url("jquery.ui.resizable.css"); 19 | @import url("jquery.ui.selectable.css"); 20 | @import url("jquery.ui.slider.css"); 21 | @import url("jquery.ui.tabs.css"); 22 | -------------------------------------------------------------------------------- /CryptAByte.Domain/CryptAByte.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | CryptAByte.Domain 6 | CryptAByte.Domain 7 | true 8 | CryptAByte.snk 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CryptAByte.Domain.Tests/KeySecurityTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using CryptAByte.Domain.KeyManager; 4 | 5 | namespace CryptAByte.Domain.Tests 6 | { 7 | // TODO 8 | [Ignore] 9 | [TestClass] 10 | public class KeySecurityTests 11 | { 12 | private const string secret = "This is a secret"; 13 | 14 | // Time Lock Process 15 | 16 | // 1. Request key + release date 17 | //2. Grant public key + key token 18 | //3. Request private key via key token 19 | //4. Grant private key 20 | 21 | [TestMethod] 22 | public void CannotGetKeyBeforeReleaseDate() 23 | { 24 | var request = CryptoKey.CreateWithGeneratedKeys(DateTime.Now.AddDays(1)); 25 | Assert.IsNull(request.GetPrivateKey); 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.core.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.core.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute!important;clip:rect(1px);clip:rect(1px,1px,1px,1px)}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{zoom:1}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%} -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.accordion.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.accordion.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-accordion{width:100%}.ui-accordion .ui-accordion-header{cursor:pointer;position:relative;margin-top:1px;zoom:1}.ui-accordion .ui-accordion-li-fix{display:inline}.ui-accordion .ui-accordion-header-active{border-bottom:0!important}.ui-accordion .ui-accordion-header a{display:block;font-size:1em;padding:.5em .5em .5em .7em}.ui-accordion-icons .ui-accordion-header a{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;margin-top:-2px;position:relative;top:1px;margin-bottom:2px;overflow:auto;display:none;zoom:1}.ui-accordion .ui-accordion-content-active{display:block} -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/GetMessages.cshtml: -------------------------------------------------------------------------------- 1 | @{ Layout = null;} 2 | @model CryptAByte.WebUI.Models.GetMessagesModel 3 | @using (Ajax.BeginForm("GetMessages", "Home", new AjaxOptions() { UpdateTargetId = "messageDetails", OnSuccess = "ShowMyMessages", OnFailure = "OnError" })) 4 | { 5 | 6 |
7 | 8 | 9 |
10 |

3: View Messages sent to a Key Id

11 |
@Html.LabelFor(m => m.KeyTokenIdentifier) 12 | @Html.TextBoxFor(m => m.KeyTokenIdentifier) 13 | @Html.ValidationMessageFor(m => m.KeyTokenIdentifier) 14 |
15 |
16 | @Html.LabelFor(m => m.Passphrase) 17 | @Html.PasswordFor(m => m.Passphrase) 18 | @Html.ValidationMessageFor(m => m.Passphrase) 19 |
20 | 21 |
22 | 23 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Page.Title = "CryptAByte: Secure, anonymous messaging and file sharing"; 3 | } 4 | 5 | @*

@ViewBag.Message

*@ 6 | 7 | 8 | 16 | 17 | 18 |
19 | @Html.Partial("CreateKey") 20 | @Html.Partial("SendMessage") 21 | @Html.Partial("GetMessages") 22 |
23 |
24 | @Html.Partial("About-Home") 25 |
26 | 27 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.tabs.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.tabs.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-tabs{position:relative;padding:.2em;zoom:1}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:1px;margin:0 .2em 1px 0;border-bottom:0!important;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav li a{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-selected{margin-bottom:0;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-selected a,.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-state-processing a{cursor:text}.ui-tabs .ui-tabs-nav li a,.ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tabs .ui-tabs-hide{display:none!important} -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.slider.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.slider.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0} -------------------------------------------------------------------------------- /CryptAByte.Domain/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.resizable.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.resizable.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;z-index:99999;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px} -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/SendMessageModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.Web; 4 | 5 | namespace CryptAByte.WebUI.Models 6 | { 7 | public class SendMessageModel : IValidatableObject 8 | { 9 | [Display(Name = "Key Id")] 10 | [Required] 11 | [StringLength(16)] 12 | public string KeyToken { get; set; } 13 | 14 | //[Required] 15 | [Display(Name = "Message")] 16 | public string MessageText { get; set; } 17 | 18 | [Display(Name = "Select file (100MB max)")] 19 | public HttpPostedFileBase UploadFile { get; set; } 20 | 21 | public IEnumerable Validate(ValidationContext validationContext) 22 | { 23 | if ((!string.IsNullOrEmpty(MessageText) && UploadFile == null) || (string.IsNullOrEmpty(MessageText) && UploadFile != null)) 24 | yield return new ValidationResult("Either a message or a file is required."); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /CryptAByte.Domain/KeyManager/IRequestRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace CryptAByte.Domain.KeyManager 5 | { 6 | public interface IRequestRepository 7 | { 8 | void AddRequest(CryptoKey request); 9 | CryptoKey GetRequest(string token); 10 | 11 | Task AttachMessageToRequestAsync(string token, string plainTextMessage); 12 | Task AttachEncryptedMessageToRequestAsync(string token, string encryptedMessage, string encryptionKey); 13 | Task AttachFileToRequestAsync(string keyToken, byte[] fileData, string fileName); 14 | 15 | List GetDecryptedMessagesWithPrivateKey(string token, string privateKey); 16 | List GetDecryptedMessagesWithPassphrase(string token, string passphrase); 17 | List GetEncryptedMessages(string token, string privateKeyHash); 18 | 19 | Message GetMessageByMessageId(int messageId); 20 | void DeleteKeyWithPassphrase(string token, string passphrase); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @model CryptAByte.WebUI.Models.ContactFormModel 2 | @{ 3 | ViewBag.Title = "Contact Us"; 4 | } 5 | 6 |

Contact Us/Submit Feedback

7 | 8 | @using (Ajax.BeginForm("SubmitContact", "Home", new AjaxOptions() { OnSuccess = "ShowMessageSent", OnFailure = "OnError" })) 9 | { 10 | 11 |
12 | 13 |
14 | @Html.LabelFor(m => m.Name) 15 | @Html.EditorFor(m => m.Name) 16 | @Html.ValidationMessageFor(m => m.Name) 17 |
18 |
19 | @Html.LabelFor(m => m.Email) 20 | @Html.EditorFor(m => m.Email) 21 | @Html.ValidationMessageFor(m => m.Email) 22 |
23 |
24 | @Html.LabelFor(m => m.Message) 25 |
26 | @Html.TextAreaFor(m => m.Message, new { rows = 10, cols = 100 }) 27 | @Html.ValidationMessageFor(m => m.Message) 28 |
29 | 30 | 31 | 32 | 33 |
34 | 35 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/SelfDestruct/Read.cshtml: -------------------------------------------------------------------------------- 1 | @using CryptAByte.WebUI.Controllers 2 | @model CryptAByte.WebUI.Models.SelfDestructingMessageModel 3 | @{ 4 | ViewBag.Title = "Self-Destructing Messaging"; 5 | } 6 | 7 |

Self-Destructing Messaging

8 | 9 |

Note: the decrypted message below has been erased and can no longer 10 | be retrieved 11 | from this URL.

12 | 13 | @if (!Model.InvalidMessageId) 14 | { 15 |
16 | @Model.MessageText 17 |
18 | 19 | if (Model.HasAttachment) 20 | { 21 |

Download attachment:

22 |

Download 23 | Attached File @Model.AttachmentName

24 | 25 |

26 | Note: The secure link above is valid for @HomeController.PasswordExpiresInSeconds seconds, 27 | after which file will be permanently removed! 28 |

29 | 30 | } 31 | 32 | 33 | } 34 | else 35 | { 36 |

37 | @Model.MessageText 38 |

39 | } 40 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.accordion.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Accordion 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Accordion#theming 9 | */ 10 | /* IE/Win - Fix animation bug - #4615 */ 11 | .ui-accordion { width: 100%; } 12 | .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } 13 | .ui-accordion .ui-accordion-li-fix { display: inline; } 14 | .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } 15 | .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } 16 | .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } 17 | .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } 18 | .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } 19 | .ui-accordion .ui-accordion-content-active { display: block; } 20 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/SelfDestructingMessageModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace CryptAByte.WebUI.Models 8 | { 9 | public class SelfDestructingMessageModel 10 | { 11 | //[Required] 12 | //[StringLength(32)] 13 | //[DataType(DataType.Password)] 14 | //public string Passphrase { get; set; } 15 | 16 | [Required] 17 | [StringLength(200)] 18 | [RegularExpression(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Please enter a valid email address.")] 19 | public string Email { get; set; } 20 | 21 | [Required] 22 | [Display(Name = "Message")] 23 | [DataType(DataType.Text)] 24 | public string MessageText { get; set; } 25 | 26 | public bool InvalidMessageId { get; set; } 27 | 28 | public byte[] Attachment { get; set; } 29 | 30 | public string AttachmentName { get; set; } 31 | 32 | public string TemporaryDownloadId { get; set; } 33 | 34 | public bool HasAttachment { get; set; } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /CryptAByte.WindowsClient.Tests/CryptAByte.WindowsClient.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | CryptAByte.WindowsClient.Tests 6 | CryptAByte.WindowsClient.Tests 7 | false 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | all 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/RequestKeys.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | 3 |
4 |
5 |

Create Request

6 | 7 | 8 |
9 | 10 | 11 |
12 | 13 | 14 |
15 |
16 |

Attach Message

17 | 18 |
19 | 21 |
22 |
23 |

Get Messages

24 |
25 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/MessagesDetail.cshtml: -------------------------------------------------------------------------------- 1 | @using CryptAByte.Domain.KeyManager 2 | @using CryptAByte.WebUI.Controllers 3 | @model List 4 | @{Layout = null;} 5 | @if (@Model.Count == 0) 6 | { 7 | No messages sent to this key. 8 | } 9 | else 10 | { 11 |
    12 | @foreach (Message message in @Model) 13 | { 14 | if (message.IsFile) 15 | { 16 |
  • Sent @message.Created 17 |
    Download @message.MessageData
    18 |
  • 19 | } 20 | else 21 | { 22 |
  • Sent @message.Created 23 |
    @message.MessageData
    24 |
  • 25 | } 26 | } 27 |
28 | } 29 | @if (Model.Any(m => m.IsFile)) 30 | { 31 |

32 | Note: The link(s) above are valid for @HomeController.PasswordExpiresInSeconds seconds, after which the temporary download key will expire. 33 |

34 | } 35 | -------------------------------------------------------------------------------- /CryptoPad/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18034 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CryptoPad.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /OneTimePad/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace OneTimePad.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.dialog.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.dialog.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-dialog{position:absolute;padding:.2em;width:300px;overflow:hidden}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 16px .1em 0}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px}.ui-dialog .ui-dialog-titlebar-close:hover,.ui-dialog .ui-dialog-titlebar-close:focus{padding:0}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto;zoom:1}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move} -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17379 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CryptAByte.WindowsClient.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CryptAByte.WebUI.Tests/RouteTestHelpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Routing; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | using Moq; 6 | 7 | namespace CryptAByte.WebUI.Tests 8 | { 9 | public static class RouteTestHelpers 10 | { 11 | public static void AssertRoute(RouteCollection routes, string url, object expectations) 12 | { 13 | var httpContextMock = new Mock(); 14 | httpContextMock.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath) 15 | .Returns(url); 16 | 17 | RouteData routeData = routes.GetRouteData(httpContextMock.Object); 18 | Assert.IsNotNull(routeData); 19 | 20 | foreach (var kvp in new RouteValueDictionary(expectations)) 21 | { 22 | Assert.IsTrue(string.Equals(kvp.Value.ToString(), 23 | routeData.Values[kvp.Key].ToString(), 24 | StringComparison.OrdinalIgnoreCase) 25 | , string.Format("Expected '{0}', not '{1}' for '{2}'.", 26 | kvp.Value, routeData.Values[kvp.Key], kvp.Key)); 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.slider.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Slider 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Slider#theming 9 | */ 10 | .ui-slider { position: relative; text-align: left; } 11 | .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } 12 | .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } 13 | 14 | .ui-slider-horizontal { height: .8em; } 15 | .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } 16 | .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } 17 | .ui-slider-horizontal .ui-slider-range-min { left: 0; } 18 | .ui-slider-horizontal .ui-slider-range-max { right: 0; } 19 | 20 | .ui-slider-vertical { width: .8em; height: 100px; } 21 | .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } 22 | .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } 23 | .ui-slider-vertical .ui-slider-range-min { bottom: 0; } 24 | .ui-slider-vertical .ui-slider-range-max { top: 0; } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.resizable.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Resizable 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Resizable#theming 9 | */ 10 | .ui-resizable { position: relative;} 11 | .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } 12 | .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } 13 | .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } 14 | .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } 15 | .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } 16 | .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } 17 | .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } 18 | .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } 19 | .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } 20 | .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;} -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/SendMessage.cshtml: -------------------------------------------------------------------------------- 1 | @{ Layout = null;} 2 | @model CryptAByte.WebUI.Models.SendMessageModel 3 | @using (Html.BeginForm("SendMessage", "Home", FormMethod.Post, new { id = "SendMessageForm", enctype = "multipart/form-data" })) 4 | { 5 | 6 |
7 | 8 |
9 | 10 |

2: Send Messages & Files to a Key Id

11 |
12 | @Html.LabelFor(m => m.KeyToken) 13 | @Html.EditorFor(m => m.KeyToken) 14 | @Html.ValidationMessageFor(m => m.KeyToken) 15 |
16 |
17 | @Html.LabelFor(m => m.MessageText) 18 | @Html.TextAreaFor(m => m.MessageText, new { style = "width:90%; horiz-align:center;" }) 19 | @Html.ValidationMessageFor(m => m.MessageText) 20 |
21 |
22 | @Html.LabelFor(m => m.UploadFile) 23 | 24 |
25 |
26 |
0%
27 |
28 |
29 | 30 | 33 |
34 | } -------------------------------------------------------------------------------- /CryptAByte.Domain.Tests/SymetricCryptoTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CryptAByte.CryptoLibrary.CryptoProviders; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace CryptAByte.Domain.Tests 6 | { 7 | [TestClass] 8 | public class SymetricCryptoTests 9 | { 10 | private const string secret = "this is a secret"; 11 | const string password = "password"; 12 | 13 | [TestMethod] 14 | public void Encrypt_Decrypt_ReturnsOriginalValue() 15 | { 16 | var crypto = new SymmetricCryptoProvider(); 17 | 18 | var cryptoText = crypto.EncryptWithKey(secret, password); 19 | var original = crypto.DecryptWithKey(cryptoText, password); 20 | 21 | Assert.AreEqual(secret,original); 22 | 23 | } 24 | 25 | [TestMethod] 26 | public void Encrypt_Decrypt_Hash_ReturnsOriginalValue() 27 | { 28 | var crypto = new SymmetricCryptoProvider(); 29 | 30 | string hashedPassword = SymmetricCryptoProvider.GetSecureHashForString(password); 31 | 32 | var cryptoText = crypto.EncryptWithKey(secret, hashedPassword); 33 | var original = crypto.DecryptWithKey(cryptoText, hashedPassword); 34 | 35 | Assert.AreEqual(secret, original); 36 | 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CryptAByte.WebUI.Tests/CryptAByte.WebUI.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | CryptAByte.WebUI.Tests 6 | CryptAByte.WebUI.Tests 7 | false 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | runtime; build; native; contentfiles; analyzers; buildtransitive 20 | all 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.autocomplete.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Autocomplete 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Autocomplete#theming 9 | */ 10 | .ui-autocomplete { position: absolute; cursor: default; } 11 | 12 | /* workarounds */ 13 | * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ 14 | 15 | /* 16 | * jQuery UI Menu 1.8.19 17 | * 18 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 19 | * Dual licensed under the MIT or GPL Version 2 licenses. 20 | * http://jquery.org/license 21 | * 22 | * http://docs.jquery.com/UI/Menu#theming 23 | */ 24 | .ui-menu { 25 | list-style:none; 26 | padding: 2px; 27 | margin: 0; 28 | display:block; 29 | float: left; 30 | } 31 | .ui-menu .ui-menu { 32 | margin-top: -3px; 33 | } 34 | .ui-menu .ui-menu-item { 35 | margin:0; 36 | padding: 0; 37 | zoom: 1; 38 | float: left; 39 | clear: left; 40 | width: 100%; 41 | } 42 | .ui-menu .ui-menu-item a { 43 | text-decoration:none; 44 | display:block; 45 | padding:.2em .4em; 46 | line-height:1.5; 47 | zoom:1; 48 | } 49 | .ui-menu .ui-menu-item a.ui-state-hover, 50 | .ui-menu .ui-menu-item a.ui-state-active { 51 | font-weight: normal; 52 | margin: -1px; 53 | } 54 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/SelfDestruct/Send.cshtml: -------------------------------------------------------------------------------- 1 | @model CryptAByte.WebUI.Models.SelfDestructingMessageModel 2 | 3 |
4 | 5 | 17 | 18 |
19 | 20 |

Send a message:

21 | 22 | @using (Ajax.BeginForm("Send", "SelfDestruct", new AjaxOptions() { OnBegin = "OnBegin", OnComplete = "OnComplete", OnSuccess = "OnSendMessage", UpdateTargetId = "MessageResult", OnFailure = "OnError" })) 23 | { 24 |
25 | @Html.LabelFor(m => m.Email) 26 | @Html.EditorFor(m => m.Email) 27 | @Html.ValidationMessageFor(m => m.Email) 28 |
29 |
30 | @Html.LabelFor(m => m.MessageText) 31 |
32 | @Html.TextAreaFor(m => m.MessageText, new { style = "width:90%; horiz-align:center;", rows=10 }) 33 | @Html.ValidationMessageFor(m => m.MessageText) 34 |
35 | 38 | 39 | } 40 |
41 | -------------------------------------------------------------------------------- /CryptAByte.WebUI.Tests/HomePageTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Routing; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | using Moq; 6 | 7 | namespace CryptAByte.WebUI.Tests 8 | { 9 | [TestClass] 10 | public class HomePageTests 11 | { 12 | [TestMethod] 13 | public void CanMapNormalControllerActionRoute() 14 | { 15 | var routes = new RouteCollection(); 16 | MvcApplication.RegisterRoutes(routes); 17 | 18 | var httpContextMock = new Mock(); 19 | httpContextMock.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath) 20 | .Returns("~/Service/Create"); 21 | 22 | RouteData routeData = routes.GetRouteData(httpContextMock.Object); 23 | Assert.IsNotNull(routeData); 24 | Assert.AreEqual("Service", routeData.Values["Controller"]); 25 | Assert.AreEqual("Create", routeData.Values["action"]); 26 | } 27 | 28 | [TestMethod] 29 | [Ignore] 30 | public void RouteHasDefaultActionWhenUrlWithoutAction() 31 | { 32 | var routes = new RouteCollection(); 33 | MvcApplication.RegisterRoutes(routes); 34 | 35 | RouteTestHelpers.AssertRoute(routes, "~/7b6962ab6784cc1f", new { controller = "Home", action = "Details" }); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Password/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | @{ 3 | Page.Title = "Memorable Password Generator"; 4 | } 5 | 6 |

Memorable Password Generator

7 | 8 | 9 | 10 | 11 |
12 |

Generates strong passwords that are easy to remember. 13 |
14 | This service runs in your browser for maximum security. 15 |

16 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 27 | 28 | 29 |

Password: 30 | 31 |

32 |         
33 |

34 | 35 | 36 | 37 | 38 |
39 | 40 | 41 |
42 | 43 | See also: Strong Password Generator 44 | 45 | Algorithm Source 46 | 47 | 48 |
49 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/NewKeyDetails.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | var URL = "https://" + Request.Url.Host + "#" + @Model.URI; 4 | } 5 | @model CryptAByte.Domain.KeyManager.CryptoKey 6 |
7 |

8 | 9 | 10 | 11 |

12 | Share this URL to securely attach files and messages to this key. 13 |

14 |
15 |
16 |

17 |

18 |
19 |

20 | Passphrase: 21 | Passphrase: @ViewBag.Passphrase 22 |

23 |
24 |

25 | Only someone with this passphrase can decrypt the messages and files sent to this 26 | address. 27 |

28 | @*

29 | You can use the offline app (coming soon) to encrypt the secret message offline, 30 | then upload them to this account. 31 |

*@ 32 |
33 | -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Windows.Forms; 6 | 7 | namespace CryptAByte.WindowsClient 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | // ResolveAssemblies(); 18 | 19 | Application.EnableVisualStyles(); 20 | Application.SetCompatibleTextRenderingDefault(false); 21 | Application.Run(new Main()); 22 | } 23 | 24 | private static void ResolveAssemblies() 25 | { 26 | AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => 27 | { 28 | String resourceName = "AssemblyLoadingAndReflection." + 29 | 30 | new AssemblyName(args.Name).Name + ".dll"; 31 | 32 | using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) 33 | { 34 | 35 | Byte[] assemblyData = new Byte[stream.Length]; 36 | 37 | stream.Read(assemblyData, 0, assemblyData.Length); 38 | 39 | return Assembly.Load(assemblyData); 40 | 41 | } 42 | 43 | }; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CryptAByte.WebUI.Tests/Controllers/HomeControllerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.Mvc; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using Moq; 8 | using CryptAByte.Domain.KeyManager; 9 | using CryptAByte.WebUI; 10 | using CryptAByte.WebUI.Controllers; 11 | 12 | namespace CryptAByte.WebUI.Tests.Controllers 13 | { 14 | [TestClass] 15 | public class HomeControllerTest 16 | { 17 | [TestMethod] 18 | public void Index() 19 | { 20 | // Arrange 21 | var requestRepository = new Mock(); 22 | HomeController controller = new HomeController(requestRepository.Object); 23 | 24 | // Act 25 | ViewResult result = controller.Index() as ViewResult; 26 | 27 | // Assert 28 | Assert.AreEqual("Welcome to ASP.NET MVC!", result.ViewBag.Message); 29 | } 30 | 31 | [TestMethod] 32 | public void About() 33 | { 34 | // Arrange 35 | var requestRepository = new Mock(); 36 | HomeController controller = new HomeController(requestRepository.Object); 37 | 38 | // Act 39 | ViewResult result = controller.About() as ViewResult; 40 | 41 | // Assert 42 | Assert.IsNotNull(result); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.dialog.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Dialog 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Dialog#theming 9 | */ 10 | .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } 11 | .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } 12 | .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } 13 | .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } 14 | .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } 15 | .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } 16 | .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } 17 | .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } 18 | .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } 19 | .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } 20 | .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } 21 | .ui-draggable .ui-dialog-titlebar { cursor: move; } 22 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.tabs.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Tabs 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Tabs#theming 9 | */ 10 | .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ 11 | .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } 12 | .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } 13 | .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } 14 | .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } 15 | .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } 16 | .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ 17 | .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } 18 | .ui-tabs .ui-tabs-hide { display: none !important; } 19 | -------------------------------------------------------------------------------- /CryptAByte.Domain/Services/IEmailService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace CryptAByte.Domain.Services 5 | { 6 | public interface IEmailService 7 | { 8 | /// 9 | /// Asynchronously sends an email notification using the default sender address. 10 | /// 11 | /// Recipient email address. 12 | /// Email subject. 13 | /// Email body content. 14 | /// Cancellation token to cancel the operation. 15 | Task SendEmailAsync(string recipientAddress, string subject, string bodyContent, CancellationToken cancellationToken = default); 16 | 17 | /// 18 | /// Asynchronously sends an email notification from a specific sender address. 19 | /// 20 | /// Sender email address. 21 | /// Recipient email address. 22 | /// Email subject. 23 | /// Email body content. 24 | /// Cancellation token to cancel the operation. 25 | Task SendEmailAsync(string senderAddress, string recipientAddress, string subject, string bodyContent, CancellationToken cancellationToken = default); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.core.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Theming/API 9 | */ 10 | 11 | /* Layout helpers 12 | ----------------------------------*/ 13 | .ui-helper-hidden { display: none; } 14 | .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } 15 | .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } 16 | .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; } 17 | .ui-helper-clearfix:after { clear: both; } 18 | .ui-helper-clearfix { zoom: 1; } 19 | .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } 20 | 21 | 22 | /* Interaction Cues 23 | ----------------------------------*/ 24 | .ui-state-disabled { cursor: default !important; } 25 | 26 | 27 | /* Icons 28 | ----------------------------------*/ 29 | 30 | /* states and images */ 31 | .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } 32 | 33 | 34 | /* Misc visuals 35 | ----------------------------------*/ 36 | 37 | /* Overlays */ 38 | .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } 39 | -------------------------------------------------------------------------------- /CryptAByte.Domain/Functional/ITimeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CryptAByte.Domain.Functional 4 | { 5 | /// 6 | /// Abstraction for providing the current time. 7 | /// This enables pure functions by making time an explicit dependency rather than a hidden side effect. 8 | /// 9 | public interface ITimeProvider 10 | { 11 | /// 12 | /// Gets the current date and time in the local time zone. 13 | /// 14 | DateTime Now { get; } 15 | 16 | /// 17 | /// Gets the current date and time in Coordinated Universal Time (UTC). 18 | /// 19 | DateTime UtcNow { get; } 20 | } 21 | 22 | /// 23 | /// Default implementation that returns the system's current time. 24 | /// 25 | public sealed class SystemTimeProvider : ITimeProvider 26 | { 27 | public DateTime Now => DateTime.Now; 28 | public DateTime UtcNow => DateTime.UtcNow; 29 | } 30 | 31 | /// 32 | /// Fixed time provider for testing and deterministic behavior. 33 | /// 34 | public sealed class FixedTimeProvider : ITimeProvider 35 | { 36 | private readonly DateTime _fixedTime; 37 | 38 | public FixedTimeProvider(DateTime fixedTime) 39 | { 40 | _fixedTime = fixedTime; 41 | } 42 | 43 | public DateTime Now => _fixedTime; 44 | public DateTime UtcNow => _fixedTime.ToUniversalTime(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CryptAByte.WebUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CryptAByte.WebUI")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("42711bda-f0a9-41d6-a7f0-326bdc25bcf6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /CryptoPad/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("CryptoPad")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("David Veksler")] 12 | [assembly: AssemblyProduct("CryptoPad")] 13 | [assembly: AssemblyCopyright("Copyright © David Veksler 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("0dbc8711-985f-45c2-9119-f5da91cc8dd8")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /CryptAByte.WebUI.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CryptAByte.WebUI.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CryptAByte.WebUI.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("889dd55b-fd08-4213-b72e-1f17e6a2174c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /OneTimePad/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OneTimePad")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("OneTimePad")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a622eeb2-7ceb-499f-842b-ec9243930c75")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CryptAByte.Domain.Tests/CryptAByte.Domain.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | CryptAByte.Domain.Tests 6 | CryptAByte.Domain.Tests 7 | false 8 | true 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | runtime; build; native; contentfiles; analyzers; buildtransitive 21 | all 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | PreserveNewest 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /CryptAByte.CryptoLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("CryptAByte.CryptoLibrary")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CryptAByte.CryptoLibrary")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("976ec7f9-64c9-48bb-9263-1125c0a96b89")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /CryptAByte.Domain/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CryptAByte.Domain")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CryptAByte.Domain")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("77f0e323-feec-4edf-aed6-dcccbe1399fa")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CryptAByte.Domain.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CryptAByte.Domain.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CryptAByte.Domain.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("54803095-f980-453b-ba86-3e4c92eebde7")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CryptAByte.WindowsClient")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CryptAByte.WindowsClient")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f9701640-344e-473f-8e8a-ba6608a29d8c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CryptAByte.WindowsClient.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CryptAByte.WindowsClient.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CryptAByte.WindowsClient.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("98f6ec11-5cea-48f0-8fb9-cc041b05f756")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/Subscribe.cshtml: -------------------------------------------------------------------------------- 1 | @using CryptAByte.WebUI.Models 2 | @model CryptAByte.WebUI.Models.ContactFormModel 3 | 4 | 5 | @*@using (Ajax.BeginForm("Subscribe", "Home", new AjaxOptions() { OnSuccess = "ShowMessageSent", OnFailure = "OnError" })) 6 | { 7 |
8 | 9 |
10 | @Html.LabelFor(m=> m.Email) 11 | @Html.TextBoxFor(m=> m.Email) 12 | @Html.ValidationMessageFor(m=> m.Email) 13 |
14 | 15 |
16 | }*@ 17 | 18 | 19 | 20 | 21 | 26 |
27 |
28 | 29 | 30 |
31 |
32 |
33 | 34 | -------------------------------------------------------------------------------- /CryptAByte.WindowsClient.Tests/ServiceProxyTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | 7 | namespace CryptAByte.WindowsClient.Tests 8 | { 9 | [TestClass] 10 | public class ServiceProxyTests 11 | { 12 | private const string passphrase = "password"; 13 | 14 | [TestMethod] 15 | public void CreateKeyReturnsKey() 16 | { 17 | var proxy = new CryptAByte.WindowsClient.Commands.ServiceProxy { ServiceUrl = "http://localhost:60888/Service/" }; 18 | 19 | var key = proxy.CreateKey(passphrase); 20 | 21 | Assert.IsTrue(key.KeyId > 0); 22 | } 23 | 24 | [TestMethod] 25 | public void SendMessageReturnsOK() 26 | { 27 | var proxy = new CryptAByte.WindowsClient.Commands.ServiceProxy { ServiceUrl = "http://localhost:60888/Service/" }; 28 | 29 | var key = proxy.CreateKey(passphrase); 30 | 31 | bool success = proxy.SendMessage(key.KeyToken, "secret"); 32 | 33 | Assert.IsTrue(success); 34 | } 35 | 36 | [TestMethod] 37 | public void GetMessagesReturnsMessages() 38 | { 39 | var proxy = new CryptAByte.WindowsClient.Commands.ServiceProxy { ServiceUrl = "http://localhost:60888/Service/" }; 40 | 41 | var key = proxy.CreateKey(passphrase); 42 | 43 | proxy.SendMessage(key.KeyToken, "secret"); 44 | 45 | var messages = proxy.GetMessages(key.KeyToken, passphrase); 46 | 47 | Assert.IsTrue(messages.Count > 0); 48 | } 49 | 50 | 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Account/LogOn.cshtml: -------------------------------------------------------------------------------- 1 | @model CryptAByte.WebUI.Models.LogOnModel 2 | 3 | @{ 4 | ViewBag.Title = "Log On"; 5 | } 6 | 7 |

Log On

8 |

9 | Please enter your user name and password. @Html.ActionLink("Register", "Register") if you don't have an account. 10 |

11 | 12 | 13 | 14 | 15 | @Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.") 16 | 17 | @using (Html.BeginForm()) { 18 |
19 |
20 | Account Information 21 | 22 |
23 | @Html.LabelFor(m => m.UserName) 24 |
25 |
26 | @Html.TextBoxFor(m => m.UserName) 27 | @Html.ValidationMessageFor(m => m.UserName) 28 |
29 | 30 |
31 | @Html.LabelFor(m => m.Password) 32 |
33 |
34 | @Html.PasswordFor(m => m.Password) 35 | @Html.ValidationMessageFor(m => m.Password) 36 |
37 | 38 |
39 | @Html.CheckBoxFor(m => m.RememberMe) 40 | @Html.LabelFor(m => m.RememberMe) 41 |
42 | 43 |

44 | 45 |

46 |
47 |
48 | } 49 | -------------------------------------------------------------------------------- /CryptAByte.Domain/Validation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace CryptAByte.Domain 6 | { 7 | public static class Validation 8 | { 9 | public static bool IsValidEmail(string strIn) 10 | { 11 | if (String.IsNullOrEmpty(strIn)) 12 | return false; 13 | 14 | // Use IdnMapping class to convert Unicode domain names. 15 | strIn = Regex.Replace(strIn, @"(@)(.+)$", DomainMapper); 16 | 17 | // ReSharper disable HeuristicUnreachableCode 18 | if (strIn == null) return false; 19 | // ReSharper restore HeuristicUnreachableCode 20 | 21 | 22 | // Return true if strIn is in valid e-mail format. 23 | return Regex.IsMatch(strIn, 24 | @"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + 25 | @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$", 26 | RegexOptions.IgnoreCase); 27 | 28 | } 29 | 30 | private static string DomainMapper(Match match) 31 | { 32 | // IdnMapping class with default property values. 33 | IdnMapping idn = new IdnMapping(); 34 | 35 | string domainName = match.Groups[2].Value; 36 | try 37 | { 38 | domainName = idn.GetAscii(domainName); 39 | } 40 | catch (ArgumentException) 41 | { 42 | return null; 43 | } 44 | return match.Groups[1].Value + domainName; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /CryptAByte.Domain/Migrations/Configuration.cs: -------------------------------------------------------------------------------- 1 | namespace CryptAByte.Domain.Migrations 2 | { 3 | using System; 4 | using System.Data.Entity; 5 | using System.Data.Entity.Migrations; 6 | using System.Linq; 7 | 8 | public partial class MyMigration : DbMigration 9 | { 10 | public override void Up() 11 | { 12 | CreateTable( 13 | "dbo.Messags", 14 | c => new 15 | { 16 | Created = c.DateTime(nullable: false, defaultValueSql: "GETDATE()"), 17 | }); 18 | //.PrimaryKey(t => t.); 19 | } 20 | } 21 | 22 | internal sealed class Configuration : DbMigrationsConfiguration 23 | { 24 | public Configuration() 25 | { 26 | AutomaticMigrationsEnabled = true; 27 | AutomaticMigrationDataLossAllowed = false; 28 | 29 | } 30 | 31 | 32 | protected override void Seed(CryptAByte.Domain.DataContext.CryptAByteContext context) 33 | { 34 | // This method will be called after migrating to the latest version. 35 | 36 | // You can use the DbSet.AddOrUpdate() helper extension method 37 | // to avoid creating duplicate seed data. E.g. 38 | // 39 | // context.People.AddOrUpdate( 40 | // p => p.FullName, 41 | // new Person { FullName = "Andrew Peters" }, 42 | // new Person { FullName = "Brice Lambson" }, 43 | // new Person { FullName = "Rowan Miller" } 44 | // ); 45 | // 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /OneTimePad/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /CryptAByte.Domain/DataAnnotations/ConditionalRequiredAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.Linq.Expressions; 4 | 5 | namespace CryptAByte.Domain.DataAnnotations 6 | { 7 | /*** TODO: Add client side validation support */ 8 | public sealed class ConditionalRequiredAttribute : RequiredAttribute 9 | { 10 | public ConditionalRequiredAttribute(Expression> predicate) 11 | { 12 | this.Predicate = predicate; 13 | } 14 | 15 | public Expression> Predicate { get; set; } 16 | private Func Func { get; set; } 17 | 18 | protected override ValidationResult IsValid(object value, ValidationContext validationContext) 19 | { 20 | if (validationContext == null) 21 | { 22 | throw new NotSupportedException(); 23 | } 24 | 25 | this.SetupFunc(); 26 | 27 | // if condition doesn't match, validation success. 28 | if (!this.Func.Invoke(validationContext.ObjectInstance)) 29 | { 30 | return ValidationResult.Success; 31 | } 32 | 33 | // if the condition matches, the value is required 34 | return base.IsValid(value, validationContext); 35 | } 36 | 37 | private void SetupFunc() 38 | { 39 | if (this.Func == null) 40 | { 41 | if (this.Predicate == null) 42 | { 43 | throw new InvalidOperationException("The predicate must be set to a valid Boolean expression."); 44 | } 45 | this.Func = this.Predicate.Compile(); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **CryptAByte** 2 | ========== 3 | 4 | CryptAByte.com is a free online drop box that enables secure (encrypted) message and file sharing over the web using a public-key infrastructure. 5 | 6 | Messages and files are encrypted using a public key and can only be decrypted using the passphrase entered when your key is created. Your data is never stored in plaintext, and is impossible to decrypt without your passphrase. 7 | 8 | ========== 9 | 10 | Crypt-A-Byte uses public-key encryption just like HTTPS/SSL and OpenPGP/PGP. We encourage you to use these tools whenever possible. 11 | 12 | However, PGP requires that you and your recipient install and configure encryption software and create and exchange key pairs. When this is not practical, we make it very simple (and free) to share data using the same algorithms over the web. 13 | 14 | We use RSA for key pairs, encrypt messages and files using AES 256, and SHA256 for hashing. 15 | 16 | ========== 17 | 18 | CryptoPad is a simple AES256 encryption/decryption app. 19 | 20 | OneTimePad generates one time pads. 21 | 22 | ========== 23 | 24 | **Screenshots** 25 | 26 | ![CryptAByte Windows CLient](https://raw.github.com/DavidVeksler/CryptAByte/master/screenshots/WinClient.png) 27 | 28 | ![CryptoPad](https://raw.github.com/DavidVeksler/CryptAByte/master/screenshots/cryptopad.png) 29 | 30 | ![OneTimePad](https://raw.github.com/DavidVeksler/CryptAByte/master/screenshots/OneTimePad.png) 31 | 32 | ![Website](https://raw.github.com/DavidVeksler/CryptAByte/master/screenshots/Website.png) 33 | 34 | 35 | 36 | ========== 37 | **Using ILMerge to create a single binary** 38 | 39 | *ILMerge.exe /target:CryptoPad /out:CryptoPad2.exe /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" CryptoPad.exe CryptAByte.CryptoLibrary.dll* 40 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/NewKeyModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace CryptAByte.WebUI.Models 8 | { 9 | public class NewKeyModel 10 | { 11 | public NewKeyModel() 12 | { 13 | ReleaseDate = DateTime.Now.ToUniversalTime(); 14 | } 15 | 16 | [DataType(DataType.Password)] 17 | [StringLength(128)] 18 | [Display(Name = "Passphrase (optional)")] 19 | public string Passphrase { get; set; } 20 | 21 | [Display(Name = "RSA Public Key")] 22 | public string PublicKey { get; set; } 23 | 24 | [Display(Name = "SHA256 hash of private key (only used to authenticate API message requests)")] 25 | public string PrivateKeyHash { get; set; } 26 | 27 | [Display(Name = "Burn After Reading: successfuly retrieving messages will delete all messages")] 28 | public bool DeleteMessagesAfterReading { get; set; } 29 | 30 | [Display(Name = "Burn Notice: retrieving messages will delete all messages and the key so no future messages can be delivered")] 31 | public bool DeleteKeyAfterReading { get; set; } 32 | 33 | [Display(Name = "Release Date: messages can be delivered, but cannot be retrieved before this (UTC) date")] 34 | public DateTime? ReleaseDate { get; set; } 35 | 36 | [Display(Name = "Lock Date: no messages can be delivered after this date")] 37 | public DateTime? LockDate { get; set; } 38 | 39 | [Display(Name = "Notify Me: send an email to this address when messages are received")] 40 | [RegularExpression(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Please enter a valid email address")] 41 | public string NotifyEmail { get; set; } 42 | 43 | } 44 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/XmlResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Xml.Serialization; 7 | 8 | namespace CryptAByte.WebUI.Models 9 | { 10 | public class XmlResult : ActionResult 11 | { 12 | private object objectToSerialize; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The object to serialize to XML. 18 | public XmlResult(object objectToSerialize) 19 | { 20 | this.objectToSerialize = objectToSerialize; 21 | } 22 | 23 | /// 24 | /// Gets the object to be serialized to XML. 25 | /// 26 | public object ObjectToSerialize 27 | { 28 | get { return this.objectToSerialize; } 29 | } 30 | 31 | /// 32 | /// Serialises the object that was passed into the constructor to XML and writes the corresponding XML to the result stream. 33 | /// 34 | /// The controller context for the current request. 35 | public override void ExecuteResult(ControllerContext context) 36 | { 37 | if (this.objectToSerialize != null) 38 | { 39 | context.HttpContext.Response.Clear(); 40 | XmlRootAttribute root = new XmlRootAttribute("response"); 41 | 42 | var xs = new System.Xml.Serialization.XmlSerializer(this.objectToSerialize.GetType(), root); 43 | context.HttpContext.Response.ContentType = "text/xml"; 44 | 45 | xs.Serialize(context.HttpContext.Response.Output, this.objectToSerialize); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.button.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.button.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;text-decoration:none!important;cursor:pointer;text-align:center;zoom:1;overflow:visible}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:1.4}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner{border:0;padding:0} -------------------------------------------------------------------------------- /CryptAByte.Domain.Tests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Account/ChangePassword.cshtml: -------------------------------------------------------------------------------- 1 | @model CryptAByte.WebUI.Models.ChangePasswordModel 2 | 3 | @{ 4 | ViewBag.Title = "Change Password"; 5 | } 6 | 7 |

Change Password

8 |

9 | Use the form below to change your password. 10 |

11 |

12 | New passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length. 13 |

14 | 15 | 16 | 17 | 18 | @using (Html.BeginForm()) { 19 | @Html.ValidationSummary(true, "Password change was unsuccessful. Please correct the errors and try again.") 20 |
21 |
22 | Account Information 23 | 24 |
25 | @Html.LabelFor(m => m.OldPassword) 26 |
27 |
28 | @Html.PasswordFor(m => m.OldPassword) 29 | @Html.ValidationMessageFor(m => m.OldPassword) 30 |
31 | 32 |
33 | @Html.LabelFor(m => m.NewPassword) 34 |
35 |
36 | @Html.PasswordFor(m => m.NewPassword) 37 | @Html.ValidationMessageFor(m => m.NewPassword) 38 |
39 | 40 |
41 | @Html.LabelFor(m => m.ConfirmPassword) 42 |
43 |
44 | @Html.PasswordFor(m => m.ConfirmPassword) 45 | @Html.ValidationMessageFor(m => m.ConfirmPassword) 46 |
47 | 48 |

49 | 50 |

51 |
52 |
53 | } 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | # NuGet Packages Directory 82 | packages 83 | 84 | # Windows Azure Build Output 85 | csx 86 | *.build.csdef 87 | 88 | # Windows Store app package directory 89 | AppPackages/ 90 | 91 | # Others 92 | [Bb]in 93 | [Oo]bj 94 | sql 95 | TestResults 96 | [Tt]est[Rr]esult* 97 | *.Cache 98 | ClientBin 99 | [Ss]tyle[Cc]op.* 100 | ~$* 101 | *.dbmdl 102 | Generated_Code #added for RIA/Silverlight projects 103 | 104 | # Backup & report files from converting an old project file to a newer 105 | # Visual Studio version. Backup files are not needed, because we have git ;-) 106 | _UpgradeReport_Files/ 107 | Backup*/ 108 | UpgradeLog*.XML 109 | /.nuget 110 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Data.Entity.Infrastructure; 5 | using System.Linq; 6 | using System.Web; 7 | using System.Web.Mvc; 8 | using System.Web.Routing; 9 | using CryptAByte.Domain.KeyManager; 10 | using CryptAByte.WebUI.Constraints; 11 | 12 | namespace CryptAByte.WebUI 13 | { 14 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 15 | // visit http://go.microsoft.com/?LinkId=9394801 16 | 17 | public class MvcApplication : System.Web.HttpApplication 18 | { 19 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 20 | { 21 | filters.Add(new HandleErrorAttribute()); 22 | } 23 | 24 | public static void RegisterRoutes(RouteCollection routes) 25 | { 26 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 27 | 28 | // routes.MapRoute( 29 | // "keyURI", // Route name 30 | // "{key}", // URL with parameters 31 | // new { controller = "Home", action = "Index" }, 32 | // new {key = new ValidKeyConstraint()} 33 | //); 34 | 35 | routes.MapRoute( 36 | "Default", // Route name 37 | "{controller}/{action}/{id}", // URL with parameters 38 | new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 39 | ); 40 | 41 | } 42 | 43 | protected void Application_Start() 44 | { 45 | AreaRegistration.RegisterAllAreas(); 46 | 47 | // Use LocalDB for Entity Framework by default 48 | //Database.DefaultConnectionFactory = new SqlConnectionFactory("Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True"); 49 | 50 | //Database.SetInitializer(new MigrateDatabaseToLatestVersion()); 51 | 52 | 53 | RegisterGlobalFilters(GlobalFilters.Filters); 54 | RegisterRoutes(RouteTable.Routes); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Scripts/password-generator.js: -------------------------------------------------------------------------------- 1 | /* 2 | * password-generator 3 | * Copyright(c) 2011-2013 Bermi Ferrer 4 | * MIT Licensed 5 | */ 6 | (function (root) { 7 | 8 | var localName, consonant, letter, password, vowel; 9 | letter = /[a-zA-Z]$/; 10 | vowel = /[aeiouAEIOU]$/; 11 | consonant = /[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]$/; 12 | 13 | 14 | // Defines the name of the local variable the passwordGenerator library will use 15 | // this is specially useful if window.passwordGenerator is already being used 16 | // by your application and you want a different name. For example: 17 | // // Declare before including the passwordGenerator library 18 | // var localPasswordGeneratorLibraryName = 'pass'; 19 | localName = root.localPasswordGeneratorLibraryName || "generatePassword", 20 | 21 | password = function (length, memorable, pattern, prefix) { 22 | var char, n; 23 | if (length == null) { 24 | length = 10; 25 | } 26 | if (memorable == null) { 27 | memorable = true; 28 | } 29 | if (pattern == null) { 30 | pattern = /\w/; 31 | } 32 | if (prefix == null) { 33 | prefix = ''; 34 | } 35 | if (prefix.length >= length) { 36 | return prefix; 37 | } 38 | if (memorable) { 39 | if (prefix.match(consonant)) { 40 | pattern = vowel; 41 | } else { 42 | pattern = consonant; 43 | } 44 | } 45 | n = (Math.floor(Math.random() * 100) % 94) + 33; 46 | char = String.fromCharCode(n); 47 | if (memorable) { 48 | char = char.toLowerCase(); 49 | } 50 | if (!char.match(pattern)) { 51 | return password(length, memorable, pattern, prefix); 52 | } 53 | return password(length, memorable, pattern, "" + prefix + char); 54 | }; 55 | 56 | 57 | ((typeof exports !== 'undefined') ? exports : root)[localName] = password; 58 | if (typeof exports !== 'undefined') { 59 | if (typeof module !== 'undefined' && module.exports) { 60 | module.exports = password; 61 | } 62 | } 63 | 64 | // Establish the root object, `window` in the browser, or `global` on the server. 65 | }(this)); -------------------------------------------------------------------------------- /CryptAByte.Domain/DataAnnotations/RequiredIfAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace CryptAByte.Domain.DataAnnotations 5 | { 6 | //http://www.devtrends.co.uk/blog/the-complete-guide-to-validation-in-asp.net-mvc-3-part-2 7 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] 8 | public sealed class RequiredIfAttribute : ValidationAttribute 9 | { 10 | public string OtherProperty { get; private set; } 11 | public Comparison Comparison { get; private set; } 12 | public object Value { get; private set; } 13 | private const string DefaultErrorMessageFormatString = "The {0} field is required."; 14 | 15 | public RequiredIfAttribute(string otherProperty, Comparison comparison, object value) 16 | { 17 | if (string.IsNullOrEmpty(otherProperty)) 18 | throw new ArgumentNullException("otherProperty"); 19 | 20 | OtherProperty = otherProperty; 21 | Comparison = comparison; 22 | Value = value; 23 | ErrorMessage = DefaultErrorMessageFormatString; 24 | } 25 | 26 | protected override ValidationResult IsValid(object value, ValidationContext validationContext) 27 | { 28 | if (value == null) 29 | { 30 | var otherProperty = validationContext.ObjectType.GetProperty(OtherProperty); 31 | var otherPropertyValue = otherProperty.GetValue(validationContext.ObjectInstance, null); 32 | 33 | if (ConditionIsMet(otherPropertyValue)) 34 | return new ValidationResult(string.Format(ErrorMessageString, validationContext.DisplayName)); 35 | } 36 | return ValidationResult.Success; 37 | } 38 | 39 | private bool ConditionIsMet(object actualPropertyValue) 40 | { 41 | var areEqual = actualPropertyValue != null && actualPropertyValue.Equals(Value); 42 | return Comparison == Comparison.IsEqualTo ? areEqual : !areEqual; 43 | } 44 | } 45 | 46 | public enum Comparison 47 | { 48 | IsEqualTo, 49 | IsNotEqualTo 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Account/Register.cshtml: -------------------------------------------------------------------------------- 1 | @model CryptAByte.WebUI.Models.RegisterModel 2 | 3 | @{ 4 | ViewBag.Title = "Register"; 5 | } 6 | 7 |

Create a New Account

8 |

9 | Use the form below to create a new account. 10 |

11 |

12 | Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length. 13 |

14 | 15 | 16 | 17 | 18 | @using (Html.BeginForm()) { 19 | @Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.") 20 |
21 |
22 | Account Information 23 | 24 |
25 | @Html.LabelFor(m => m.UserName) 26 |
27 |
28 | @Html.TextBoxFor(m => m.UserName) 29 | @Html.ValidationMessageFor(m => m.UserName) 30 |
31 | 32 |
33 | @Html.LabelFor(m => m.Email) 34 |
35 |
36 | @Html.TextBoxFor(m => m.Email) 37 | @Html.ValidationMessageFor(m => m.Email) 38 |
39 | 40 |
41 | @Html.LabelFor(m => m.Password) 42 |
43 |
44 | @Html.PasswordFor(m => m.Password) 45 | @Html.ValidationMessageFor(m => m.Password) 46 |
47 | 48 |
49 | @Html.LabelFor(m => m.ConfirmPassword) 50 |
51 |
52 | @Html.PasswordFor(m => m.ConfirmPassword) 53 | @Html.ValidationMessageFor(m => m.ConfirmPassword) 54 |
55 | 56 |

57 | 58 |

59 |
60 |
61 | } 62 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Models/AccountModels.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Globalization; 5 | using System.Web.Mvc; 6 | using System.Web.Security; 7 | 8 | namespace CryptAByte.WebUI.Models 9 | { 10 | 11 | public class ChangePasswordModel 12 | { 13 | [Required] 14 | [DataType(DataType.Password)] 15 | [Display(Name = "Current password")] 16 | public string OldPassword { get; set; } 17 | 18 | [Required] 19 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 20 | [DataType(DataType.Password)] 21 | [Display(Name = "New password")] 22 | public string NewPassword { get; set; } 23 | 24 | [DataType(DataType.Password)] 25 | [Display(Name = "Confirm new password")] 26 | [System.Web.Mvc.Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 27 | public string ConfirmPassword { get; set; } 28 | } 29 | 30 | public class LogOnModel 31 | { 32 | [Required] 33 | [Display(Name = "User name")] 34 | public string UserName { get; set; } 35 | 36 | [Required] 37 | [DataType(DataType.Password)] 38 | [Display(Name = "Password")] 39 | public string Password { get; set; } 40 | 41 | [Display(Name = "Remember me?")] 42 | public bool RememberMe { get; set; } 43 | } 44 | 45 | public class RegisterModel 46 | { 47 | [Required] 48 | [Display(Name = "User name")] 49 | public string UserName { get; set; } 50 | 51 | [Required] 52 | [DataType(DataType.EmailAddress)] 53 | [Display(Name = "Email address")] 54 | public string Email { get; set; } 55 | 56 | [Required] 57 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 58 | [DataType(DataType.Password)] 59 | [Display(Name = "Password")] 60 | public string Password { get; set; } 61 | 62 | [DataType(DataType.Password)] 63 | [Display(Name = "Confirm password")] 64 | [System.Web.Mvc.Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 65 | public string ConfirmPassword { get; set; } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/App_Start/NinjectWebCommon.cs: -------------------------------------------------------------------------------- 1 | using CryptAByte.Domain.KeyManager; 2 | using CryptAByte.Domain.SelfDestructingMessaging; 3 | 4 | [assembly: WebActivator.PreApplicationStartMethod(typeof(CryptAByte.WebUI.App_Start.NinjectWebCommon), "Start")] 5 | [assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(CryptAByte.WebUI.App_Start.NinjectWebCommon), "Stop")] 6 | 7 | namespace CryptAByte.WebUI.App_Start 8 | { 9 | using System; 10 | using System.Web; 11 | 12 | using Microsoft.Web.Infrastructure.DynamicModuleHelper; 13 | 14 | using Ninject; 15 | using Ninject.Web.Common; 16 | 17 | public static class NinjectWebCommon 18 | { 19 | private static readonly Bootstrapper bootstrapper = new Bootstrapper(); 20 | 21 | /// 22 | /// Starts the application 23 | /// 24 | public static void Start() 25 | { 26 | DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule)); 27 | DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule)); 28 | bootstrapper.Initialize(CreateKernel); 29 | } 30 | 31 | /// 32 | /// Stops the application. 33 | /// 34 | public static void Stop() 35 | { 36 | bootstrapper.ShutDown(); 37 | } 38 | 39 | /// 40 | /// Creates the kernel that will manage your application. 41 | /// 42 | /// The created kernel. 43 | private static IKernel CreateKernel() 44 | { 45 | var kernel = new StandardKernel(); 46 | kernel.Bind>().ToMethod(ctx => () => new Bootstrapper().Kernel); 47 | kernel.Bind().To(); 48 | 49 | RegisterServices(kernel); 50 | return kernel; 51 | } 52 | 53 | /// 54 | /// Load your modules or register your services here! 55 | /// 56 | /// The kernel. 57 | private static void RegisterServices(IKernel kernel) 58 | { 59 | kernel.Bind().To(); 60 | kernel.Bind().To(); 61 | 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /CryptAByte.CryptoLibrary/EncryptionLibraries/AESEncryption.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Security.Cryptography; 4 | using System.Text; 5 | 6 | namespace CryptAByte.CryptoLibrary.EncryptionLibraries 7 | { 8 | public static class AESEncryption 9 | { 10 | public static string Encrypt(string value, string passphrase, string salt) 11 | where T : SymmetricAlgorithm, new() 12 | { 13 | DeriveBytes rgb = new Rfc2898DeriveBytes(passphrase, Encoding.Unicode.GetBytes(salt)); 14 | 15 | SymmetricAlgorithm algorithm = new T(); 16 | 17 | byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3); 18 | byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3); 19 | 20 | ICryptoTransform transform = algorithm.CreateEncryptor(rgbKey, rgbIV); 21 | 22 | using (MemoryStream buffer = new MemoryStream()) 23 | { 24 | using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Write)) 25 | { 26 | using (StreamWriter writer = new StreamWriter(stream, Encoding.Unicode)) 27 | { 28 | writer.Write(value); 29 | } 30 | } 31 | 32 | return Convert.ToBase64String(buffer.ToArray()); 33 | } 34 | } 35 | 36 | public static string Decrypt(string text, string passphrase, string salt) 37 | where T : SymmetricAlgorithm, new() 38 | { 39 | DeriveBytes rgb = new Rfc2898DeriveBytes(passphrase, Encoding.Unicode.GetBytes(salt)); 40 | 41 | SymmetricAlgorithm algorithm = new T(); 42 | 43 | byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3); 44 | byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3); 45 | 46 | ICryptoTransform transform = algorithm.CreateDecryptor(rgbKey, rgbIV); 47 | 48 | using (MemoryStream buffer = new MemoryStream(Convert.FromBase64String(text))) 49 | { 50 | using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Read)) 51 | { 52 | using (StreamReader reader = new StreamReader(stream, Encoding.Unicode)) 53 | { 54 | return reader.ReadToEnd(); 55 | } 56 | } 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /CryptAByte.Domain/Services/EmailService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Configuration; 3 | using System.Net.Mail; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace CryptAByte.Domain.Services 8 | { 9 | public class EmailService : IEmailService 10 | { 11 | private readonly string _defaultSenderAddress; 12 | 13 | public EmailService() 14 | { 15 | _defaultSenderAddress = ConfigurationManager.AppSettings["DefaultEmailSender"] 16 | ?? "webmaster@cryptabyte.com"; 17 | } 18 | 19 | public EmailService(string defaultSenderAddress) 20 | { 21 | if (string.IsNullOrWhiteSpace(defaultSenderAddress)) 22 | throw new ArgumentException("Sender address cannot be empty.", nameof(defaultSenderAddress)); 23 | 24 | _defaultSenderAddress = defaultSenderAddress; 25 | } 26 | 27 | public Task SendEmailAsync(string recipientAddress, string subject, string bodyContent, CancellationToken cancellationToken = default) 28 | { 29 | return SendEmailAsync(_defaultSenderAddress, recipientAddress, subject, bodyContent, cancellationToken); 30 | } 31 | 32 | public async Task SendEmailAsync(string senderAddress, string recipientAddress, string subject, string bodyContent, CancellationToken cancellationToken = default) 33 | { 34 | if (string.IsNullOrWhiteSpace(senderAddress)) 35 | throw new ArgumentException("Sender address cannot be empty.", nameof(senderAddress)); 36 | 37 | if (string.IsNullOrWhiteSpace(recipientAddress)) 38 | throw new ArgumentException("Recipient address cannot be empty.", nameof(recipientAddress)); 39 | 40 | if (string.IsNullOrWhiteSpace(subject)) 41 | throw new ArgumentException("Subject cannot be empty.", nameof(subject)); 42 | 43 | using (var mailMessage = new MailMessage()) 44 | { 45 | mailMessage.From = new MailAddress(senderAddress); 46 | mailMessage.To.Add(new MailAddress(recipientAddress)); 47 | mailMessage.Subject = subject; 48 | mailMessage.Body = bodyContent; 49 | 50 | using (var smtpClient = new SmtpClient()) 51 | { 52 | await smtpClient.SendMailAsync(mailMessage).ConfigureAwait(false); 53 | } 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /CryptoPad/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | using System.Windows.Forms; 4 | using CryptAByte.CryptoLibrary.CryptoProviders; 5 | 6 | namespace CryptoPad 7 | { 8 | //ILMerge.exe /target:CryptoPad /out:CryptoPad2.exe /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" CryptoPad.exe CryptAByte.CryptoLibrary.dll 9 | 10 | public partial class Form1 : Form 11 | { 12 | public Form1() 13 | { 14 | InitializeComponent(); 15 | } 16 | 17 | private void btnEncrypt_Click(object sender, EventArgs e) 18 | { 19 | SymmetricCryptoProvider symmetricCrypt = new SymmetricCryptoProvider(); 20 | 21 | string password = txtPassphrase.Text; 22 | 23 | if (string.IsNullOrWhiteSpace(password)) 24 | { 25 | password = PronounceablePasswordGenerator.Generate(10); 26 | MessageBox.Show( 27 | string.Format("Your random password is {0}. \r Please copy it now then click OK.", password), 28 | "Password generated", MessageBoxButtons.OK, MessageBoxIcon.Information); 29 | } 30 | 31 | string cypertext = symmetricCrypt.EncryptWithKey(txtClearText.Text, password); 32 | 33 | txtCypertext.Text = cypertext; 34 | 35 | tabControl1.SelectTab(1); 36 | } 37 | 38 | private void btnDecrypt_Click(object sender, EventArgs e) 39 | { 40 | SymmetricCryptoProvider symmetricCrypt = new SymmetricCryptoProvider(); 41 | 42 | if (string.IsNullOrWhiteSpace(txtDecryptPassphrase.Text)) 43 | { 44 | MessageBox.Show("Cannot decrypt without a passphrase", "Error", MessageBoxButtons.OK, 45 | MessageBoxIcon.Error); 46 | return; 47 | } 48 | 49 | string plaintext = ""; 50 | 51 | try 52 | { 53 | plaintext = symmetricCrypt.DecryptWithKey(txtCypertext.Text, txtDecryptPassphrase.Text); 54 | } 55 | catch (CryptographicException) 56 | { 57 | MessageBox.Show("Unable to decrypt with provided passphrase", "Error", MessageBoxButtons.OK, 58 | MessageBoxIcon.Error); 59 | return; 60 | } 61 | 62 | txtCypertext.Text = plaintext; 63 | 64 | tabControl1.SelectTab(0); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /OneTimePad/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Text; 4 | using System.Windows.Forms; 5 | using CryptAByte.CryptoLibrary.CryptoProviders; 6 | 7 | namespace OneTimePad 8 | { 9 | public partial class Form1 : Form 10 | { 11 | public Form1() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | //ILMerge.exe /target:OneTimePad /out:OneTimePad2.exe /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" OneTimePad.exe CryptAByte.CryptoLibrary.dll 17 | 18 | private void btnGenerateKeys_Click(object sender, EventArgs e) 19 | { 20 | GenerateKeys(numKeySize.Value, numNumberOfKeys.Value); 21 | } 22 | 23 | private void GenerateKeys(decimal keySize, decimal numberOfKeys) 24 | { 25 | StringBuilder keys = new StringBuilder(); 26 | 27 | for (int i = 1; i < numberOfKeys + 1; i++) 28 | { 29 | string key; 30 | if (chkCreatepronounceablepasswords.Checked) 31 | { 32 | key = PronounceablePasswordGenerator.Generate((int)keySize); 33 | } 34 | else 35 | { 36 | key = SymmetricCryptoProvider.GenerateKeyPhrase((int)keySize).TrimEnd(Convert.ToChar("=")); 37 | } 38 | 39 | int groupSize = (int)numGroupSize.Value; 40 | 41 | if (chkGroupIntoPairs.Checked && groupSize > 0) 42 | { 43 | string groupedKey = ""; 44 | 45 | for (int j = 0; j < key.Length; j++) 46 | { 47 | groupedKey += key[j]; 48 | 49 | if ((j +1) % groupSize == 0) 50 | { 51 | groupedKey += "-"; 52 | } 53 | } 54 | 55 | groupedKey = groupedKey.TrimEnd('-'); 56 | 57 | keys.AppendLine(string.Format("{0}, {1}", i, groupedKey)); 58 | } 59 | else 60 | { 61 | keys.AppendLine(string.Format("{0}, {1}", i, key)); 62 | } 63 | 64 | } 65 | 66 | txtkeys.Text = keys.ToString(); 67 | } 68 | 69 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 70 | { 71 | Process.Start("https://github.com/DavidVeksler/CryptAByte/tree/master/binaries"); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/jquery.ui.button.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Button 1.8.19 3 | * 4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) 5 | * Dual licensed under the MIT or GPL Version 2 licenses. 6 | * http://jquery.org/license 7 | * 8 | * http://docs.jquery.com/UI/Button#theming 9 | */ 10 | .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ 11 | .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ 12 | button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ 13 | .ui-button-icons-only { width: 3.4em; } 14 | button.ui-button-icons-only { width: 3.7em; } 15 | 16 | /*button text element */ 17 | .ui-button .ui-button-text { display: block; line-height: 1.4; } 18 | .ui-button-text-only .ui-button-text { padding: .4em 1em; } 19 | .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } 20 | .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } 21 | .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } 22 | .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } 23 | /* no icon support for input elements, provide padding by default */ 24 | input.ui-button { padding: .4em 1em; } 25 | 26 | /*button icon element(s) */ 27 | .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } 28 | .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } 29 | .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } 30 | .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } 31 | .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } 32 | 33 | /*button sets*/ 34 | .ui-buttonset { margin-right: 7px; } 35 | .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } 36 | 37 | /* workarounds */ 38 | button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ 39 | -------------------------------------------------------------------------------- /CryptAByte.Domain.Tests/AssymetricCryptoTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using CryptAByte.CryptoLibrary.CryptoProviders; 4 | using CryptAByte.CryptoLibrary.Functional; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | 7 | namespace CryptAByte.Domain.Tests 8 | { 9 | [TestClass] 10 | public class AssymetricCryptoTests 11 | { 12 | private const string secret = "d379506609775a01f30990c2b83788baf49c7b1ba56d40423c4c95f6e80e7da1"; 13 | 14 | 15 | [TestMethod] 16 | public void GenerateKeys_ReturnsKeys() 17 | { 18 | var key = AsymmetricCryptoProvider.GenerateKeys(); 19 | Assert.IsNotNull(key.PrivateKey); 20 | Assert.IsNotNull(key.PublicKey); 21 | } 22 | 23 | [TestMethod] 24 | public void Encrypt_Decrypt_ReturnsOriginalValue() 25 | { 26 | var symmetricProvider = new SymmetricCryptoProvider(); 27 | var randomGenerator = new CryptoRandomGenerator(); 28 | var crypto = new AsymmetricCryptoProvider(symmetricProvider, randomGenerator); 29 | var key = AsymmetricCryptoProvider.GenerateKeys(); 30 | 31 | var cryptoText = crypto.EncryptWithKey(secret, key.PublicKey); 32 | var original = crypto.DecryptWithKey(cryptoText, key.PrivateKey); 33 | 34 | Assert.AreEqual(secret,original); 35 | 36 | } 37 | 38 | [TestMethod] 39 | public void Message_Encrypt_Decrypt_ReturnsOriginalValue() 40 | { 41 | // Arrange 42 | var symmetricProvider = new SymmetricCryptoProvider(); 43 | var randomGenerator = new CryptoRandomGenerator(); 44 | var crypto = new AsymmetricCryptoProvider(symmetricProvider, randomGenerator); 45 | var key = AsymmetricCryptoProvider.GenerateKeys(); 46 | string hash; 47 | string encryptedPassword; 48 | 49 | // Act 50 | #pragma warning disable CS0618 // Type or member is obsolete 51 | var encryptedMessage = crypto.EncryptMessageWithKey(secret, key.PublicKey, out encryptedPassword, out hash); 52 | 53 | string messageDecryptionKey; 54 | 55 | var decryptedSecret = crypto.DecryptMessageWithKey(key.PrivateKey, encryptedMessage, encryptedPassword, hash, out messageDecryptionKey); 56 | #pragma warning restore CS0618 // Type or member is obsolete 57 | 58 | // Assert 59 | Assert.AreEqual(secret, decryptedSecret); 60 | Assert.AreEqual(SymmetricCryptoProvider.GetSecureHashForString(secret),hash,"hashes do not match"); 61 | 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /CryptAByte.Domain/Functional/IRandomGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | 4 | namespace CryptAByte.Domain.Functional 5 | { 6 | /// 7 | /// Abstraction for generating random data. 8 | /// This enables pure functions by making randomness an explicit dependency. 9 | /// 10 | public interface IRandomGenerator 11 | { 12 | /// 13 | /// Generates random bytes of the specified length. 14 | /// 15 | byte[] GenerateBytes(int length); 16 | 17 | /// 18 | /// Generates a random Base64-encoded string. 19 | /// 20 | string GenerateBase64String(int sizeInBytes); 21 | } 22 | 23 | /// 24 | /// Cryptographically secure random generator using RNGCryptoServiceProvider. 25 | /// 26 | public sealed class CryptoRandomGenerator : IRandomGenerator 27 | { 28 | private readonly RandomNumberGenerator _rng; 29 | 30 | public CryptoRandomGenerator() 31 | { 32 | _rng = RandomNumberGenerator.Create(); 33 | } 34 | 35 | public byte[] GenerateBytes(int length) 36 | { 37 | if (length <= 0) 38 | throw new ArgumentException("Length must be positive", nameof(length)); 39 | 40 | var bytes = new byte[length]; 41 | _rng.GetBytes(bytes); 42 | return bytes; 43 | } 44 | 45 | public string GenerateBase64String(int sizeInBytes) 46 | { 47 | var bytes = GenerateBytes(sizeInBytes); 48 | return Convert.ToBase64String(bytes); 49 | } 50 | } 51 | 52 | /// 53 | /// Deterministic random generator for testing. 54 | /// 55 | public sealed class DeterministicRandomGenerator : IRandomGenerator 56 | { 57 | private readonly byte _fillByte; 58 | 59 | public DeterministicRandomGenerator(byte fillByte = 0x42) 60 | { 61 | _fillByte = fillByte; 62 | } 63 | 64 | public byte[] GenerateBytes(int length) 65 | { 66 | if (length <= 0) 67 | throw new ArgumentException("Length must be positive", nameof(length)); 68 | 69 | var bytes = new byte[length]; 70 | for (int i = 0; i < length; i++) 71 | { 72 | bytes[i] = (byte)((_fillByte + i) % 256); 73 | } 74 | return bytes; 75 | } 76 | 77 | public string GenerateBase64String(int sizeInBytes) 78 | { 79 | var bytes = GenerateBytes(sizeInBytes); 80 | return Convert.ToBase64String(bytes); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Scripts/jquery.unobtrusive-ajax.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** Unobtrusive Ajax support library for jQuery 3 | ** Copyright (C) Microsoft Corporation. All rights reserved. 4 | */ 5 | (function(a){var b="unobtrusiveAjaxClick",g="unobtrusiveValidation";function c(d,b){var a=window,c=(d||"").split(".");while(a&&c.length)a=a[c.shift()];if(typeof a==="function")return a;b.push(d);return Function.constructor.apply(null,b)}function d(a){return a==="GET"||a==="POST"}function f(b,a){!d(a)&&b.setRequestHeader("X-HTTP-Method-Override",a)}function h(c,b,e){var d;if(e.indexOf("application/x-javascript")!==-1)return;d=(c.getAttribute("data-ajax-mode")||"").toUpperCase();a(c.getAttribute("data-ajax-update")).each(function(f,c){var e;switch(d){case"BEFORE":e=c.firstChild;a("
").html(b).contents().each(function(){c.insertBefore(this,e)});break;case"AFTER":a("
").html(b).contents().each(function(){c.appendChild(this)});break;default:a(c).html(b)}})}function e(b,e){var j,k,g,i;j=b.getAttribute("data-ajax-confirm");if(j&&!window.confirm(j))return;k=a(b.getAttribute("data-ajax-loading"));i=b.getAttribute("data-ajax-loading-duration")||0;a.extend(e,{type:b.getAttribute("data-ajax-method")||undefined,url:b.getAttribute("data-ajax-url")||undefined,beforeSend:function(d){var a;f(d,g);a=c(b.getAttribute("data-ajax-begin"),["xhr"]).apply(this,arguments);a!==false&&k.show(i);return a},complete:function(){k.hide(i);c(b.getAttribute("data-ajax-complete"),["xhr","status"]).apply(this,arguments)},success:function(a,e,d){h(b,a,d.getResponseHeader("Content-Type")||"text/html");c(b.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(this,arguments)},error:c(b.getAttribute("data-ajax-failure"),["xhr","status","error"])});e.data.push({name:"X-Requested-With",value:"XMLHttpRequest"});g=e.type.toUpperCase();if(!d(g)){e.type="POST";e.data.push({name:"X-HTTP-Method-Override",value:g})}a.ajax(e)}function i(c){var b=a(c).data(g);return!b||!b.validate||b.validate()}a("a[data-ajax=true]").live("click",function(a){a.preventDefault();e(this,{url:this.href,type:"GET",data:[]})});a("form[data-ajax=true] input[type=image]").live("click",function(c){var g=c.target.name,d=a(c.target),f=d.parents("form")[0],e=d.offset();a(f).data(b,[{name:g+".x",value:Math.round(c.pageX-e.left)},{name:g+".y",value:Math.round(c.pageY-e.top)}]);setTimeout(function(){a(f).removeData(b)},0)});a("form[data-ajax=true] :submit").live("click",function(c){var e=c.target.name,d=a(c.target).parents("form")[0];a(d).data(b,e?[{name:e,value:c.target.value}]:[]);setTimeout(function(){a(d).removeData(b)},0)});a("form[data-ajax=true]").live("submit",function(d){var c=a(this).data(b)||[];d.preventDefault();if(!i(this))return;e(this,{url:this.action,type:this.method||"GET",data:c.concat(a(this).serializeArray())})})})(jQuery); -------------------------------------------------------------------------------- /CryptAByte.CryptoLibrary/Functional/IRandomGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | 4 | namespace CryptAByte.CryptoLibrary.Functional 5 | { 6 | /// 7 | /// Abstraction for generating random data. 8 | /// This enables pure functions by making randomness an explicit dependency. 9 | /// 10 | public interface IRandomGenerator 11 | { 12 | /// 13 | /// Generates random bytes of the specified length. 14 | /// 15 | byte[] GenerateBytes(int length); 16 | 17 | /// 18 | /// Generates a random Base64-encoded string. 19 | /// 20 | string GenerateBase64String(int sizeInBytes); 21 | } 22 | 23 | /// 24 | /// Cryptographically secure random generator using RNGCryptoServiceProvider. 25 | /// 26 | public sealed class CryptoRandomGenerator : IRandomGenerator 27 | { 28 | private readonly RandomNumberGenerator _rng; 29 | 30 | public CryptoRandomGenerator() 31 | { 32 | _rng = RandomNumberGenerator.Create(); 33 | } 34 | 35 | public byte[] GenerateBytes(int length) 36 | { 37 | if (length <= 0) 38 | throw new ArgumentException("Length must be positive", nameof(length)); 39 | 40 | var bytes = new byte[length]; 41 | _rng.GetBytes(bytes); 42 | return bytes; 43 | } 44 | 45 | public string GenerateBase64String(int sizeInBytes) 46 | { 47 | var bytes = GenerateBytes(sizeInBytes); 48 | return Convert.ToBase64String(bytes); 49 | } 50 | } 51 | 52 | /// 53 | /// Deterministic random generator for testing. 54 | /// 55 | public sealed class DeterministicRandomGenerator : IRandomGenerator 56 | { 57 | private readonly byte _fillByte; 58 | 59 | public DeterministicRandomGenerator(byte fillByte = 0x42) 60 | { 61 | _fillByte = fillByte; 62 | } 63 | 64 | public byte[] GenerateBytes(int length) 65 | { 66 | if (length <= 0) 67 | throw new ArgumentException("Length must be positive", nameof(length)); 68 | 69 | var bytes = new byte[length]; 70 | for (int i = 0; i < length; i++) 71 | { 72 | bytes[i] = (byte)((_fillByte + i) % 256); 73 | } 74 | return bytes; 75 | } 76 | 77 | public string GenerateBase64String(int sizeInBytes) 78 | { 79 | var bytes = GenerateBytes(sizeInBytes); 80 | return Convert.ToBase64String(bytes); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /CryptAByte.WebUI.Tests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Scripts/APIUsageDemo.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | ko.applyBindings(new KeyModel()); 3 | 4 | $(document).ajaxError(onAjaxError); 5 | }); 6 | 7 | function onAjaxError(jqXHR, textStatus, errorThrown) { 8 | $('#error').html(textStatus.responseText); 9 | $('#error').dialog({ width: 600 }); 10 | } 11 | 12 | var KeyModel = function () { 13 | var self = this; 14 | 15 | self.passphrase = ko.observable(); 16 | self.response = ko.observable(); 17 | self.token = ko.observable(); 18 | self.message = ko.observable(); 19 | self.messages = ko.observableArray([]); 20 | 21 | this.validPassphrase = function () { 22 | return (this.passphrase() != undefined && this.passphrase().length > 0); 23 | }; 24 | 25 | this.validMessage = function () { 26 | return (this.message() != undefined && this.message().length > 0); 27 | }; 28 | 29 | this.ShowResponse = function (response) { 30 | 31 | self.response(JSON.stringify(response)); 32 | }; 33 | 34 | 35 | this.CreateKey = function () { 36 | $.ajax({ 37 | type: "POST", 38 | url: "/Service", 39 | data: { passphrase: this.passphrase() }, 40 | }).done(function (response) { 41 | 42 | self.token(response.KeyToken); 43 | self.ShowResponse(response); 44 | }); 45 | }; 46 | 47 | this.DeleteKey = function () { 48 | $.ajax({ 49 | type: "DELETE", 50 | url: "/Service", 51 | data: { token: this.token(), passphrase: this.passphrase() }, 52 | }).done(function (response) { 53 | self.ShowResponse(response); 54 | }); 55 | }; 56 | 57 | this.GetToken = function () { 58 | $.ajax({ 59 | type: "GET", 60 | url: "/Service", 61 | data: { token: this.token() }, 62 | }).done(function (response) { 63 | self.token(response.KeyToken); 64 | self.ShowResponse(response); 65 | }); 66 | }; 67 | 68 | this.SendMessage = function () { 69 | 70 | $.ajax({ 71 | type: "PUT", 72 | url: "/Service", 73 | data: { token: this.token(), message: this.message() }, 74 | }).done(function (response) { 75 | self.ShowResponse(response); 76 | }); 77 | }; 78 | 79 | this.GetMessages = function () { 80 | $.ajax({ 81 | type: "GET", 82 | url: "/Service", 83 | data: { token: this.token(), passphrase: this.passphrase() }, 84 | }).done(function (response) { 85 | self.ShowResponse(response); 86 | 87 | $(response).each(function (index, msg) { 88 | self.messages.push(msg); 89 | }); 90 | }); 91 | }; 92 | }; 93 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Messages.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CryptAByte.WebUI { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Messages { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Messages() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CryptAByte.WebUI.Messages", typeof(Messages).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /OneTimePad/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace OneTimePad.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OneTimePad.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CryptoPad/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18034 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CryptoPad.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CryptoPad.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | // ViewBag.Title = "Time-Lock: Do Not Decrypt Until ___"; 3 | 4 | Page.Title = "About Crypt-A-Byte"; 5 | } 6 | 7 |

About

8 | 9 |
10 |

11 | Crypt-A-Byte is a set of services offering secure communications on the web. 12 | It can 13 | be used via the web interface or via the API. 14 |

15 | 16 |

17 | Would you like to run a copy of CryptAByte on your website or private Intranet? 18 | 19 | 20 | GitHub repository. 21 |

22 | 23 | 24 | 25 | 26 | @Html.Partial("About-Home") 27 | 28 | @*

@ViewBag.Message

29 |

30 | Time-Lock: Do Not Decrypt Until ___ 31 |

32 |

33 | Request Keys | 34 |

35 |

36 | Time-Lock provides several ways to keep a secret until a certain time is reached 37 | and/or a certain person(s) agree to release it. 38 |

39 |

40 | There are many good tools for sharing password-protected information, but if you 41 | want to releval a secret based on certain criteria such as time or group consensus, 42 | you must rely on a trusted third party. Time-Lock allows you to define a set of 43 | conditions to handle many different situations 44 |

45 |

46 | Time-Lock can be used in a way that does not require you to trust it with your secret. 47 | You can use the Time-Lock site directly, or you can interface with its API from 48 | another application or website. 49 |

50 |

51 | Here are some ways that you can use Time-Lock: 52 |

53 |
    54 |
  1. Record a secret today and don't reveal it until 7 minutes (or days or years) from 55 | now. The secret can automatically be send to a recipient after a certain time or 56 | deleted if it is not retrieved.
  2. 57 |
  3. You want to reveal a secret to a friend based on certain criteria which a referee 58 | will decide on. You can record the secret with Time-Lock and send the unlock key 59 | to the judge and the access key to your friend. The referee can unlock the secret 60 | with his key, but he will not be able to read the message. After the referee uses 61 | his unlock key, your friend will able to use his access key to read it.
  4. 62 |
  5. You want to leave a message for three friends which requires all three to enter 63 | their password to open it.
  6. 64 |
  7. Same as scenario 1, but requires sufficient calculations to ensure that your secret 65 | can be kept whether or not you trust Time-Lock and even if the website is not available. 66 |
  8. 67 |
68 |
    69 |
  1. Trusted Third Party
  2. 70 |
  3. Mutual Friend
  4. 71 |
  5. Consensus
  6. 72 |
  7. Pre-Calculate key
  8. 73 |
74 |

75 | Sources: 76 |

    77 |
  • http://www.gwern.net/Self-decrypting%20files
  • 78 |
  • https://bcrypt.codeplex.com/
  • 79 |
  • 80 |
81 |

82 | *@ -------------------------------------------------------------------------------- /CryptAByte.WebUI/Views/SelfDestruct/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model CryptAByte.WebUI.Models.SelfDestructingMessageModel 2 | @{ 3 | Page.Title = "Self-Destructing Messaging: encrypted emails which auto-delete after being read; share secrets anonymously"; 4 | } 5 | 6 |

Self-Destructing Messaging

7 | @*

Warning: this service is currently under a testing 8 | period. Please 9 | don't use it for 10 | anything important.

*@ 11 | 12 |

Self-destructing messages are messages that erase themselves after the recipient 13 | reads them.

14 |
15 | Here is how it works: 16 |
    17 |
  1. Write your message and enter the email address of the recipient.
  2. 18 |
  3. The message is encrypted with a random passphrase and stored on the server. The 19 | passphrase 20 | is embedded in the link to open the message.
  4. 21 |
  5. When the recipient clicks on the link, this website decrypts the message and in 22 | the same step, erases the message.
  6. 23 |
24 |
25 | 26 | 27 | 28 | @Html.Partial("Send") 29 | 30 |
31 | 32 |

Notes

33 |
34 | 35 |
    36 |
  • The passphrase is not stored and the message is never stored in decrypted form, 37 | so it is impossible for the administrator 38 | to reveal the message after it is sent.
  • 39 |
  • If someone opens your email in your inbox before you, they will 40 | be able to read the message.
  • 41 |
  • The read URL contains a hash of the original message. This is used to verify that 42 | the message has not changed since it was sent -- as might happen if the database 43 | used to store the messages was hacked or compromised.
  • 44 |
45 | 46 |
47 | 48 |

Cautions & Disclaimers

49 |
50 | 51 |
    52 |
  • It may be possible for force the operator 53 | of the website 54 | (either by a lawful court order or by compromising our security) to reveal the 55 | message 56 | without notifying the original recipient if the sent email is available - for example, 57 | if someone has access the inbox of the recipient. (Read More)
  • 58 |
  • If you wish to recieve information securily and anonymously, we suggest you use 59 | CryptAByte's messaging service. If you wish to anonymously share information and 60 | understand the risks involved, 61 | you can use this service.
  • 62 |
  • We may store the sender's IP address and recipient email address to prevent abuse 63 | of this service. The mail server itself may also keep a record of the recipients 64 | email address while it is being sent. 65 |
  • 66 |
67 | 68 |
69 | 70 | 71 | 72 |
73 | 74 | 75 | -------------------------------------------------------------------------------- /OneTimePad/Properties/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 54 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CryptAByte.WebUI/Content/themes/base/minified/jquery.ui.datepicker.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.8.19 - 2012-04-16 2 | * https://github.com/jquery/jquery-ui 3 | * Includes: jquery.ui.datepicker.css 4 | * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ 5 | .ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month-year{width:100%}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0em}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right}.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-cover{display:none;display position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px} -------------------------------------------------------------------------------- /CryptAByte.CryptoLibrary/CryptoProviders/RandomNumberGenerator.cs: -------------------------------------------------------------------------------- 1 | // UNIT RandomNumberGeneratorBase 2 | // UNIT StrongRandomNumberGenerator 3 | using System; 4 | using System.Security.Cryptography; 5 | 6 | namespace CryptAByte.CryptoLibrary.CryptoProviders 7 | { 8 | public abstract class RandomNumberGeneratorBase 9 | { 10 | private int _byteBufSize; 11 | private byte[] _buf; 12 | private int _idx; 13 | private int _lastsize; 14 | 15 | public RandomNumberGeneratorBase(int bufSize = 8092) 16 | { 17 | _byteBufSize = bufSize; 18 | _buf = new byte[_byteBufSize]; 19 | _idx = _byteBufSize; 20 | } 21 | 22 | protected abstract void GetNewBuf(byte[] buf); 23 | 24 | private void CheckBuf(int bytesFreeNeeded = 1) 25 | { 26 | _idx += _lastsize; 27 | _lastsize = bytesFreeNeeded; 28 | if (_idx + bytesFreeNeeded < _byteBufSize) { return; } 29 | GetNewBuf(_buf); 30 | _idx = 0; 31 | _lastsize = 0; 32 | } 33 | 34 | public byte GetRandomByteStartAtZero(int belowValue) 35 | { 36 | return (byte)(Math.Round(((double)GetRandomByte() * (belowValue - 1)) / 255)); 37 | } 38 | 39 | public int GetRandomIntStartAtZero(int belowValue) 40 | { 41 | return (int)(Math.Round(((double)GetRandomUInt32() * (double)(belowValue - 1)) / (double)uint.MaxValue)); 42 | } 43 | 44 | public byte GetRandomByte() 45 | { 46 | CheckBuf(); 47 | return _buf[_idx]; 48 | } 49 | 50 | public bool GetRandomBool() 51 | { 52 | CheckBuf(); 53 | return _buf[_idx] > 127; 54 | } 55 | 56 | public ulong GetRandomULong() 57 | { 58 | CheckBuf(sizeof(ulong)); 59 | return BitConverter.ToUInt64(_buf, _idx); 60 | } 61 | 62 | public int GetRandomInt() 63 | { 64 | CheckBuf(sizeof(int)); 65 | return BitConverter.ToInt32(_buf, _idx); 66 | } 67 | 68 | /// 69 | /// Double from 0 to 1 (might be zero, will never be 1) 70 | /// 71 | public double GetRandomDouble() 72 | { 73 | return GetRandomUInt32() / (1d + UInt32.MaxValue); 74 | } 75 | 76 | /// 77 | /// Float from 0 to 1 (might be zero, will never be 1) 78 | /// 79 | public float GetRandomFloat() 80 | { 81 | return GetRandomUInt32() / (1f + UInt32.MaxValue); 82 | } 83 | 84 | public uint GetRandomUInt32() 85 | { 86 | CheckBuf(sizeof(UInt32)); 87 | return BitConverter.ToUInt32(_buf, _idx); 88 | } 89 | } 90 | 91 | public sealed class StrongRandomNumberGenerator : RandomNumberGeneratorBase 92 | { 93 | private RNGCryptoServiceProvider _rnd; 94 | 95 | public StrongRandomNumberGenerator() 96 | { 97 | _rnd = new RNGCryptoServiceProvider(); 98 | } 99 | 100 | protected override void GetNewBuf(byte[] buf) 101 | { 102 | _rnd.GetBytes(buf); 103 | } 104 | 105 | } 106 | } -------------------------------------------------------------------------------- /CryptAByte.WindowsClient/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17626 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CryptAByte.WindowsClient.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CryptAByte.WindowsClient.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap logo { 67 | get { 68 | object obj = ResourceManager.GetObject("logo", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /CryptAByte.Domain.Tests/SelfDestructingMessageRepositoryTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Text; 6 | using CryptAByte.Domain.DataContext; 7 | using CryptAByte.Domain.KeyManager; 8 | using CryptAByte.Domain.SelfDestructingMessaging; 9 | using Microsoft.VisualStudio.TestTools.UnitTesting; 10 | using Moq; 11 | 12 | namespace CryptAByte.Domain.Tests 13 | { 14 | [TestClass] 15 | public class SelfDestructingMessageRepositoryTests 16 | { 17 | public SelfDestructingMessageRepositoryTests() 18 | { 19 | // update DB if there are changes: 20 | Database.SetInitializer(new DropCreateDatabaseIfModelChanges()); 21 | } 22 | 23 | const string secret = "secret"; 24 | const string passphrase = "password"; 25 | 26 | [TestMethod] 27 | public void Can_Create_And_Read_Message() 28 | { 29 | var context = new CryptAByteContext(); 30 | var repository = new SelfDestructingMessageRepository(context); 31 | 32 | int messageId = repository.StoreMessage(new SelfDestructingMessage() { Message = secret, SentDate = DateTime.Now }, passphrase); 33 | 34 | var retrieved = repository.GetMessage(messageId, passphrase); 35 | 36 | Assert.IsTrue(secret == retrieved.Message); 37 | } 38 | 39 | [TestMethod] 40 | public void Can_Create_And_Read_Message_With_Attachment() 41 | { 42 | var context = new CryptAByteContext(); 43 | var repository = new SelfDestructingMessageRepository(context); 44 | 45 | const string attachmentName = "test.txt"; 46 | 47 | int messageId = repository.StoreMessage(new SelfDestructingMessage() 48 | { 49 | Message = secret, 50 | SentDate = DateTime.Now, 51 | SelfDestructingMessageAttachment = new SelfDestructingMessageAttachment() { 52 | //AttachmentName = attachmentName, 53 | Attachment = "TEST DATA" } 54 | }, passphrase, 55 | attachmentName, 56 | Encoding.ASCII.GetBytes("HELLO") 57 | ); 58 | 59 | var retrieved = repository.GetMessage(messageId, passphrase); 60 | 61 | Assert.IsTrue(secret == retrieved.Message); 62 | 63 | // todo Assert.AreEqual(retrieved.SelfDestructingMessageAttachment.AttachmentName, attachmentName); 64 | 65 | var attachment = repository.GetAttachment(messageId, passphrase); 66 | Assert.IsNotNull(attachment); 67 | 68 | // todo: 69 | //Encoding.ASCII.GetBytes("HELLO") 70 | 71 | } 72 | 73 | [TestMethod] 74 | public void Cannot_Read_Messages_After_Retrieve() 75 | { 76 | var context = new CryptAByteContext(); 77 | var repository = new SelfDestructingMessageRepository(context); 78 | 79 | int messageId = repository.StoreMessage(new SelfDestructingMessage() { Message = secret, SentDate = DateTime.Now }, passphrase); 80 | 81 | var retrieved = repository.GetMessage(messageId, passphrase); 82 | 83 | try 84 | { 85 | repository.GetMessage(messageId, passphrase); 86 | 87 | Assert.Fail("Should not be able to succeed"); 88 | } 89 | catch 90 | { 91 | // this should fail 92 | } 93 | 94 | 95 | } 96 | 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /CryptAByte.CryptoLibrary/EncryptionLibraries/RSAPublicKeyEncryption.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Security.Cryptography; 4 | using System.Text; 5 | 6 | namespace CryptAByte.CryptoLibrary.EncryptionLibraries 7 | { 8 | public static class RSAPublicKeyEncryption 9 | { 10 | public static string EncryptString(string inputString, int dwKeySize, string xmlString) 11 | { 12 | // TODO: Add Proper Exception Handlers 13 | RSACryptoServiceProvider rsaCryptoServiceProvider = new RSACryptoServiceProvider(dwKeySize); 14 | rsaCryptoServiceProvider.FromXmlString(xmlString); 15 | int keySize = dwKeySize/8; 16 | byte[] bytes = Encoding.UTF32.GetBytes(inputString); 17 | // The hash function in use by the .NET RSACryptoServiceProvider here is SHA1 18 | // int maxLength = ( keySize ) - 2 - ( 2 * SHA1.Create().ComputeHash( rawBytes ).Length ); 19 | int maxLength = keySize - 42; 20 | int dataLength = bytes.Length; 21 | int iterations = dataLength/maxLength; 22 | StringBuilder stringBuilder = new StringBuilder(); 23 | for (int i = 0; i <= iterations; i++) 24 | { 25 | byte[] tempBytes = 26 | new byte[(dataLength - maxLength*i > maxLength) ? maxLength : dataLength - maxLength*i]; 27 | Buffer.BlockCopy(bytes, maxLength*i, tempBytes, 0, tempBytes.Length); 28 | byte[] encryptedBytes = rsaCryptoServiceProvider.Encrypt(tempBytes, true); 29 | // Be aware the RSACryptoServiceProvider reverses the order of encrypted bytes after encryption and before decryption. 30 | // If you do not require compatibility with Microsoft Cryptographic API (CAPI) and/or other vendors. 31 | // Comment out the next line and the corresponding one in the DecryptString function. 32 | Array.Reverse(encryptedBytes); 33 | // Why convert to base 64? 34 | // Because it is the largest power-of-two base printable using only ASCII characters 35 | stringBuilder.Append(Convert.ToBase64String(encryptedBytes)); 36 | } 37 | return stringBuilder.ToString(); 38 | } 39 | 40 | public static string DecryptString(string inputString, int dwKeySize, string xmlString) 41 | { 42 | // TODO: Add Proper Exception Handlers 43 | RSACryptoServiceProvider rsaCryptoServiceProvider = new RSACryptoServiceProvider(dwKeySize); 44 | rsaCryptoServiceProvider.FromXmlString(xmlString); 45 | int base64BlockSize = ((dwKeySize/8)%3 != 0) ? (((dwKeySize/8)/3)*4) + 4 : ((dwKeySize/8)/3)*4; 46 | int iterations = inputString.Length/base64BlockSize; 47 | ArrayList arrayList = new ArrayList(); 48 | for (int i = 0; i < iterations; i++) 49 | { 50 | byte[] encryptedBytes = 51 | Convert.FromBase64String(inputString.Substring(base64BlockSize*i, base64BlockSize)); 52 | // Be aware the RSACryptoServiceProvider reverses the order of encrypted bytes after encryption and before decryption. 53 | // If you do not require compatibility with Microsoft Cryptographic API (CAPI) and/or other vendors. 54 | // Comment out the next line and the corresponding one in the EncryptString function. 55 | Array.Reverse(encryptedBytes); 56 | arrayList.AddRange(rsaCryptoServiceProvider.Decrypt(encryptedBytes, true)); 57 | } 58 | return Encoding.UTF32.GetString(arrayList.ToArray(Type.GetType("System.Byte")) as byte[]); 59 | } 60 | } 61 | } --------------------------------------------------------------------------------