12,241,599 members (66,577 online)
Add your own
alternative version

236.4K views
14.2K downloads
40 bookmarked
Posted

# RSA encryption/decryption

, 5 May 2003
 Rate this:
Please Sign up or sign in to vote.
Find a RSA implementation in VC++. Key size is 32-bit.

## Introduction

Note: Please refer rsa.doc for more details on code and software. I can be contacted at bhaskar_bora@yahoo.com for further queries. Implementation includes private and public key (32-bit) generation and support of text file encryption and decryption. This document contains the algorithms and information required to design and implement RSA algorithm in VC++. This software is only for text data encryption and decryption. Document also contains the software usage guidelines and screen-shots.

## Intro to RSA

RSA algorithm is mainly a public key encryption technique used widely in network communication like in Virtual Private Networks (VPNs). In public key encryption technique, a key is split into two keys and they are called as public and private keys. Public key is advertised to the world and private key is kept secret. It is not possible to generate private key using the public key. So, someone who knows the public key cannot decrypt a message after it has been encrypted using the public key.

RSA algorithm is a block cipher technique in which plain text and cipher text are integers between ‘0’ and ‘n-1’ from some ‘n’. In RSA algorithm encryption and decryption are of following form, for some plain text M and cipher text C:

`C = M^e mod n`

`M = C^d mod n`

Both sender and receiver must know the value of ‘n’. The sender knows the value of ‘e’ and only receiver knows the value of ‘d’. Thus, this is a public-key encryption algorithm with a public key of KU={e, n} and private key of KR={d, n}. For the algorithm to be satisfactory for public-key encryption, the following requirement must be met

1. It is possible to find values of e, d, n such that M^ed = M mod n for all M<n.
2. It is relatively easy to calculate M^e and C^d for all values of M<n.
3. It is infeasible to determine d given e and n.

## License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

## About the Author

 Web Developer India
Working with EMC Corp, Bangalore (India) in distributed embedded software design. Like to read and code in storage, computer security and language design areas.

## Comments and Discussions

 FirstPrev Next
 decrpter for data in SHA1/RSA format.mdb file oviis_4u3-May-09 5:40 oviis_4u 3-May-09 5:40
 Re: decrpter for data in SHA1/RSA format.mdb file hebbiche26-May-09 12:17 hebbiche 26-May-09 12:17
 My vote of 1 Kirk211221-Apr-09 9:54 Kirk2112 21-Apr-09 9:54
 Need help ! Hackmahesh4-Apr-09 8:52 Hackmahesh 4-Apr-09 8:52
 My vote of 1 Zinkyu22-Dec-08 10:10 Zinkyu 22-Dec-08 10:10
 kamine kutte ye kya tha????????? anubhavkapuuri28-Nov-08 4:31 anubhavkapuuri 28-Nov-08 4:31
 i can't run program! nguyenvanchinh1215-Nov-08 0:37 nguyenvanchinh121 5-Nov-08 0:37
 HOW TO HANDEL 128 BIT KEY GENARETION tandra islam21-Apr-08 8:56 tandra islam 21-Apr-08 8:56
 How to handle 521 bit encryption/decryption Yiping Zou21-Jun-04 17:01 Yiping Zou 21-Jun-04 17:01
 Doesn't work for N less than the biggest ASCII code, which is Your default Maxim Violin31-Jan-04 1:44 Maxim Violin 31-Jan-04 1:44
 Re: Doesn't work for N less than the biggest ASCII code, which is Your default BhaskarBora13-Dec-04 23:53 BhaskarBora 13-Dec-04 23:53
 Re: Doesn't work for N less than the biggest ASCII code, which is Your default bygreencn10-Dec-06 17:48 bygreencn 10-Dec-06 17:48
 Using linear search to check if a number is prime or not? Mustafa Demirhan6-May-03 9:39 Mustafa Demirhan 6-May-03 9:39
 Re: 32 Bits!!! Niklas Lindquist6-May-03 3:14 Niklas Lindquist 6-May-03 3:14
 Re: 32 Bits!!! Jörgen Sigvardsson6-May-03 7:06 Jörgen Sigvardsson 6-May-03 7:06
 Re: 32 Bits!!! Kastellanos Nikos6-May-03 7:19 Kastellanos Nikos 6-May-03 7:19
 Re: 32 Bits!!! Antony Michael Kancidrowski13-May-03 0:25 Antony Michael Kancidrowski 13-May-03 0:25
 Re: 32 Bits!!! Shivian14-Jul-08 16:26 Shivian 14-Jul-08 16:26
 Re: 32 Bits!!! BhaskarBora21-May-03 23:13 BhaskarBora 21-May-03 23:13
 Last Visit: 31-Dec-99 19:00     Last Update: 29-Apr-16 6:00 Refresh 12

General    News    Suggestion    Question    Bug    Answer    Joke    Praise    Rant    Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160426.1 | Last Updated 6 May 2003
Article Copyright 2003 by BhaskarBora
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid