Documentation
¶
Overview ¶
Package hppk implements the Hierarchical Polynomial Public Key (HPPK) cryptosystem.
HPPK introduces a novel Homomorphic Polynomial Public Key for Key Encapsulation Mechanism (KEM) and Digital Signatures (DS). By exploiting the inherent partial homomorphic properties of the modular multiplicative permutations, HPPK offers a robust symmetric encryption mechanism for asymmetric cryptography, independent of NP-hard problems. The seamless integration of KEM and DS within HPPK results in compact key sizes, cipher sizes, and signature sizes, demonstrating exceptional performance across various cryptographic operations
Index ¶
Constants ¶
const ( ERR_MSG_ORDER = "order must be at least 5" ERR_MSG_NULL_ENCRYPTION = "encrypted values cannot be null" ERR_MSG_DATA_EXCEEDED = "the secret to encrypt is not in the GF(p)" ERR_MSG_INVALID_PUBKEY = "public key is invalid" ERR_MSG_INVALID_KEM = "invalid kem value" ERR_MSG_INVALID_PRIME = "invalid prime number" )
Error messages for various conditions.
const DefaultPrime = "" /* 617-byte string literal not displayed */
DefaultPrime is a large prime number used in cryptographic operations.
Variables ¶
This section is empty.
Functions ¶
func VerifySignature ¶
VerifySignature verifies the signature of the message digest using the public key and default prime
Types ¶
type KEM ¶ added in v1.0.5
KEM represents the Encapsulated Key in the HPPK protocol.
type PrivateKey ¶
type PrivateKey struct { Prime *big.Int // Prime number used for cryptographic operations R1, S1 *big.Int // r1 and s1 are coprimes R2, S2 *big.Int // r2 and s2 are coprimes F0, F1 *big.Int // f(x) = f1x + f0 H0, H1 *big.Int // h(x) = h1x + h0 PublicKey // Embedding PublicKey structure }
PrivateKey represents a private key in the HPPK protocol.
func GenerateKey ¶
func GenerateKey(order int) (*PrivateKey, error)
GenerateKey generates a new HPPK private key with the given order and default prime number.
func (*PrivateKey) Decrypt ¶
func (priv *PrivateKey) Decrypt(kem *KEM) (secret *big.Int, err error)
Decrypt decrypts the encrypted values P and Q using the private key.
func (*PrivateKey) Order ¶ added in v1.0.6
func (priv *PrivateKey) Order() int
Order returns the polynomial order of the private key.
func (*PrivateKey) Public ¶ added in v1.0.4
func (priv *PrivateKey) Public() *PublicKey
Public returns the public key of the private key.
type PublicKey ¶
type PublicKey struct { P []*big.Int // Coefficients of the polynomial P(x) Q []*big.Int // Coefficients of the polynomial Q(x) }
PublicKey represents a public key in the HPPK protocol.
type Signature ¶
type Signature struct { Beta *big.Int // a randomly choosen number from Fp F, H *big.Int // F & H is calculated from the private key S1Verify, S2Verify *big.Int // S1Verify := beta * s1 mod p, S2Verify := beta * s2 mod p U, V []*big.Int // U = ⌊ R*P /S1 ⌋, V = ⌊ R*Q /S2 ⌋ K int // R = 2^K }
Signature represents a digital signature in the HPPK protocol.