In this article I want to discuss different types of training for software developers. Most of what I say here is purely subjective and forms my own view of the best types of training, but I would like to hear what you think on this, including the training resources that work for you..
There are different types of training that as a software developer you can make use of. They are Classroom / Teacher led courses, Online video training, Books (both electronic and dead tree), and writing lots of code and good old experimentation.
Classroom / Instructor Led Courses
I have always had a problem with technical courses where you have to learn in a group. I personally don’t find it an effective way to learn a technology. Don’t get me wrong, non-technical courses like leadership training, personal skills etc work very well as an instructor led course as these are all about working with people, but for technical courses I don’t find them very good. Also they are very expensive, you can end up paying thousands of pounds for a 5 day course and that doesn’t even include travel and expenses.
I do think conferences are a good thing though. I have been to a number of these before including Microsoft’s TechED and find these very valuable as you get to see what new technologies are coming along and mix/socialise with other engineers from different companies and industries.
I am sure people will disagree with me on this and prefer instructor led courses to online videos and books, and that is fine as everyone has different learning styles. Personally I find learning a new technology a solitary thing. I just like to sit down by myself, watch some videos, read some articles and then just fire up the compiler and dig in.
What I want to do in this final part is talk about using these different cryptographic primitives to do what is called Hybrid Encryption.
What is Hybrid Encryption?
So, what is hybrid encryption? Let’s start off with Wikipedia’s definition.
In cryptography, public-key cryptosystems are convenient in that they do not require the sender and receiver to share a common secret in order to communicate securely (among other useful properties). However, they often rely on complicated mathematical computations and are thus generally much more inefficient than comparable symmetric-key cryptosystems. In many applications, the high cost of encrypting long messages in a public-key cryptosystem can be prohibitive. A hybrid cryptosystem is one which combines the convenience of a public-key cryptosystem with the efficiency of a symmetric-key cryptosystem.
A hybrid cryptosystem can be constructed using any two separate cryptosystems:
a key encapsulation scheme, which is a public-key cryptosystem, and
a data encapsulation scheme, which is a symmetric-key cryptosystem.
The hybrid cryptosystem is itself a public-key system, who’s public and private keys are the same as in the key encapsulation scheme.
Note that for very long messages the bulk of the work in encryption/decryption is done by the more efficient symmetric-key scheme, while the inefficient public-key scheme is used only to encrypt/decrypt a short key value.
In this article I thought I would post links to some free training resources for Windows Phone 8 Development. I have started playing around with Windows Phone 8 Development so I thought these resources would be useful for other people too.
I will keep adding to this page as I find other useful, free, resources. If you have any videos or articles that you feel would be useful here then please let me know in the comments and I will add them to the post. I would like it to be an archive of good material.
This is the 3rd part in a short series on cryptography in .NET. In the previous 2 articles I covered using Symmetric algorithms like AES and Asymmetric algorithms like RSA. In this section I want to cover random number generation and hashing. This will lead into the final article which will be about combining cryptographic primitives to create hybrid encryption protocols.
The primitive I want to discuss is generating cryptographically strong random numbers. This is useful if you want to generate random session keys for AES for example. To generate a random number you use the RNGCryptoServiceProvider class in .NET. Once you have constructed the object you just call GetBytes() and pass in the length in bytes of the random number you want to generate.
The Data Encryption Standard (DES) was a standard encryption system used for many years, but it had a flaw, the key strength was only 56bits. This books is about a group of people that started an experiment to try and crack the algorithm by a brute force search of the DES Key-space.
“In 1996, the supposedly uncrackable US federal encryption system was broken. In this captivating and intriguing book, Matt Curtin charts the rise and fall of DES and chronicles the efforts of those who were determined to master it.“
That description sums up the book perfectly. This book is very interesting if you have an interest in cryptography, a bit of computing history, the change in the American encryption laws and grid computing by using available spare resources on peoples machines connected to the internet.
The book is very well written. This subjected could have been presented in such a dry way, but the author has really captured the subject well and it is an engaging read.
In this article I am going to cover how the code is structured. To demonstrate the code structure I will use the Architectural Dependency diagrams in Visual Studio 2012.
The main solution file is split into 3 projects. There is the SafePadClientLibrary which contains the code for encrypting the documents, compression, and the handling of the SafePad file format. The domain objects in this library contain all the important routines for making the project work.
Recently I have been doing a bit of travelling for work to visit vendors and this has involved some lengthy train journeys. On these journeys I decided to set about writing a small little application that I had a use for. Initially I wanted a password vault, but when I thought about it more, I realised I wanted a secure way to store all sorts of information, like passwords, license keys, financial data etc.
So, whilst whiling away the hours on the train I started developing Safe Pad. The application is a pretty typical Rich Text based editor, but when you save your documents they are compressed and then stored by encrypting it with AES 256 three times using 2 passwords. This is a similar theory as to when the DES algorithms life was extended by using it to triple encrypt.
AES 256 is already a very strong algorithm, but when used in an application like this people still tend to use rather weak passwords which makes them susceptible to dictionary attacks. Because this application triple encrypts you are prompted to enter 2 passwords, therefore the program encrypts with password 1, then password 2, and then password 1 again. It adds that extra layer of protection for your secrets. Of course, this isn’t an excuse to use weak passwords, I still recommend using strong passwords made up of mixed case letters, numbers and non alpha-numeric symbols.
I have developed the program enough to a stable 1.0 release. It is quite basic, but then again it doesn’t need to be complicated. I have released the source code on CodePlex under the GNU Public license and this marks my first foray into the world of open source software development. Feel free to download the application if you think it will be useful to you. It costs nothing. If you are not interested in messing around with the source code, then there is an installer you can use to install the application. If you feel like adding some features, then the source code is available for you to play around with.
I was writing some code the other night on a little pet project I am working on and I needed to persist some data to disc. The data was quite large so I needed to compress it first. I have not used any of the compression libraries in .NET before so I had a little investigation and wrote the static methods below.
They are very easy to use, just pass in a byte array to compress and recieve a compressed byte array back out, and visa versa to decompress the data.
I thought I would share these code snippets as they are quite useful. Enjoy.
private static byte Compress(byte input)
using (var outputStream = new MemoryStream())
using (var zip = new GZipStream(outputStream, CompressionMode.Compress))
zip.Write(input, 0, input.Length);
compressesData = outputStream.ToArray();
private static byte Decompress(byte input)
using (var outputStream = new MemoryStream())
using (var inputStream = new MemoryStream(input))
using (var zip = new GZipStream(inputStream, CompressionMode.Decompress))
decompressedData = outputStream.ToArray();
This is the 2nd part in a small series on using encryption primitives in .NET. In the first article I concentrated on symmetric cryptography and more specifically the AES algorithm. In this article I will take a brief look at Asymmetric cryptography using the RSA system.
RSA is an algorithm for public-key cryptography that is based on the presumed difficulty of factoring large integers, the factoring problem. RSA stands for Ron Rivest, Adi Shamir and Leonard Adleman, who first publicly described the algorithm in 1977. Clifford Cocks, an English mathematician, had developed an equivalent system in 1973, but it was classified until 1997.
A user of RSA creates and then publishes the product of two large prime numbers, along with an auxiliary value, as their public key. The prime factors must be kept secret. Anyone can use the public key to encrypt a message, but with currently published methods, if the public key is large enough, only someone with knowledge of the prime factors can feasibly decode the message. Whether breaking RSA encryption is as hard as factoring is an open question known as the RSA problem.
The AES symmetric process is classed as an algorithm where the plain text goes through multiple computation rounds to produce the cipher text. RSA is different in that is it a mathematical process. I won’t go into too much detail of how the keys are generated, but as stated above it is all around the complexity of factoring large prime numbers. The actual encryption process is based around modular arithmetic. For more detailed information on how this works check out this very useful Wikipedia page.
Recently a few of the developers on my team decided to put a build monitor up on the TV we have in our team area. They settled on a system called Siren of Shame. Essentially this monitor tells you the health of your builds (we use it with TFS but it supports many more source code repositories and build systems). Siren of shame has a little twist though that has some other advantages.
The system is built around a leader board and points system. For a successful build you get 1 point. For a failed build you lose 4 points. Not only do you lose points, the PC that the monitor is running on emits a very loud trumpet like alarm, alerting the team to you failed build. It is really rather amusing when the alarm goes off, although not so amusing for the poor person who has broken his build!!!
You can also earn awards the longer you use the system like CI NINJA and other such funny power ups. You also get awarded points for fixing someone else’s broken build. Whilst this is all amusing and a bit of fun, it does encourage a slight behaviour change in a team. For a start, no one wants to be at the bottom of the leader board, so to get a better position in the board you need to check in little and often, no more only checking in once a day as this should be frowned upon anyway.
I think using this tool has made a difference to the team in the short time we have been using it. I would summarise the benefits as:
Visibility your build health.
Encourage developers to check in little and often.
Rewarded for fixing other peoples builds.
Promotes a little healthy competition.
More accuracy. No one wants that build siren going off as we poke fun at them..