# Friday, May 23, 2008

UnitTesting mit Visual Studio 2008

Robert Mühsig hat auf dem Code-Inside Blog einen wunderbaren Post über den Einstieg in Unit Testing mit Visual Studio 2008 geschrieben. Ich persönlich bin bisher ebenfalls von den von Robert angeführten Gründen noch kein Fan von Unit Testing, weiß jedoch, dass es die Qualität von Software verbessert (gegenüber keinen Unit Tests). Angetriggert durch seinen Post werde ich mich nun auch einmal mit dem der Thematik auseinander setzen. Der Einstieg scheint nicht so schwer zu sein (dank der mittlerweile hervorragenden Integration in Visual Studio) und verlieren kann man auch nichts.

Friday, May 23, 2008 8:41:56 AM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback
# Wednesday, May 07, 2008

Powershell TCP Listener

The project I'm currently working on is an embedded device without any graphical interface capability. The only ways to get some information out is the NIC or a serial port. There is also a CAN-Bus interface, but as far as my company developed the device it is better to not base our debugging capabilities on a potentially buggy part of the system. Out first debug out was implemented as a serial output tracer. As the day comes closer that out hardware prototypes will arrive, the higher the need to port the tracing over to the NIC as far as the final hardware won't have a serial port on it.
So last week the network tracer was check in into source control. Now, how to read these information?
Windows ships with Hyper Terminal. But this isn't very comfortable and you manually have to reestablish a lost connection. In my today's lunch break I wrote a small powershell script that listens to the network socket. At the moment I'm porting it to C# to add some more features.

But here is the first part, a small and simple powershell script to listen to a network socket. But please let me clarify that this is code snippet is NOT the way code. It was a fast hack to get it running. There is no error handling and ressources are not freed gracefully as it has to be terminated with ctrl + c. In clear words: This is a sample on how to receive data from a network socket.

$socket = new-object System.Net.Sockets.TcpClient("172.16.170.123", 9950)
if($socket -eq $null) { return; }
$stream = $socket.GetStream()
$buffer = new-object System.Byte[] $socket.ReceiveBufferSize
$encoding = new-object System.Text.AsciiEncoding

while($true)
{
   if($stream.DataAvailable)
   {
      $read = $stream.Read($buffer, 0, $socket.ReceiveBufferSize)  
      write-host -n ($encoding.GetString($buffer, 0, $read))
   }
}

Wednesday, May 07, 2008 8:47:07 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback
# Friday, March 21, 2008

News about TrueCrypt vulnerability

A little late, but I hope that still in time. Recently the TrueCrypt Devs reacted on the vulnerability report. From their point of view the author of the report hasn't analyzed the source code very well. He has stated the wrong routines and furthermore TC is just not able to encrypt the system partition on Windows 2000 computers. Nevertheless they acknowledged the problem with some storage drivers.
Caused by this problems the TrueCrypt-Team is currently thinking about filing a complaint about Microsoft to publish the hibernation API.

Friday, March 21, 2008 3:23:54 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback
# Thursday, March 13, 2008

Possible TrueCrypt vulnerability

In TrueCrypt 5.1 a possible vulnerability was found. A russian blog entry describes that the keys can eventually be written on the hard disk when the system goes into hibernation and the system drive is encrypted. From there they can be extracted later on. Especially Windows 2000 with a RAID controller based on Intel's Matrix Storage chips shall be vulnerable.

Until now there is feedback from neither the TrueCrypt developers nor any other security expert to confirm or disprove the suspicion.

Thursday, March 13, 2008 10:04:46 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback
# Wednesday, March 12, 2008

TrueCrypt 5.1 released

Today I was browsing the web and found, that TrueCrypt 5.1 was released on March, 10th. Furthermore I realized that I missed the 5.0a release, that came with several bug fixes. TrueCrypt 5.1 ships with some features that I missed in the last release (and that are not part of 5.0a):
  • Support for hibernation on computers where the system partition is encrypted. (Windows Vista/XP/2008/2003)
  • Increased speed of AES encryption/decryption (depending on the hardware platform, by 30-90%). (Windows)
  • BootLoader shrinked from 42KiB to 27KiB.
  • A backup of the Boot Loader (which is now small enough) is stored in the first drive cylinder. Therefore the BIOS automatically tries to boot with the backup Boot Loader when the primary Boot Loader fails.
And again TrueCrypt got even better with the new release. I will update my notebook this evening. If there will occure some unexpected problems, I'll write about them. After that, the next step is to finish the performance tests on my home machine. After that i will update this machine to 5.1, too, and will again do some performance tests. Hopefully I will be ready with this stuff this weekend. Until then, stay tuned.

Wednesday, March 12, 2008 12:13:56 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback
# Tuesday, February 19, 2008

Microsoft announces DreamSpark

Today Microsoft announced the DreamSpark program. For students from United States, the United Kingdom, China, Germany, France, Finland, Spain, Sweden, Switzerland and Belgium there is now a program to get Microsoft products without charge. In the second wave more countries are served.

The current list of products is:
  • Visual Studio 2008 Professional
  • Visual Studio 2005 Professional
  • XNA Game Studio 2.0
  • 12-month free membership in the XNA Creators Club
  • Expression Studio (Expression Web, Expression Blend, Expression Design, Expression Media)
  • Windows Server Standard Edition (2005, 2008 from next semester on)
  • SQL Server 2005 Developer Edition
  • [Update] Virtual PC 2007 [/Update]
For everyone who looks puzzled like me; here Bill Gates is talking about free software, students and technologies.

The DreamSpark Program is hosted here and the initial blog entry is from Veni, Vidi, Velcro.

Finally, I was headed towards this great announcement by heise news.

Tuesday, February 19, 2008 11:02:23 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback

CRC-Fehler beim Verschlüsseln der Systempartition mit TrueCrypt

Mein Notebooks ist secure, meine zweite Festplatte ebenfalls. Jetzt fehlt noch meine Systemplatte. Nach deren Verschlüsselung wollte ich dann einen Artikel über die Performance von TrueCrypt schreiben. Habe extra einige Messungen mit den unverschlüsselten Laufwerken gemacht.

Allerdings kommt es ja bekanntlich immer anders, als man es erwartet. Nachdem mein Notebook ohne Probleme verschlüsselt wurde, begab ich mich an meine Workstation. Dort lagern die "wichtigen Daten", das Notebook war eher der Proof of Concept. Meine Zweitplatte lies sich dort auch problemlos verschlüsseln. Als dies abgeschlossen war, sollte als letztes die Windows Parition ihr freies Dasein aufgeben. Aber Pustekuchen. Nach dem Schlüsselerstellen, CD-Brennen und Testbooten sagt mir TC nach weniger als einem Prozent Fortschritt: Ätsch, ich hör auf wegen "Is' nich'". Oder anders: CRC-Dateifehler. Leider war's das auch schon an Informationen.

Nach kurzer Recherche im Internet bin ich auf einige Informationen gestoßen. Folgende Dinge können das Problem beheben, müssen aber nicht:

  • chkdsk /f /r: CheckDisk mit voller Suche und Reparatur der gefunden Probleme. Hatte ich bereits ausgeführt, hat jedoch nicht geholfen.
  • Je nach Festplattenhersteller: Maintenance-Tool der Festplatte für Deep-Scan.
  • HDTune? Selbst noch nie benutzt.
Hier noch einige Links:
Probleme mit TrueCrypt
TrueCrypt 5.0 ist da
TrueCrypt 5: CRC-Fehler

Einige Hintergrundinformationen zum Fehler. Der CRC-Fehler wird generiert, wenn TC einen Sektor findet, der defekt ist (dessen errechnete Prüfsumme nicht mit der erwarteten Prüfsumme übereinstimmt). Soweit meine Informationen reichen, spielt es keine Rolle, ob dieser Sektor intern (innerhalb der Festplatte) als defekt markiert ist. Die Festplatte kann ja defekte Sektoren als solche markieren und durch Ersatzsektoren austauschen. So lange, bis keine Ersatzsektoren mehr vorhanden sind. Ab dann schwindet die Kapazität. Aber zurück zu TC. TC weigert sich, auf einer Festplatte zu arbeiten, die defekt ist. Und das aus gutem Grund. Ein Sektor, der seine Daten nicht "halten" kann, gefärdet die Lesbarkeit des gesamten Containers (diese Information kann ich nicht genau belegen, dafür habe ich mir den Verschlüsselungsalgorithmus noch nicht genau genug angeschaut), zumindest aber seines Blocks. Um dies und den damit einhergehenden Datenverlust zu vermeiden, bricht TC den Vorgang ab.

Wer mit den oben beschriebenen Maßnahmen keine Linderung erzielt, sollte über eine neue Platte nachdenken. Wer vertraut schon gerne seine Daten einem System an, was nachweislich instabil ist. Genau diesen Weg beschreite ich auch. Allerdings denke ich direkt darüber nach, meinen Rechner, der immerhin schon 4 Jahre auf dem Buckel hat, auszutauschen. Wer jedoch von der Verschlüsselung absieht, ohne sich finanziell belasten zu wollen, kann den "anverschlüsselten" Teil im Boot-Menü des TC.Boorloaders wieder entschlüsseln. Dauert ein paar Minuten und anschließend ist alles wieder frei und unsicher.

