Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
Available now!
Buy at Amazon US or
Buy at Amazon UK


» Windows API reference
» Webcam streaming in VB.NET
» Remoting with firewalls
» RSA from first principles
» Key & MouseLogger in .NET
» Networking Resource Kit for .NET
» Migrating VB6 Winsock to VB.NET
» Migrating C++ sockets to C#
» RFC Reference guide
» COM Reference guide
» WMI Reference guide
» SQL stored procedures
» TCP & UDP port reference
» NET Framework reference
» Ethernet Type codes
» MAC address assignments
» DLL entry point reference
» Boost SQL performance
» Free SMS UK
» Free SMS Ireland
» Free SMS South Africa
» Internet Explorer

Contact us

RSA from first principles

This article is taken from content omitted during technical review of the a book entitled "Network programming for .NET" (Buy at Amazon UK) (Buy at Amazon US)

Before first principle implementation deters you from using encryption, it must be said that .NET has its own built in cryptographic framework. You should not use first principle RSA unless you are communicating with applications that are not based on .NET or Windows.

RSA is named after its inventors, Rivest, Shamir, and Adleman. When it was first released it caused such a stir in government circles it was classified as a military product. This could be understandable, because it could mean that hostile groups could communicate freely without the possibility of interception by government intelligence. It was also protected by a US patent, which prevented derivative versions of RSA emerging.

In September 2000, the RSA patent expired, and cryptography laws were relaxed dramatically when it was found that policing the export of this information was unfeasible, especially with the advent of the Internet. Restrictions still apply today on the export of RSA from the USA to countries that the U.S. has under sanction (Iran, Cuba, Iraq, Libya, Syria, Sudan, North Korea).

The RSA algorithm itself is not hugely complex, but the mathematical formulas involved are quite intricate. The following example will take you step by step through the RSA algorithm.

Initially, two large random large distinct prime numbers are chosen, for notation purposes, these are referred to as p and q.

A third number is chosen that is relatively prime to (p-1)*(q-1), this number is referred to as e, the encryption exponent.

We define a fourth variable, n, such that n = p*q.

Using Euclid's greatest common divisor algorithm. The decryption component can be determined such that:

e*d = 1 (mod (p-1)*(q-1))

Where d is the notation for the decryption component.

Page 2  Page 3  Page 4  Page 5  Page 6  Page 7 


Copyright 2019 Infinite Loop Ltd.