Versions in this module Expand all Collapse all v2 v2.3.3 Oct 19, 2023 Changes in this version + var ErrInvalidCiphertext = errors.New("paillier: invalid ciphertext") + var ErrInvalidMismatch = errors.New("paillier: key mismatch") + var ErrInvalidPlaintext = errors.New("paillier: invalid plaintext") + var ErrInvalidPrivateKey = errors.New("paillier: invalid private key") + var ErrInvalidPublicKey = errors.New("paillier: invalid public key") + var ErrMessageTooLong = errors.New("paillier: message too long for Paillier public key size") + func AdjustDecryptedDomain(pk *PubKey, plaintext *big.Int) (*big.Int, error) + func AdjustPlaintextDomain(pk *PubKey, plaintext *big.Int) (*big.Int, error) + func EncryptAndNonce(pubKey *PubKey, plainText *big.Int) (*big.Int, *big.Int, error) + func EncryptWithNonce(pubKey *PubKey, r *big.Int, pt *big.Int) (*big.Int, error) + func GetCiphertextFromHex(content string) (string, error) + func GetCiphertextHex(cipher string) (string, error) + func GetPrivateKeyHex(sk *PrvKey) string + func GetPublicKeyHex(pk *PubKey) string + func ReadCiphertextFromFile(file string) (string, error) + func WriteCiphertextToFile(cipher string, file string) error + func WriteEncryptedPrivateKeyToFile(sk *PrvKey, file, password string) error + func WritePrivateKeyToFile(sk *PrvKey, file string) error + func WritePublicKeyToFile(pk *PubKey, file string) error + type Ciphertext struct + Checksum []byte + Ct *big.Int + func Neg(pk *PubKey, cipher *Ciphertext) (*Ciphertext, error) + func (ct *Ciphertext) GetChecksum() ([]byte, error) + func (ct *Ciphertext) GetCtBytes() ([]byte, error) + func (ct *Ciphertext) GetCtStr() (string, error) + func (ct *Ciphertext) Marshal() ([]byte, error) + func (ct *Ciphertext) Unmarshal(ctBytes []byte) error + type PrvKey struct + func GenKey() (*PrvKey, error) + func GetPrivateKeyFromHex(content string) (*PrvKey, error) + func ReadEncryptedPrivateKeyFromFile(file, password string) (*PrvKey, error) + func ReadPrivateKeyFromFile(file string) (*PrvKey, error) + func (key *PrvKey) Decrypt(cipherText *Ciphertext) (*big.Int, error) + func (key *PrvKey) GetPubKey() (*PubKey, error) + func (key *PrvKey) Marshal() ([]byte, error) + func (key *PrvKey) Unmarshal(prvKeyBytes []byte) error + type PubKey struct + G *big.Int + N *big.Int + NSquared *big.Int + func GetPublicKeyFromHex(content string) (*PubKey, error) + func ReadPublicKeyFromFile(file string) (*PubKey, error) + func (key *PubKey) AddCiphertext(cipher1, cipher2 *Ciphertext) (*Ciphertext, error) + func (key *PubKey) AddPlaintext(cipher *Ciphertext, constant *big.Int) (*Ciphertext, error) + func (key *PubKey) ChecksumVerify(ct *Ciphertext) bool + func (key *PubKey) Encrypt(plainText *big.Int) (*Ciphertext, error) + func (key *PubKey) Marshal() ([]byte, error) + func (key *PubKey) NumMul(cipher *Ciphertext, constant *big.Int) (*Ciphertext, error) + func (key *PubKey) SubByConstant(pubKey *PubKey, cipher *Ciphertext, constant *big.Int) (*Ciphertext, error) + func (key *PubKey) SubCiphertext(cipher1, cipher2 *Ciphertext) (*Ciphertext, error) + func (key *PubKey) SubPlaintext(cipher *Ciphertext, constant *big.Int) (*Ciphertext, error) + func (key *PubKey) Unmarshal(pubKeyBytes []byte) error