Documentation
¶
Overview ¶
Package dppk implements the Deterministic Polynomial Public Key (DPPK) algorithm.
The ancient Vieta’s formulas reveal the relationships between coefficients of an nth-degree polynomial and its roots. It is surprisingly found that there exists a hidden secret for a potential public key exchange: decoupling the product of all roots or constant term from summations of root products or coefficients of a polynomial to establish a keypair. The proposed deterministic polynomial public key algorithm or DPPK is built on the fact that a polynomial cannot be factorized without its constant term.
DPPK allows the keypair generator to combine a base polynomial, eliminable during the decryption, with two solvable polynomials and creates two entangled polynomials. Two coefficient vectors of the entangled polynomials form a public key, and their constant terms, together with the two solvable polynomials, form the private key. By only publishing coefficients of polynomials without their constant terms, we greatly restrict polynomial factoring techniques for the private key extraction.
Index ¶
Constants ¶
const ( ERR_MSG_ORDER = "order must be at least 5" ERR_MSG_NULL_ENCRYPT = "encrypted values cannot be null" ERR_MSG_DATA_EXCEEDED = "the secret to encrypt is not in the GF(p)" ERR_MSG_VU_PUBLICKEY = "VU in public key is not equal" )
const DefaultPrime = "" /* 515-byte string literal not displayed */
DefaultPrime is the default prime number used in the DPPK protocol.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PrivateKey ¶
type PrivateKey struct {
S0 *big.Int // Initial secret value
A0, A1, B0, B1 *big.Int // Coefficients for the polynomials
PublicKey
}
PrivateKey represents a private key in the DPPK protocol.
func GenerateKey ¶
func GenerateKey(order int) (*PrivateKey, error)
GenerateKey generates a new DPPK private key with the given order and default prime number
func GenerateKeyWithPrime ¶ added in v1.0.3
func GenerateKeyWithPrime(order int, strPrime string) (*PrivateKey, error)
GenerateKey generates a new DPPK private key with the given order and prime number the prime number is a string formatted in base 10
func (*PrivateKey) Decrypt ¶
func (priv *PrivateKey) Decrypt(kem *KEM) (x1, x2 *big.Int, err error)
Decrypt decrypts the encrypted values Ps and Qs using the private key.
func (*PrivateKey) DecryptMessage ¶ added in v1.1.0
func (priv *PrivateKey) DecryptMessage(kem *KEM) ([]byte, error)
DecryptMessage returns the plaintext message embedded in the ciphertext. It tries both candidate roots and returns the first one that matches the expected secret encoding marker.
func (*PrivateKey) Public ¶ added in v1.0.6
func (priv *PrivateKey) Public() *PublicKey
Public returns the public key of the private key.
type PublicKey ¶
type PublicKey struct {
Prime *big.Int
VectorU []*big.Int // Coefficients for polynomial U
VectorV []*big.Int // Coefficients for polynomial V
}
PublicKey represents a public key in the DPPK protocol.