Skip to content

Latest commit

 

History

History
157 lines (91 loc) · 3.89 KB

crypt.md

File metadata and controls

157 lines (91 loc) · 3.89 KB

crypt

import "Smilo-blackbox/src/crypt"

keys.go safe.go

func ComputePublicKey(secret []byte) ([]byte, error)

ComputePublicKey will compute a key based on the secret

func ComputeSharedKey(senderKey []byte, publicKey []byte) []byte

ComputeSharedKey compute a shareKey based on two keys

func DecryptPayload(sharedKey []byte, encryptedPayload []byte, nonce []byte) []byte

DecryptPayload will decrypt a payload based on a key and nonce

func EncryptPayload(sharedKey []byte, payload []byte, nonce []byte) []byte

EncryptPayload will encrypt payload based on a key and nonce

func GenerateKeys(generateKeys string) error

GenerateKeys will generate key/pub and save into file

func GetPrivateKey(publicKey []byte) []byte

GetPrivateKey will get the pk for a pub

func GetPublicKeys() [][]byte

GetPublicKeys will get all pubs in memory

func NewRandomKey() ([]byte, error)

NewRandomKey generate new key

func NewRandomNonce() ([]byte, error)

NewRandomNonce generate new nonce

func PutKeyPair(pair KeyPair)

PutKeyPair will put a pair into pairs var

func WritePrivateKeyFile(key string, filepath string) error

WritePrivateKeyFile creates a json file with the private key

func WritePublicKeyFile(key string, filepath string) error

WritePublicKeyFile creates a file with the pubKey

type KeyPair struct {
    PrivateKey []byte
    PublicKey  []byte
}

KeyPair holds PrivateKey and PublicKey


Generated by godoc2md