client

package
v0.0.0-...-36b3fdc Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServerIP string
)

Functions

func BytesToPrivateKey

func BytesToPrivateKey(priv string) *rsa.PrivateKey

BytesToPrivateKey bytes to private key

func BytesToPublicKey

func BytesToPublicKey(pub string) *rsa.PublicKey

BytesToPublicKey bytes to public key

func ConnectServer

func ConnectServer(ip, username string) (*client, error)

ConnectServer is to connect to clients

func CreateKey

func CreateKey() ([]byte, []byte, error)

func DecryptAes

func DecryptAes(chiperText, key, IV []byte) []byte

func DecryptWithPrivateKey

func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) []byte

DecryptWithPrivateKey decrypts data with private key

func EncryptAes

func EncryptAes(plainText []byte, key, IV []byte) []byte

func EncryptWithPublicKey

func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) []byte

EncryptWithPublicKey encrypts data with public key

func GenerateRSAKey

func GenerateRSAKey(myUsername string)

GenerateRSAKey create 2 file, the private and public key

func StartClient

func StartClient(serverIP, username string)

StartClient start the client

Types

type User

type User struct {
	Rsa       string `json:"rsa"`
	B64AesKey string `json:"aeskey"`
	B64AesIV  string `json:"aesiv"`
}

Jump to

Keyboard shortcuts

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