Und für die Verschwürungstheoretiker: TC steckt mit der CD-Industrie unter einer Decke. Bei jedem neuen Versuch, die Platte zu verschlüsseln, muss eine Rescue Disc gebrannt werden ;)

Tuesday, February 19, 2008 11:01:06 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback
# Wednesday, February 06, 2008

TrueCrypt 5 finally got what I ever looked for

Yes, finally TrueCrypt offers you encryption of your whole hard drives. That feature I was looking for for ages. I was noticed about the new TrueCrypt-Version by Thomas from Glorf-IT, later on I read the article on heise.

I immediately downloaded the new version and started installing it. On my laptop. Not on my PC. On my laptop is only data that is stored on my pc's drives so there is no actual loss if something is messed up up afterwards.

The Installation process starts as usual, installing the new TrueCrypt on your computer. Then after starting I recognized this nice menu entry Encrypt System Partition/Drive... Well, that's is the killer feature.

Now, guess, what the first action was I did with the new version. I just clicked on it. In the following process TrueCrypt asks you for several things; do you want to encrypt only the windows system partition or the whole disk drive? Is it a single boot or multi boot-system? Next question is: What encryption algorithm do you want? If you cannot decide, you can benchmark your system and select the fastest one. After choosing one you have to specify the password. And this password should a a) safe (letters, numbers, special characters, randomly mixed) and b) unique (don't use a password you used anywhere else).
After that you find yourself inside the matrix. TrueCrypt pops up a dialog that tracks your mouse movement above this dialogue. The generated data are used for encryption. So, the longer and the more randomly you move, the better the encryption will be.

After this, the actual keys are calculated. The next step convinced me that everything I'm doing is well planned and even for common users no big deal at all. TrueCrypt wants me to save a TrueCrypt Rescue Disc.
What is a True Crypt Rescue Disc? Quite simple. It is a disk with three parts that will help regain your data if anything goes wrong during the encryption process or later on using your encrypted drive. With the TRD four things can be done. These are:
  • Information is stored to restore your TrueCrypt boot loader, your master key, or other critical data.
  • The TRD itself is bootable and loads afterwards the system that is stored inside your encrypted volume.
  • If your system gets damaged, the TRD can decrypt the volume for external access.
  • The TRD contains a backup of the first drive cylinder. That cylinder usually contains the system boot loader., so the original statecan be restored.
After saving this ISO-file, you have to burn it. TrueCrypt stops working until it has verified the data on the CD. That means, you are forced to burn the CD. Well, from my point of view this is a very smart way to prevent data loss. And TrueCrypt also provides you two tools for burning it. What a service. Kudos to the TrueCrypt-Team. This is just a amazing piece of software with many detailed thoughts went into.

So, next step. When the CD is verified, you can choose if and how often your hard drive shall be wiped before the actual encrypted data is stored. Because of the time consumption and the data I have on my laptop, I decided not to wipe my drive. While nearing completion TrueCrypt now does a testboot with the boot loader installed and where you have to enter your password. If this test boot is ok, you can press the red button and start encrypting your drive.

In résumé there is just to say that TrueCrypt 5 is a leap forward in free cryptography and personal securirty. And this whole thing is presented in an easy to use way. Everyone out there who never thought about personally securing his data, just give it a try. And wish me luck. 49 minutes remianing until my drive is finished :)

Wednesday, February 06, 2008 10:54:37 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback
# Thursday, December 20, 2007

Liquid XML Studio

I recently found a very nice XML Schema Editor. I was looking for something more comfortable than then one in VS. I didn't want to start the studio and create a new project just to make a XSD. A very small article in (I think it was) the dotnetpro pointed me on the free Liquid XML Studio. After a short period of time I am very satisifed with this editor. It has really some nice functionality i won't miss anymore.

Thursday, December 20, 2007 12:28:44 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback
# Thursday, December 13, 2007

.NET Developer Essentials Installer

Norbert Eder has released a small programm called .NET Developer Exxentials Installer. This nice little program has a list of tools stored any .NET-Developer cannot be without. It comes in a small 250k zip file, runs, as expected, without installation and targets .NET Framework 3.0.
After starting, a nice UI pops up that is fully self explaining. You can install tools from the standard list, can update the list, delete items, add your own favourites, store the list and load lists. So its a nice tool for e.g. making a set of tools  every .NET-Dev at your company should own. If anything changes, simply update the list and notify the devs by mail. All done. No link messing, always only on version in use...
From my point of view a very outstanding piece of code. Actually I'm wondering why this hasn't already been implemented.


Thursday, December 13, 2007 8:44:23 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0] | Trackback