Search This Blog

Showing posts with label ElGamal. Show all posts
Showing posts with label ElGamal. Show all posts

Saturday, February 6, 2010

Mail Client With ElGamal Cryptography


System architecture of the program Mail Client with ElGamal cryptography is :





From the picture above can be seen that the mail client sender encrypts the message by sending a plain text parameter of the encryption function. After that sends cipher text encryption function as a result of encryption. With the SMTP port and the cipher text of the message sent to the Mail Server. Mail Server Mail Server sends to the destination if the recipient has a different Mail Server. With POP3 or Imap protocol then the message recipient mail client can receive email. Email recipients can decrypt the cipher text sent parameters. Decryption function will check first private key. After the enter key then the private decryption function can send plain text decryption results. The essence of the above programs are Mail client can send an email to the mail server after encryption. And the recipient mail client can download email delivery at Mail Server, and then decrypt.

the process is :

  1. 1) The process triggers the generation of these numbers is a process to generate random prime numbers as a trigger for ElGamal key lock so that adds to the complexity in its calculations. The more complicated the calculation will be more secure algorithm.
  2. 2) Power private key (x) is the process to calculate the number x of keywords (in a phrase or sentence) that users input. With this process the X does not come out of the range specified in ElGamal.
  3. 3) Generation of public key (y) this process is to calculate the public key (y) by using the private key (x). Y goal is the key to be distributed to the public, so that others can encrypted messages to be sent to us. And we can decrypt the message with the key x (private).
  4. 4) Encrypt the message that the process used to encrypt the plain text or email message early. ElGamal method then this process will produce cipher text (password) with 2 characters represent the plain text characters 1. So the cipher text twice the amount of plain text.
  5. 5) Send the message this process is the process of sending a message to the Java mail to Email Server. This process uses the SMTP protocol to send email. Messages sent in the form of byte [] so that the sending process can go smoothly and be accepted by the Mail Server.
  6. 6) Reading emails this process is the process for reading emails sent. Initially Email Client to download messages to the Mail Server using the POP3 or Imap protocol. Users can choose one of these 2 protocols. After downloading the message is displayed in the table in java mail messages.
  7. 7) Decryption email messages in your email Server is not in decryption. Always in a cipher text. So to read email decryption process carried out beforehand. This process checks first private key. Then decryption process can be done with the same result as the plain text before encryption by the sender in the email.
to download the example Java program click here

Tuesday, February 2, 2010

Simulation of ElGamal Cryptography

The following are examples of simulation programs ElGamal cryptography. This program is made with JAVA programming language, and its design interface with Net bean. You can download the project files (Indonesian version) here. click here to download

Generate Trigger Numbers

In ElGamal fruit numbers are 2 triggers, namely g and k. both must be excellent and worth less than the range of data or p. Numbers g are constants or fixed. So in this final project in the initial g value 13. The value of k is a variable or change 1 change for each plain text character.
In this final project in the form k do in a class GenerateK. Program listing is

public class GenerateK {

double kb ; double kx = 0;

public double setK (){ int prima =0;

while(prima == 0){

kx = (Math.random()*221)+1; prima = cekprima (kx); } return kx; }

public double getK (){

kb = setK(); return kb; }

private static int cekprima(double ky){

int ky1 = (int)ky; int sip =1;

int batas = (int) Math.ceil(ky/2);

if((ky1==1)||(ky1==2)){

sip=1;}

else{

for(int i=2;i <= batas;i++){

int tes = ky1 % i;

if(tes==0){sip = 0; break;}

else sip =1;} }

return sip;}}

call class is conducted generateK random integer value between 1 and 222. Then the numbers k will be test in prime testing. Prime test is testing whether an integer k prime or not, by way Modulo operations with numbers number k 2 to k \ 2. If the modulation is always not equal to zero, k can be considered prime. But if one Modulo operations produce zero, k is not prime. If it does not fit the random re-done to produce a prime k.
To get the number k, after GenerateK create a new object, do the calling method getK (). The following example program listing:


800x600

GenerateK bikink = new GenerateK ();

double kd = Math.ceil(bikink.getK());

int k = (int) kd - 1;


in decrypt and encrypt process you can lean more in the file download



Sunday, October 18, 2009

The Security of EL GAMAL

some people ask me, it is posibble to break EL Gamal Cryptosytem...i said, that everything is posibble in the Computer World...But to break El Gamal it have a long way and a long time... El Gamal Security have a discrete problem. but i have some tips how to analyze the El gamal Strength... this way not to break and use to crime..but to give us some known, to make our El Gamal Criptosystem better strength....

 ElGamal is very secure. The only ways to break it are by finding collisions in the hash functions it uses, or (in theory) by computing the secret key when two ciphertext messages are sent with the same function of the secret exponent. See Wikipedia for more details

You can do what I do when using safe (p=2p'+1) prime moduli, which is to 
convert the plaintext to all QR's so semantic security is preserved - 
although this is in effect working in the subgroup of QR's of order p', 
which is presumed DDH-hard. 



Which is just a feeble excuse :) to present this method of ensuring all the 
bits are QR's, and the overall scheme is IND-CPA. I don't know who else 
invented the method first, but I haven't seen it elsewhere: 


[- 

Chose p' so p' = 1 mod 4. Thus p = 3 mod 8, and (2/p) = -1 (ie 2 is a QNR 
mod p). 

Before encryption prepend the bits 001 to the plaintext, test for QR: if it 
is QR then pass on to the encrypter, if it is NQR then shift left (multiply 
by two) before passing it on. 

2 is NQR, and any NQR x any NQR = a QR - so all the blocks sent to the 
encrypter are QRs. 

After decryption, shift right if the second bit of the block is set. Discard 
the first 3 bits.

Thursday, August 13, 2009

About Taher El Gamal (wikipedia)


Dr. Taher Elgamal

(born 18 August 1955) is an Egyptian cryptographer. Elgamal is sometimes written as El Gamal or ElGamal, but Elgamal is now preferred. In 1985, Elgamal published a paper titled A Public key Cryptosystem and A Signature Scheme based on discrete Logarithms in which he proposed the design of the ElGamal discrete log cryptosystem and of the ElGamal signature scheme. The latter scheme became the basis for Digital Signature Algorithm (DSA) adopted by National Institute of Standards and Technology (NIST) as the Digital Signature Standard (DSS). He also participated in the 'SET' credit card payment protocol, plus a number of Internet payment schemes.

Elgamal has gained a Bachelor of Science degree from Cairo University, and Masters and Doctorate degrees in Computer Science from Stanford University. He served as chief scientist at Netscape Communications from 1995 to 1998 where he was a driving force behind SSL. He also was the director of engineering at RSA SecuritySecurify in 1998 and becoming their CEO. When Securify was acquired by Kroll-O'Gara[1], a company providing Independent IT Controls measurement and software verification at the binary level. In October 2006 he joined Tumbleweed Communications [2] in a capacity of a Chief Technology Officer. Tumbleweed was acquired in 2008 by Axway Inc. He is an advisor to Onset Ventures, glenbrook partners, PGP corporation, Arcot Systems, Finjan, Facetime and serves as Chief Security Officer of Axway, Inc. Inc. before founding he became the president of its information security group. In 2008, Securify was acquired by Secure Computing and is now part of McAfee. In addition, Elgamal sits on the board of Vindicia, a company which provides online payment services as well as the Advisory Board of SignaCert, Inc.


Tuesday, August 11, 2009

Number Of ElGamal



If all the prime factors of p - 1 are relatively
small, lots of cryptographic attacks are possible. Generally, primes p such that p-1 has a big prime
factor are much better.









Note: k; r can be computed before the message is seen. In addition, you need a new k and r
every time you sign a message. Otherwise, it will not be secure.







Digital Signature Algorithm (DSA)

Addition Chaining or Divide and Conquer for ElGamal Programing

Problems in the Calculations exponential and modulo in 'El Gamal' can be done using the manual counting or a calculator, but if the code is calculated in the program will generate a value of 0. this is because there is no data type in programming resource that can accommodate the data before these modulus. So to solve this problem some authors reduce the formula to calculate a and y.

vw mod p = [( v mod p )( w mod p )] mod p
example :



Method above in mathematics discreet technique called divide and conquer. Referred to as addition chaining technique because the results was carried out together with direct multiplication modulo operation. With this technique, the results will not reach a large number.

Besides the problem of y and a, the value of b also has a similar problem. Even in the calculation of b values before the integer modulus greater. This is because in addition to exponensial with a large number but also multiplied by the value of plain text blocks to mj. With divide and conquer method is also the formula b can be measured down

revealed to be:


From the equation above can be concluded that the value of mj is no need to be a factor during the process y^k mod p is calculated. Fair value multiplied later after y ^ k mod p is established, and then the new modulus with p more

ASCII TABLE FOR EMAIL APLICATION USE ELGAMAL KRIPTOGRAPHY

{“32”,” ”} 0
{“33”,”!”} 1
{“34”,”””} 2
{“35”,”#”} 3
{“36”,”$”} 4
{“37”,”%”} 5
{“38”,”&”} 6
{“39”,”’”} 7
{“40”,”(”} 8
{“41”,”)”} 9
{“42”,”*”} 10
{“43”,”+”} 11
{“44”,”,”} 12
{“45”,”-”} 13
{“46”,”.”} 14
{“47”,”/”} 15
{“48”,”0”} 16
{“49”,”1”} 17
{“50”,”2”} 18
{“51”,”3”} 19
{“52”,”4”} 20
{“53”,”5”} 21
{“54”,”6”} 22
{“55”,”7”} 23
{“56”,”8”} 24
{“57”,”9”} 25
{“58”,”:”} 26
{“59”,”;”} 27
{“60”,”<”} 28 {“61”,”=”} 29 {“62”,”>”} 30
{“63”,”?”} 31
{“64”,”@”} 32
{“65”,”A”} 33
{“66”,”B”} 34
{“67”,”C”} 35
{“68”,”D”} 36
{“69”,”E”} 37
{“70”,”F”} 38
{“71”,”G”} 39
{“72”,”H”} 40
{“73”,”I”} 41
{“74”,”J”} 42
{“75”,”K”} 43
{“76”,”L”} 44
{“77”,”M”} 45
{“78”,”N”} 46
{“79”,”O”} 47
{“80”,”P”} 48
{“81”,”Q”} 49
{“82”,”R”} 50
{“83”,”S”} 51
{“84”,”T”} 52
{“85”,”U”} 53
{“86”,”V”} 54
{“87”,”W”} 55
{“88”,”X”} 56
{“89”,”Y”} 57
{“90”,”Z”} 58
{“91”,”[”} 59
{“92”,”\”} 60
{“93”,”]”} 61
{“94”,”^”} 62
{“95”,”_”} 63
{“96”,”`”} 64
{“97”,”a”} 65
{“98”,”b”} 66
{“99”,”c”} 67
{“100”,”d”} 68
{“101”,”e”} 69
{“102”,”f”} 70
{“103”,”g”} 71
{“104”,”h”} 72
{“105”,”i”} 73
{“106”,”j”} 74
{“107”,”k”} 75
{“108”,”l”} 76
{“109”,”m”} 77
{“110”,”n”} 78
{“111”,”o”} 79
{“112”,”p”} 80
{“113”,”q”} 81
{“114”,”r”} 82
{“115”,”s”} 83
{“116”,”t”} 84
{“117”,”u”} 85
{“118”,”v”} 86
{“119”,”w”} 87
{“120”,”x”} 88
{“121”,”y”} 89
{“122”,”z”} 90
{“123”,”{”} 91
{“124”,”|”} 92
{“125”,”}”} 93
{“126”,”~”} 94
{“127”,”DEL”} 95
{“128”,”Ç”} 96
{“129”,”ü”} 97
{“130”,”é”} 98
{“131”,”â”} 99
{“132”,”ä”} 100
{“133”,”à”} 101
{“134”,”å”} 102
{“135”,”ç”} 103
{“136”,”ê”} 104
{“137”,”ë”} 105
{“138”,”è”} 106
{“139”,”ї”} 107
{“140”,”î”} 108
{“141”,”ì”} 109
{“142”,”Ä”} 110
{“143”,”Å”} 111
{“144”,”É”} 112
{“145”,”æ”} 113
{“146”,”Æ”} 114
{“147”,”ô”} 115
{“148”,”ö”} 116
{“149”,”ò”} 117
{“150”,”û”} 118
{“151”,”ù”} 119
{“152”,”_”} 120
{“153”,”Ö”} 121
{“154”,”Ü”} 122
{“155”,”blank”} 123
{“156”,”£”} 124
{“157”,”¥”} 125
{“158”,”_”} 126
{“159”,”ƒ”} 127
{“160”,”á”} 128
{“161”,”í”} 129
{“162”,”ó”} 130
{“163”,”ú”} 131
{“164”,”ñ”} 132
{“165”,”Ñ”} 133
{“166”,”ª”} 134
{“167”,”°”} 135
{“168”,”¿”} 136
{“169”,”_”} 137
{“170”,”¬”} 138
{“171”,”½”} 139
{“172”,”¼”} 140
{“173”,”¡”} 141
{“174”,”«”} 142
{“175”,”»”} 143
{“176”,”░”} 144
{“177”,”▒”} 145
{“178”,”▓”} 146
{“179”,”│”} 147
{“180”,”┤”} 148
{“181”,”╡”} 149
{“182”,”╢”} 150
{“183”,”╖”} 151
{“184”,”╕”} 152
{“185”,”╣”} 153
{“186”,”║”} 154
{“187”,”╗”} 155
{“188”,”╝”} 156
{“189”,”╜”} 157
{“190”,”╛”} 158
{“191”,”┐”} 159
{“192”,”└”} 160
{“193”,”┴”} 161
{“194”,”┬”} 162
{“195”,”├”} 163
{“196”,”─”} 164
{“197”,”┼”} 165
{“198”,”╞”} 166
{“199”,”╟”} 167
{“200”,”╚”} 168
{“201”,”╔”} 169
{“202”,”╩”} 170
{“203”,”╦”} 171
{“204”,”╠”} 172
{“205”,”═”} 173
{“206”,”╬”} 174
{“207”,”╧”} 175
{“208”,”╨”} 176
{“209”,”╤”} 177
{“210”,”╥”} 178
{“211”,”╙”} 179
{“212”,”╘”} 180
{“213”,”╒”} 181
{“214”,”╓”} 182
{“215”,”╫”} 183
{“216”,”╪”} 184
{“217”,”┘”} 185
{“218”,”┌”} 186
{“219”,”█”} 187
{“220”,”▄”} 188
{“221”,”▌”} 189
{“222”,”▐”} 190
{“223”,”▀”} 191
{“224”,”α”} 192
{“225”,”β”} 193
{“226”,”Γ”} 194
{“227”,”π”} 195
{“228”,”∑”} 196
{“229”,”σ”} 197
{“230”,”μ”} 198
{“231”,”τ”} 199
{“232”,”Φ”} 200
{“233”,”Θ”} 201
{“234”,”Ω”} 202
{“235”,”δ”} 203
{“236”,”∞”} 204
{“237”,”ф”} 205
{“238”,”ε”} 206
{“239”,”∩”} 207
{“240”,”≡”} 208
{“241”,”±”} 209
{“242”,”≥”} 210
{“243”,”≤”} 211
{“244”,”⌠”} 212
{“245”,”⌡”} 213
{“246”,”÷”} 214
{“247”,”≈”} 215
{“248”,”°”} 216
{“249”,”.”} 217
{“250”,”.”} 218
{“251”,”√”} 219
{“252”,”_”} 220
{“253”,”²”} 221
{“254”,”■”} 222


Description:
( "Xxxx", "Y") = aaa
Xxx = ASCII code beginning
Y = the characters in the code
Aaa = new code because the data migration code 0 - 31 not used
Number of characters = 223 is the same as the p value is 223 (prime and range data)

Sunday, August 2, 2009

The El Gamal Cryptosystem

We have seen that the security of the RSA Cryptosystem is related to the difficulty of
factoring large numbers. It is possible to construct Cryptosystems based on other difficult
number-theoretic problems. We now consider the El Gamal Cryptosystem, named after its
inventor, 'Taher El Gamal', which is based on the difficulty of a problem called the \discrete
logarithm."

Wednesday, July 29, 2009

algorithm ElGamal public key cryptography

P { margin-bottom: 0.08in } -Our lives at this time influenced by cryptography. From transactions in the ATM machine, hold a conversation via telephone, Internet access, until the missile control using cryptography. Once the importance of cryptography for security information (Information Security), so that when talking about security problems associated with the use of computer, so can not be separated from the cryptography.

One of the algorithms used for encryption and discussed in this article are ElGamal algorithm. This algorithm emphasizes the problems mathematics algorithms. Problems with the ElGamal encryption chipertext results will be very difficult in kriptanalis.

The problems raised in this article are:

  1. How to generate random numbers (prime and not prime) to be the key cryptography in the system?
  2. How to publish public key and private key to hide?
  3. How do I calculate a exponent operation that produces an integer that is very large so that can not be saved by any type of data in a resource program (JAVA)?
  4. How do I calculate the modulo operation of an integer is very large?
  5. How do I calculate the inversion modulo operation of an integer is very large?
  6. How to plain text character conversion chiper text or otherwise using the ASCII table, where the maximum number of ASCII characters must be a prime?
Problems in discrite Algorithm El Gamal is: if p is a prime and g and y is any integer. Find x so that g ^ x ≡ y (mod p). Scale used in the El Gamal is:
1. The prime p (not secret)
2. Random number, g (g

Elgamal algorithm algorithm is one of the public-key cryptography is created by Taher ElGamal in 1984. In the algorithm is generally used for digital signatures, but then modified so that it can also be used for encryption and description.

Encryption process is as follows:

  • Encryption
  1. Plainteks organized into blocks of m1, m2, ..., so that each block represents the value in the range 0 to p - 1.
  2. Select a random number k, which in this case 0
  3. Each block is encrypted with the formula m
  4. a = g^k mod p (1)
  5. b = y^km mod p (2)
  6. Pair a and b are cipherteks to block the message m. Thus, the size ciphertext twice its size plainteks.
  • Decryption
  1. For a and b mendekripsi use a secret key, x, and m plainteks be back with the equality
    m = b / a^x mod p (3)
    mathematics from the equation above can be plainteks that can be returned with the pair a and b
Making a System
Here is a flowchart used in Agoritma ElGamal:

The first prime number p randomly resurrected. Numbers p Range data is used as a reference for plainteks and chiper text. Eg reference to the ASCII code 0 - 256 then the p value is 257.
After that raised random value g and x. X is the value of private key can be raised up so the user wishes and do not have to be random. Terms of generation g and the value of x is:




After the countdown y (public key) to call a function to calculate the y value of the shipment paremeter g, x, and p. After we made the key y g, y, p as a public key and private key as x.

After determining the key encryption process is complete then the message begins with a special encryption function call with parameter m post plain text and key - public key.

After the encryption then email is sent to the destination email. Chiper text size 2X plain text. Once the recipient receives the email in the text chiper decryption with the decryption function with parameters that are sent chiper text. The process of decryption will be done by using the private key of the recipient email (x).

Operation in the a and y is the same value pangkatnya just different. In the a, g dipangkatkan with k while the y, g dipangkatkan with x.

Encryption algorithm from the above looks simple. However, there are complex issues that matter for inclusion in the program code. This is because the algorithm ElGamal operation perpangkatan and modulo the number that large. For example eg in the y and a:
If p = 223 g = 13 x = 131 and k = 127



Above problems can be overcome with the addition of the concept of chaining or divide and conquer

Decryption
Decryption formula is as follows:

formula derived above need to be counted as regular as if it will result in a decimal value. In fact the value in the ASCII table is always integer. So 1 / (a^x) will be downgraded to


Results obtained in decryption is the same value of mj mj with a value that is sent before encryption

the sender does not need to know the private key of the goal. Simply use the public key issued by the Email recipient. With the mathematics diskrit Chipper results obtained a text which does not contain any information on if taken by the man in the middle. That can perform decryption of the text Chipper only party that has a private key or know the purpose of email.










Calendar