encryption

package
v1.18.0-RC16 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Methods and types for encryption operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshallPublicKey

func UnmarshallPublicKey(publicKey string) (kyber.Point, error)

Types

type EncryptedMessage

type EncryptedMessage struct {
	EncryptedKey    string
	EncryptedData   []byte
	ReEncryptionKey string
	MessageChecksum string
	OverallChecksum string
}

EncryptedMessage encrypted message structure

type EncryptionScheme

type EncryptionScheme interface {
	Initialize(mnemonic string) ([]byte, error)
	InitializeWithPrivateKey(privateKey []byte) error
	InitForEncryption(tag string)
	InitForEncryptionWithPoint(tag, point string) error
	InitForDecryption(tag string, encryptedKey string) error
	InitForDecryptionWithPoint(tag, point string) error
	Encrypt(data []byte) (*EncryptedMessage, error)
	Decrypt(*EncryptedMessage) ([]byte, error)
	ReDecrypt(D *ReEncryptedMessage) ([]byte, error)
	GetEncryptedKey() string
	GetReGenKey(encPublicKey string, tag string) (string, error)
	ReEncrypt(encMsg *EncryptedMessage, reGenKey string, clientPublicKey string) (*ReEncryptedMessage, error)
	GetPublicKey() (string, error)
	GetPrivateKey() (string, error)
	GetEncryptedKeyPoint() string
}

EncryptionScheme interface for encryption schemes

func NewEncryptionScheme

func NewEncryptionScheme() EncryptionScheme

NewEncryptionScheme create a new encryption scheme

type PREEncryptedMessage

type PREEncryptedMessage struct {
	EncryptedKey    kyber.Point `json:"-"`
	EncryptedData   []byte
	MessageChecksum []byte
	OverallChecksum []byte
	TagA            []byte
}

func (*PREEncryptedMessage) MarshalJSON

func (u *PREEncryptedMessage) MarshalJSON() ([]byte, error)

type PREEncryptionScheme

type PREEncryptionScheme struct {
	PublicKey    kyber.Point
	PrivateKey   kyber.Scalar
	SuiteObj     Suite
	Tag          []byte
	T            kyber.Point
	Ht           kyber.Point
	EncryptedKey kyber.Point
}

func (*PREEncryptionScheme) Decrypt

func (pre *PREEncryptionScheme) Decrypt(encMsg *EncryptedMessage) ([]byte, error)

func (*PREEncryptionScheme) Encrypt

func (pre *PREEncryptionScheme) Encrypt(data []byte) (*EncryptedMessage, error)

func (*PREEncryptionScheme) GetEncryptedKey

func (pre *PREEncryptionScheme) GetEncryptedKey() string

func (*PREEncryptionScheme) GetEncryptedKeyPoint added in v1.10.0

func (pre *PREEncryptionScheme) GetEncryptedKeyPoint() string

func (*PREEncryptionScheme) GetPrivateKey

func (pre *PREEncryptionScheme) GetPrivateKey() (string, error)

func (*PREEncryptionScheme) GetPublicKey

func (pre *PREEncryptionScheme) GetPublicKey() (string, error)

func (*PREEncryptionScheme) GetReGenKey

func (pre *PREEncryptionScheme) GetReGenKey(encPublicKey string, tag string) (string, error)

func (*PREEncryptionScheme) InitForDecryption

func (pre *PREEncryptionScheme) InitForDecryption(tag string, encryptedKey string) error

func (*PREEncryptionScheme) InitForDecryptionWithPoint added in v1.10.0

func (pre *PREEncryptionScheme) InitForDecryptionWithPoint(tag, point string) error

func (*PREEncryptionScheme) InitForEncryption

func (pre *PREEncryptionScheme) InitForEncryption(tag string)

func (*PREEncryptionScheme) InitForEncryptionWithPoint added in v1.10.0

func (pre *PREEncryptionScheme) InitForEncryptionWithPoint(tag, point string) error

func (*PREEncryptionScheme) Initialize

func (pre *PREEncryptionScheme) Initialize(mnemonic string) ([]byte, error)

func (*PREEncryptionScheme) InitializeWithPrivateKey added in v1.2.88

func (pre *PREEncryptionScheme) InitializeWithPrivateKey(privateKey []byte) error

InitializeWithPrivateKey initialize with private key

func (*PREEncryptionScheme) ReDecrypt

func (pre *PREEncryptionScheme) ReDecrypt(D *ReEncryptedMessage) ([]byte, error)

-----------------------------------------------ReDecryption-------------------------------------------------

func (*PREEncryptionScheme) ReEncrypt

func (pre *PREEncryptionScheme) ReEncrypt(encMsg *EncryptedMessage, reGenKey string, clientPublicKey string) (*ReEncryptedMessage, error)

func (*PREEncryptionScheme) SymDec

func (pre *PREEncryptionScheme) SymDec(group kyber.Group, ctx []byte, keyhash []byte) ([]byte, error)

---------------------------------Symmetric Decryption using AES with GCM mode---------------------------------

func (*PREEncryptionScheme) SymEnc

func (pre *PREEncryptionScheme) SymEnc(group kyber.Group, message []byte, keyhash []byte) ([]byte, error)

---------------------------------Symmetric Encryption using AES with GCM mode---------------------------------

type ReEncryptedMessage

type ReEncryptedMessage struct {
	D1 kyber.Point
	D2 []byte
	D3 []byte
	D4 kyber.Point
	D5 kyber.Point
}

func (*ReEncryptedMessage) Marshal

func (reEncMsg *ReEncryptedMessage) Marshal() ([]byte, error)

func (*ReEncryptedMessage) Unmarshal

func (reEncMsg *ReEncryptedMessage) Unmarshal(data []byte) error

type ReKey

type ReKey struct {
	R1 kyber.Point
	R2 kyber.Point
	R3 kyber.Scalar
}

func (*ReKey) MarshalJSON

func (u *ReKey) MarshalJSON() ([]byte, error)

func (*ReKey) UnmarshalJSON

func (u *ReKey) UnmarshalJSON(data []byte) error

type ReKeyBytes

type ReKeyBytes struct {
	R1Bytes []byte `json:"r1"`
	R2Bytes []byte `json:"r2"`
	R3Bytes []byte `json:"r3"`
}

type Suite

type Suite interface {
	kyber.Group
	kyber.Random
}

Suite represents the set of functionalities needed by the package schnorr.

Jump to

Keyboard shortcuts

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