{"id":30545,"date":"2015-08-08T22:43:23","date_gmt":"2015-08-09T02:43:23","guid":{"rendered":"http:\/\/www.opensource.im\/uncategorized\/encrypting-files-in-c-net-using-the-advanced-encryption.php"},"modified":"2015-08-08T22:43:23","modified_gmt":"2015-08-09T02:43:23","slug":"encrypting-files-in-c-net-using-the-advanced-encryption","status":"publish","type":"post","link":"https:\/\/euvolution.com\/open-source-convergence\/encryption\/encrypting-files-in-c-net-using-the-advanced-encryption.php","title":{"rendered":"Encrypting files in C#.NET using the Advanced Encryption &#8230;"},"content":{"rendered":"<p><p>    One of the biggest challenges when dealing with the security    and encryption for a system, is the determination of the    correct ciphering paradigm. In .NET, there is a copious amount    of libraries available for use in the    System.Cryptography namespace. A significant amount of    these libraries have been deprecated, usually, due to    vulnerabilities being subsequently exposed, so it is very easy    to use something that may be as watertight as a sieve.  <\/p>\n<p>    This is further compounded by the fact that the cryptography    APIs are very detailed and low level  they are not easy to    use for a novice  the consequences of setting a single    parameter incorrectly results in a security implementation that    may as well not exist. Consequently, it is imperative that this    subject never be approached in a typical agile\/sprint manner     security should definitely be approached using a    waterfall model. Have no hesitation to advise any    manager or architect that your solution will be ready, when it    is ready. The agile methodology is typically about adding    units of functionality in a YAGNI    way, accruing technical debt that can be paid back later, and    refactoring applied, this just simply not a correct or    acceptable approach when dealing with the security of a system.    Do ensure you take the time to do a lot of research,    understanding the pitfalls of various implementations is vital    to a robust security implementation.  <\/p>\n<p>    The abundance of so many different types of cryptography,    implemented using Symmetric (same key is used to encrypt and    decrypt) and Asymmetric (public key and private key used to    encrypt and decrypt) algorithms has necessitated that    Governments try and standardise implementations across    departments, sites and even countries. The AES was released    in 2001 as a replacement for the Data Encryption Standard (DES)    which had been found to be susceptible to backdoors. This new    standard has been widely adopted in commercial environments, as    it had a requirement to be able to protect information for a    minimum of 20 years or 30 years.  <\/p>\n<p>    A number of papers were submitted in the application process    for the AES by various academic institutions, with the winning    cipher named Rijndael (pronounced rain-dahl) a    play on the names of the authors of the paper, Joan Daemen and    Vincent Rijmen (paper available     here). I am sure you will agree that comprehension and    implementation of the paper is better suited to domain experts.    The algorithm was written by two gifted PhD calibre    researchers, so your time as a developer is better suited to    try and resolve the domain problems that your business is    trying to solve (unless you are a cryptographer of course). You    can be sure that researchers at Microsoft have done all the    time consuming work of implementing and testing the algorithm,    rather than to trying to implement the Rijndael Block Cipher    yourself.  <\/p>\n<p>    To this end, Microsoft have implemented the Rijndael Block    Cipher in two in .NET classes which, incidentally, both    inherit from the SymmetricAlgorithm    abstract base class  <\/p>\n<p>    Unlike some of the asymmetric implementations by Microsoft, the    AES implementation allows you to work at a very high level of    abstraction, reducing the amount of parameters you have to    configure, hence the scope for error. I have created a class    that allows you to encrypt and decrypt strings (your password),    and then use this to encrypt a files from anywhere on your    machine.  <\/p>\n<p>    Thus far, the only way this algorithm can be broken is by using    a technique known as brute force. This is done by a    supercomputer(s) trying every known word in a language, and    various password to try and generate the correct password.    Typically, these types of programs run over weeks or even    months, but can be increased to millennia if the end user    chooses a strong password to begin with, which is why    having a well defined password policy is vital.  <\/p>\n<p>      public MainWindow()    <\/p>\n<p>      {    <\/p>\n<p>      InitializeComponent();    <\/p>\n<p><!-- Auto Generated --><\/p>\n<p>Continued here:<br \/>\n<a target=\"_blank\" href=\"http:\/\/lukhezo.com\/2011\/11\/06\/encrypting-files-in-net-using-the-advanced-encryption-standard-aes\/\" title=\"Encrypting files in C#.NET using the Advanced Encryption ...\">Encrypting files in C#.NET using the Advanced Encryption ...<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p> One of the biggest challenges when dealing with the security and encryption for a system, is the determination of the correct ciphering paradigm. In .NET, there is a copious amount of libraries available for use in the System.Cryptography namespace<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45],"tags":[],"class_list":["post-30545","post","type-post","status-publish","format-standard","hentry","category-encryption"],"_links":{"self":[{"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/posts\/30545"}],"collection":[{"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/comments?post=30545"}],"version-history":[{"count":0,"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/posts\/30545\/revisions"}],"wp:attachment":[{"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/media?parent=30545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/categories?post=30545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/euvolution.com\/open-source-convergence\/wp-json\/wp\/v2\/tags?post=30545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}