Generating RSA Public Modulus, Public Exponent & Private Exponent As HexDecimals

I was messing around the other day with RSA encryption and came across the site http://nmichaels.org/rsa.py. It demonstrates how to use RSA encryption to encrypt/decrypt a text string. I was interested in the key generation for this, this page just has a generate button however, I wanted to understand how I could generate my own Public Modulus, Public Exponent & Private Exponent in the hexdecimal format. Continue reading

Generating a MD5 Checksum With Powershell

Recently, I was comparing .wim file images used for PXE booting and installing Operating System Images using SCCM OSD.  I was found that I received a Winload.exe boot problem when trying to build devices off a remote server.  The .wim file it was using looked the correct size in bytes, but generating an MD5 checksum against it showed that the copy on the remote server was different from the source .wim file.

Please find the Powershell function below to generate an MD5 against a file.

Function Get-Hash($file){
 
    $algo = [System.Security.Cryptography.HashAlgorithm]::Create("MD5")
    $stream = New-Object System.IO.FileStream($file, [System.IO.FileMode]::Open)
 
    $md5StringBuilder = New-Object System.Text.StringBuilder
    $algo.ComputeHash($stream) | % { [void] $md5StringBuilder.Append($_.ToString("x2")) }
    $md5StringBuilder.ToString()
 
    $stream.Dispose()
}

SCCM Client 32bit Client Stopping Registry Keys In SYSWOW64 Context Only Using SYSNATIVE

Background

I use SCCM, Operating System Deployment (OSD) and Microsoft Deployment Toolkit (MDT) 2010 update 1 to deploy Windows 7 SP1 (x64) and application installs during the build process.  The problem was a .vbs script which populates some auto-logon keys called via SCCM OSD during the application installation process was being hit with registry redirection, forcing any registry entries to go into
HKLM\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\WinLogon
rather than HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon. Continue reading

Windows 7, Windows XP Enable A Domain Or Local Auto Log On Via Registry Keys

Within Windows it is sometimes necessary for a device to automatically log on, without prompting a user for a user id or password.  This could be for the purpose of running a device as a kiosk, where a the device starts auto logs on and then the kiosk application loads full screen without any user interaction.  There are obvious security issues with this, and to keep this article simple and concise lets ignore these for the time being. This article shows how it is possible with adding the appropriate registry keys. Continue reading

C# .NET Datagrid – Events Don’t Trigger For Check Boxes Within A DataGrid

Background

I had a datagrid which contains a check box in column one. I wanted to trigger an event when any of the check boxes in column one were selected within the datagrid. This should be quite easy to achieve using the CellValueChanged event, however this would only fire on clicking the check box before the check (tick) had appeared. This would mean that when enumerating each line the check box would still not have a checked item and therefore this would not be what I had expected.

Solution

I found that in addition to the CellValueChanged event I needed to also have an event Cell_ContactClick as below

private void dataGridViewMain_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
    this.dataGridViewMain.CommitEdit(DataGridViewDataErrorContexts.Commit);
}

I assume CommitEdit states that I have finished editing, now commit the changes straight away and therefore the CellValueChanged is fired again after the check mark has had a chance to appeared in the check box., after which my enumerating each line for a check box would work.

Configuring Domain & User Mailbox Quotas in Dovecot via PostfixAdmin on Ubuntu 12.04LTS

Background

This article attempts to document how to configure Dovecot and domain & users’ mailbox quota sizes using information contained within PostfixAdmin and its associated tables.

During PostfixAdmin install time, the database is requested where PostfixAdmin can store additional tables.  Selecting the same database as postfix itself neatly installs these additional tables, that can then be used by Dovecot to monitor mailbox quota sizes. Continue reading

Configure Postfix, PostfixAdmin, Dovecot & SMTP-Auth SASL Using MySQL on Ubuntu 12.04 LTS

Background

This article sets out the steps needed to support multiple domains and their users’ email accounts allowing them to recieve emails via secure IMAP and send emails via a secure SMTP server using their POP3/IMAP credentials.  This is particularly useful for mobile users (road warrior) who may not have a consistent ISP provided SMTP server.

  • Recieve emails, using IMAPS or POP3S via Dovecot
  • Configuring Postfix to receive and send emails for virtual domain, and emails accounts
  • Configure SASL to provide a method of authenticating users email users to allow them access to the Postfix SMTP in order to send emails securely.
  • Easy delegated management of virtual domain mailboxes using PostfixAdmin

This article has been put together from countless other articles so that it should provide an all inclusive set of instructions.

Continue reading

Using the DD Linux Command To Backup & Restore

Background

I have been messing around with backing up a compact flash card and trying to put images onto an sd card for my Raspberry PI and thought I would jot down effective use of the Linux DD utility. The ‘dd’ command is one of the original Unix utilities and should be avaliable in all Linux distros. It can strip headers, extract parts of binary files and write into the middle of floppy disks; it is used by the Linux kernel Makefiles to make boot images. It can be used to copy and convert magnetic tape formats, convert between ASCII and EBCDIC, swap bytes, and force to upper and lowercase. Continue reading

Checking an MD5 Checksum Of A Downloaded File in Linux

MD5 is a one-way algorithm as defined by the RFC1321 that can be used to verify the integrity of a file or filesystem by providing as 128bit digital signature.  This digital signature is like a fingerprint for a file or filesystem and will change dramatically even if a single byte changes.

This means they are excellent in checking the integrity of a file that you have downloaded of a mirror that provides the files equivalent MD5Checksum.  Continue reading