Open eozturk1 opened 3 years ago
I have been trying to use the library but I get the error in the title. Here is the code I am using:
p, q, err := paillier.GenerateSafePrime( 1024, 4, 10000000000, rand.Reader, ) if err != nil { panic("DidierCrunchPaillier GenerateSafePrime error: " + err.Error()) } privateKey := paillier.CreatePrivateKey(p, q) toEncrypt := big.NewInt(19) cipher, err := privateKey.Encrypt(toEncrypt, rand.Reader) if err != nil { panic("DidierCrunchPaillier Encrypt error: " + err.Error()) } plain := privateKey.Decrypt(cipher) fmt.Println("Plaintext: " + plain.String())
The issue is with the decryption function. Here is the trace:
panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x1033a3c] goroutine 1 [running]: math/big.(*Int).Mul(0xc00005fde8, 0xc00006c7c0, 0x0, 0x0) C:/Program Files/Go/src/math/big/int.go:168 +0x1dc github.com/didiercrunch/paillier.(*PrivateKey).Decrypt(0xc000104300, 0xc000148028, 0x0) C:/Users/eoztu/go/pkg/mod/github.com/didiercrunch/paillier@v0.0.0-20180810105046-753322e473bf/paillier.go:121 +0x1f9 ...
When I use small primes as in tests (e.g., 13, 17), enc/dec both works but not with generated primes. Am I using the API wrong?
same issue
I have been trying to use the library but I get the error in the title. Here is the code I am using:
The issue is with the decryption function. Here is the trace:
When I use small primes as in tests (e.g., 13, 17), enc/dec both works but not with generated primes. Am I using the API wrong?