About
Community
Bad Ideas
Drugs
Ego
Erotica
Fringe
Society
Privacy
100 Ways to Disappear and Live Free
A Guide to Intelligence Collection Methods
A Study of Criminal History Records, as Maintained by the RCMP
A Theory of Information Warfare: Preparing for 2020
An Appraisal of the Technology of Political Control
Anonymity on the Web
Antisurveillance
Appeal Filed in Teenager vs. FBI Case
Beating The FBI
Big Brother's Little Helpers: Private Intelligence Networks
Biometric ID Cards
Bugs, Taps And Infiltrators: What To Do About Political Spying
Carnival Booth: Defeating Computer-Assisted Passenger Screening System
Carnivore FAQ
China's Golden Shield: Corporations and the Development of Surveillance Technology in China
Civil Liberties Under Threat
Cooperation of Telecommunications Providers with Law Enforcement
Cryptography: Policy and Technology Trends
Disabling CCTV / Video Cameras
Disabling Surveillence Video Cameras
EPIC Analysis of Draft Guidelines on Searching and Seizing Computers
EU Lawful Interception of Telecommunications
Eavesdropping On the Electromagnetic Emanations of Digital Equipment
Electronic Surveillance in a Digital Age
Email Privacy Law Review
European Union and FBI Launch Global Surveillance System
Executive Guide to the Protection of Information
Exposing The Global Surveillance System
Exposing the Global Surveillance System
FBI Investigates Domestic Activities to Identify Terrorists
Fingerprints
General Counterdrug Intelligence Plan
Gmail Bedfellows
Hiding Yourself
Homeless Tracking Fact Sheet
How COINTELPRO Helped Destroy the Movements of the 1960s
How Private Is My Credit Report?
How Tax Returns are Selected for Audit
How To Create A New Indentity
How To Get Lost
How to Get Anything on Anyone
IRS Cups It's Ear to Cordless Phones
IRS and Terrorist-Related Information Sharing
Identification, Anonymity and Pseudonymity in Consumer Transactions
Identification: A Move Towards the Future
Identity Cards: Frequently Asked Questions
Interception Capabilities 2000
Internet Security and Privacy for Activists and Citizens
Internet Security and Privacy for Activists and Citizens
Investigators Guide to Sources of Information
Is the NSA Sniffing Your Email?
Mail Surveillance
New Communications Technologies and Traditional Civil Liberties
Participating With Safety
Privacy Rights of BBS Users
Privacy or Service: Must We Be Forced to Choose?
Proof of Echelon?
Rebirth Methods In Post 9/11 USA
Recieve Your FBI File
Report of the Interception of Communications Commissioner for 2001
Schengen Information System: SIS II
Smart Cards: Opportunities for Public Sector Applications
Spook Words
Spy Secrets
Statements by the DCI and the NSA Director on Economic Spying
Surveillance Conference Overview
Testimony of Mark M. Ishikawa CEO BayTSP.com
The "Enemy Within": EU Plans the Surveillance of Protestors
The Group Trap
The Joy of Handles
The Libertarian Party Represents You
The Shocking Menace of Satellite Surveillance
The TEMPEST Method of Computer Data Interception!
The World of Surveillance
They Were Spying on Us: Detroit Police Red Squad
Touching Big Brother: How Biometric Technology will Fuse Flesh and Machine
U.S. Military Spying on Web Sites
UK ID Cards: Majority in Favor
UK National ID Cards - A Consultation
Using the Freedom of Information Act: Revised Edition
Watching the Watcher Watching You
Watching the Watchers: The Spanish Police
What To Do When They Ask For Your Social Security Number
Who's Afraid of Carnivore? Not Me!
Why Legal Action Should Be Taken for Installation of Surveillance Cameras in Public Places
Will We Be Under Total Surveillance?
Your Papers Please
Technology
register | bbs | search | rss | faq | about
meet up | add to del.icio.us | digg it

RSA Encryption and Decryption

by Modern UART

Keeping Secrets File #3

RSA Encryption and Decryption

by Modern UART

written for the New Gnostics, NYC

This text file is intended to serve as a tutorial for those who wish to encrypt and decrypt their files using the RSA scheme. While the scheme is explained in detail, I suggest that another scheme be utilized. My reasons for making this recommendation can be found scattered throughout the text.


RSA encryption is a method for securing data. It has unique properties that make it especially attractive for securing data that must be transferred among many parties. Sensitive information that is, for instance, stored on a bulletin board system, can be secured using RSA and posted publicly. It can be downloaded by several people who possess keys for the data, and can only be decrypted with the right key.

Can RSA encryption be broken? Well, yes and no. Data that is encrypted with a sufficiently strong key cannot be broken within the life span of the planet earth. Data encrypted with a weak key can be broken by a ten-year-old with a pocket calculator.

RSA is dependent upon the use, and the unique properties, of prime numbers. A VERY large prime number used as a key is a VERY strong key. The problem is, how do we get those large prime numbers?

First, for you real math virgins, prime numbers are numbers that can only be divided by themselves and 1 with there being no remainder. The early primes are 2,3,5,7,.... 1 is considered neither prime or non-prime. The common way to find prime numbers is to use the sieve of Eratosthenes. This has been the only true way to find all primes in a range since the third century B.C. The sieve works like this: Let's say you want to find all the prime numbers in between 2 and 100. Well, you write each number down and start with 2. 2 is prime, so circle 2 and cross off all the numbers in the list that would go evenly into 2 (4,6,8, etc.). Go on to 3. It hasn't been crossed off, so it's prime. circle it and cross off all the numbers that go evenly into it (9,12, etc.). Go on to 4. It's crossed off so go on to 5. It's not crossed off so it's prime. Circle it and cross off numbers that would go evenly into it. Keep this up until all the numbers in the list are either circled or crossed off, and all the primes are circled.

On a computer, this can easily be done in an array.

Obviously, hunting for primes is a big pain in the ass. This is the first problem with RSA. If we wanted to find all the prime numbers between, let's say, 1 and 8,000, we'd need an array with 8,000 elements to use the sieve. If we were to define each element as a bit, that's 1000 bytes. but the largest prime we could hope to find with such a program would be 8000 (which is obviously not prime). And 8000 isn't a large enough prime to make RSA secure. Try 8000000000000000000000000. This is, it's true, a pain in the ass, but it's also why RSA works. Because it's so hard to find primes, even on computers, the chances of your data being decrypted are really astronomical.

RSA really is based on a simple mathematical principle. It's easier to multiply two prime numbers than it is to figure out what two prime factors a particular huge composite (non-prime) number is the product of.

Okay, let's say I want to receive encrypted messages. I tell you that I want the messages sent as follows: I will supply you with two numbers, a very large number N and an integer r. You must transform your message into an integer of no greater than N, breaking it into blocks if necessary. Now raise this number to the power r, divide this result by N, and send me the remainder.

Now, let's look at how we decide what those numbers should be. We take two prime numbers, let's say 3 and 11. We multiply them to get 33, which will be our value for N. Next, we go through the following procedure to get two more values (one value will be r and one will be s, which will be used for decryption). We subtract 1 from each prime number to get 2 and 10, then we multiply these numbers. r can be any value between 1 and twenty that is not a factor of 20, so 2, 4, 5, and 10 are eliminated. To determine s, we need to find a number that when multiplied by our value r and then divided by 20 will always leave a remainder of 1. So let's say we chose 7 as r, then a suitable value for s might be 3, since r*s(mod 20) = 1 then 7*3(mod 20) = 1, where mod = modulo, a fancy word for divide and throw away everything but the remainder.

I want you to send me an encrypted message, so I give you N and r but keep s to myself.

Let's say the message is "H". In order to keep the example simple, I will take certain liberties. First of all, instead of using ASCII, I will simply number the letters of the alphabet. That is because in order for the scheme to work, the values transmitted must fall between the range of 1 and N. ASCII would automatically violate that constraint using the simple values I've defined.

So, "H" here will equal 8. Since N=33, you are within the constraints of N. You will compute 8^7 = 2097152. Now you compute 2097152/33 and keep the remainder, which is 2. Okay, so you send me the number 2.

To decrypt the message, I would compute 2^3. This is, of course, 8. Usually I would have to divide this by N (33) and the remainder would be my answer. In this simple example, simply multiplying the message has yielded the answer.

That's all there is to it.

But here we've reached the first of the series of problems with RSA. First, any schoolkid could have cracked the above example. For the sake of the example I kept it extremely simple, yet still had the intermediate value 2097152. Much larger values are needed for N, which usually means much larger values for r and s. These yeild absolutely uncrackable results, but you try writing the code for 120 byte unsigned integers and see how far you get. And 120 byte unsigned integers are just the beginning, really. To send the code "Hi!" as a 24-bit integer, you'll get an intermediate value with a minimum of 33 (decimal) digits, whatever values you have picked for N, r, and s. Try sending a whole sentence!

This makes RSA really slow, and absolutely unusable on all but the fastest of micros. Now, there are better algorithms for computing primes, specifically ones that skip a few in between. Actually, these are the only algorithms that are worth using. The great thing is that while you only need to be sure any two large numbers are prime to encrypt a message, a person would have to try every possible prime to crack a message. And with a (very) small stream length, RSA is a possibility. Also, RSA really doesn't explode the length of a file like some encryption methods (like multi-pass DES) do. Because it uses modulo arithmetic, packet sizes are always kept under the length of N. Those are the benefits of RSA. However, several other encryption methods, particularly key-dependant ones like multi-pass DES and toth, are more practical. On the other hand, If you post your keys, anyone in the world can use them to send you messages and only you can decrypt them. That's not bad. Still to come: knapsack (a variation of RSA), and toth (a two-key password system).

 
To the best of our knowledge, the text on this page may be freely reproduced and distributed.
 

totse.com certificate signatures
 
 
About | Community | Bad Ideas | Drugs | Ego | Erotica | Fringe | Society | Technology
Hot Topics