hybridencryption

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HybridDecrypt

func HybridDecrypt(ciphertext *HybridCipherText, privateKey *operation.Scalar) (msg []byte, err error)

hybridDecrypt_Old receives a ciphertext and privateKey it decrypts aesKeyPoint, using ElGamal encryption with privateKey Using X-coordinate of aesKeyPoint to decrypts message

Types

type HybridCipherText

type HybridCipherText struct {
	// contains filtered or unexported fields
}

hybridCipherText_Old represents to hybridCipherText_Old for Hybrid encryption Hybrid encryption uses AES scheme to encrypt message with arbitrary size and uses Elgamal encryption to encrypt AES key

func HybridEncrypt

func HybridEncrypt(msg []byte, publicKey *operation.Point) (ciphertext *HybridCipherText, err error)

hybridEncrypt_Old encrypts message with any size, using Publickey to encrypt hybridEncrypt_Old generates AES key by randomize an elliptic point aesKeyPoint and get X-coordinate using AES key to encrypt message After that, using ElGamal encryption encrypt aesKeyPoint using publicKey

func (HybridCipherText) Bytes

func (ciphertext HybridCipherText) Bytes() []byte

Bytes converts ciphertext to bytes array if ciphertext is nil, return empty byte array

func (HybridCipherText) GetMsgEncrypted

func (ciphertext HybridCipherText) GetMsgEncrypted() []byte

func (HybridCipherText) GetSymKeyEncrypted

func (ciphertext HybridCipherText) GetSymKeyEncrypted() []byte

func (HybridCipherText) IsNil

func (ciphertext HybridCipherText) IsNil() bool

isNil check whether ciphertext is nil or not

func (HybridCipherText) MarshalJSON

func (hybridCipherText HybridCipherText) MarshalJSON() ([]byte, error)

func (*HybridCipherText) SetBytes

func (ciphertext *HybridCipherText) SetBytes(bytes []byte) error

SetBytes reverts bytes array to hybridCipherText_Old

func (*HybridCipherText) UnmarshalJSON

func (hybridCipherText *HybridCipherText) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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