Questions tagged [elgamal]
68 questions
2
votes
1 answer
Unidirectional ElGamal Proxy Re-Encryption implementation
I've implemented an ElGamal scheme in JavaScript (the code is awful, just wanted to test it quick) based on this explanation.
var forge = require('node-forge');
var bigInt = require("big-integer");
var bits =…

mcansado
- 2,026
- 4
- 25
- 39
2
votes
0 answers
basic example of elgamal algorithm in python 2.7
I'm trying to implement a basic example of El Gamal in python 2.7. There's some bug in the decryption which I'm unable to solve.
It's the decryption step should be: e^-d * c mod p
Any help appreciated.
from __future__ import division
from random…

Martin
- 91
- 1
- 11
2
votes
2 answers
BigInteger subtraction in JavaCard
I am attempting a proof of concept under very constrained technological conditions. My question is: how to efficiently subtract big integers (represented as byte arrays) in a Java Card?.
Now, the details are what make the task tricky. I have access…

Sergio A. Figueroa
- 236
- 1
- 6
2
votes
0 answers
implication of lacking ind-cca security
I was wondering if somebody could tell me what the impication is of an encryption scheme lacking ind-cca or ind-cpa security. For example, the ElGamal scheme is known to lack ind-cca security. The Helios voting protocol uses ElGamal to encrypt…

user3081456
- 21
- 1
1
vote
0 answers
El Gamal with Elliptic Curve in Java
For academical purposes, I am looking for a possibility to implement ElGamal with Elliptic Curves (for encryption and decryption) in Java. I would like to know if this is possible by using only the Java standard library or is this only possible by…

aslanj
- 71
- 6
1
vote
1 answer
Overflow Error w/ Python Implementation of El Gamal Encryption-Decryption with PyCrypto
I am currently using the PyCrypto library in order to implement ElGamal encryption for an academic assignment and I am getting the following error:
OverflowError: cannot fit 'int' into an index-sized integer
from Crypto import Random
from…

marifkind
- 115
- 11
1
vote
0 answers
How to generate primitive root modulo n using OpenSSL?
I need to generate primitive root modulo n for ElGamal cryptosystem, where n - is big prime number. How can I generate it using OpenSSL?
Is there special function like primitive_root(...)? I didn't found enything like this.

Nabla
- 151
- 2
- 8
1
vote
1 answer
how ensure a public key sender/owner has its private key too?
when we want to encrypt a message by a public key, how we can ensure the public key owner has its private key too?
the rules are:
we do not want to have any information about private key that makes a security issue.
2.the verifying have to be done…

abgr
- 63
- 9
1
vote
0 answers
Using sagemath pollard rho function
i'm trying to use sagemath to solve a cryptographic problem. All i have right now is this code:
︠# coding: utf-8
# A big prime:
p = power(2,256) - power(2,224) + power(2,192) + power(2,96) - 1
F = GF(p)
#Elliptic curve in normal form: y^2 =…
1
vote
1 answer
Converting ElGamal encryption from encrypting numbers to strings
I've have the following ElGamal encryption scheme
const forge = require('node-forge');
const bigInt = require("big-integer");
// Generates private and public keys
function keyPairGeneration(p, q, g) {
var secretKey = bigInt.randBetween(2,…

mcansado
- 2,026
- 4
- 25
- 39
1
vote
1 answer
Convert plaintext to perform elgamal encryption
Hi i'm writing a program in java to test a variant of the elgamal encryption, however my problem is not the encryption/decryption chain itself, but how to perform the operations on the input given: a text file. I have a text file with some words in…

bisrac123
- 15
- 4
1
vote
4 answers
Why doesn't my implementation of ElGamal work for long text strings?
I'm playing with the El Gamal cryptosystem, and my goal is to be able to encipher and decipher long sequences of text.
El Gamal requires the plaintext to be an integer. I have turned my string into a byte[] using the .getBytes() method for…

angstrom91
- 178
- 1
- 8
1
vote
1 answer
how to represent message as an integer between 1 and n-1?
I am trying to implement simple El-Gamal cryptosystem.
And I can't understand how to represent message as an integer between 1 and n-1.
The only thing that comes to my mind is:
if n bit length is k, then divide input message m on t | t < k bits and…

baira
- 59
- 2
- 11
1
vote
3 answers
ElGamal signature verification
I try to implement ElGamal signature, but have a trouble with verification. According to wikipedia, signature (r,s) of message m is correct if:
There is a well-known algorithm for calculating ModPow, which is used on signing step:
But I can't find…

Celestis
- 525
- 1
- 4
- 11
1
vote
1 answer
elgamal decryption in javascript
i need a way to calculate:
m = a. b ^(p-1-x) mod p
in javascript.
i have found this algorithm for calculating base^exp%mod:
function expmod(base, exp, mod){
if (exp == 0) return 1;
if (exp % 2 == 0){
return Math.pow((this.expmod(base, (exp /…

user3543541
- 13
- 4