cpseg

package module
v0.0.0-...-d668e56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2014 License: MIT Imports: 6 Imported by: 0

README

cpseg

Build Status

A pure Go implementation of the CPS-EG public key encryption algorithm.

For documentation, check godoc.

Documentation

Overview

Package cpseg provides an implementation of the CPS-EG public key encryption system, an IND-CCA2 variant of ElGamal described by Seurin and Treger:

In this paper, we propose a very simple modification to Schnorr-Signed
ElGamal encryption such that the resulting scheme is semantically secure
under adaptive chosen-ciphertext attacks (IND-CCA2- secure) in the ROM
under the Decisional Diffie-Hellman assumption. In fact, we even prove
that our new scheme is plaintext-aware in the ROM as defined by Bellare
et al. (CRYPTO ’98).

(https://eprint.iacr.org/2012/649.pdf)

Index

Constants

This section is empty.

Variables

View Source
var ErrDecrypt = errors.New("message authentication failed")

ErrDecrypt is returned by Decrypt when the message cannot be decrypted.

Functions

func Decrypt

func Decrypt(priv *PrivateKey, Y, R, A, s *big.Int) ([]byte, error)

Decrypt decrypts the given message with the given private key. If the message is not decryptable (i.e., it's been modified or isn't a valid ciphertext), it returns nil.

func Encrypt

func Encrypt(rng io.Reader, pub *PublicKey, msg []byte) (Y, R, A, s *big.Int, err error)

Encrypt encrypts the given message with the given public key.

func GenerateKey

func GenerateKey(priv *PrivateKey, rng io.Reader) (err error)

GenerateKey generates a public & private key pair. The Parameters of the PrivateKey must already be valid.

Types

type Parameters

type Parameters struct {
	P, G *big.Int
	Hash func() hash.Hash
}

Parameters represents the domain parameters for a key. These parameters can be shared across many keys.

type PrivateKey

type PrivateKey struct {
	PublicKey
	X *big.Int
}

PrivateKey represents a CPS-EG private key.

type PublicKey

type PublicKey struct {
	Parameters
	H *big.Int
}

PublicKey represents a CPS-EG public key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL