common

package
v0.0.0-...-d0a163d Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CLIENTS_LIST = "clients_list"
View Source
const CLIENT_MESSAGE = "message"
View Source
const CONNECTION_SUCCESSFUL = "connection_successful"
View Source
const ERROR = "error"
View Source
const GET_CLIENTS = "get_clients"
View Source
const LOGIN = "login"
View Source
const LOGIN_SUCCESS = "login_success"
View Source
const NONE = "NONE"
View Source
const SELECT_TARGET = "selectTarget"
View Source
const SERVER_KEY_ACK = "server_key_ack"
View Source
const SERVER_KEY_EXCHANGE = "server_key_exchange"
View Source
const SIGNUP = "signup"
View Source
const SIGNUP_FAILURE = "signupfailure"
View Source
const SIGNUP_SUCCESSFUL = "signupsuccess"
View Source
const TARGET_FAIL = "targetFail"
View Source
const TARGET_NOT_SET = "target_not_set"
View Source
const TARGET_SET = "targetset"

Variables

This section is empty.

Functions

func AsymmetricPrivateKeyDecryption

func AsymmetricPrivateKeyDecryption(privKey_str []byte, cipherText []byte) string

func AsymmetricPublicKeyEncryption

func AsymmetricPublicKeyEncryption(key []byte, message []byte) []byte

func ConvertStringPrivKeyToRsaKey

func ConvertStringPrivKeyToRsaKey(privPEM []byte) (*rsa.PrivateKey, error)

func ConvertStringPubKeyToRsaKey

func ConvertStringPubKeyToRsaKey(pubPEM []byte) (*rsa.PublicKey, error)

func GenerateRandomKey

func GenerateRandomKey() []byte

func GetDecrypted

func GetDecrypted(ciphertext []byte, key *rsa.PrivateKey) []byte

func GetEncrypted

func GetEncrypted(message []byte, key *rsa.PublicKey) []byte

func InitRSA

func InitRSA(pubFilename string, privFilename string) ([]byte, []byte)

func RandomString

func RandomString(n int) string

func SymmetricDecryption

func SymmetricDecryption(key []byte, cipherText []byte) string

func SymmetricEncryption

func SymmetricEncryption(key string, message string) []byte

Types

type Request

type Request struct {
	ReqTag   string `json:"reqtag"`
	Username string `json:"username"`
	Pubkey   []byte `json:"pubkey"`
	Message  []byte `json:"message"`
}

func NewRequest

func NewRequest(reqTag string, username string, pubkey []byte, message []byte) *Request

type Response

type Response struct {
	ResTag   string `json:"restag"`
	Message  []byte `json:"message"`
	Username string `json:"username"`
}

func NewResponse

func NewResponse(resTag string, message []byte, username string) *Response

Jump to

Keyboard shortcuts

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