security

package module
v0.0.0-...-b2e2ae2 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: GPL-3.0 Imports: 21 Imported by: 9

README

security

A Simple Encryption and Descyption utils for Habitat including a simple secure storage.

Example of Secure Storage adding

secureStore := InitSecureStore("./storage.dat")
secureStore.Put("mykey1","my")
secureStore.Put("mykey2", "secure")
secureStore.Put("mykey3", "storage")
secureStore.Put("mykey4","simple")

Example of Secure Storage Getting

secureStore := InitSecureStore("./storage.dat")
value, err := secureStore.Get("mykey3")
if err!=nil {
  fmt.Println("Error, Failed to fetch key")
  return
}
fmt.Println("value="+value)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCA

func CreateCA(filenamePrefix, org, country, county, city, street, zipcode, email string, years int) (*x509.Certificate, *rsa.PrivateKey, error)

func CreateCrt

func CreateCrt(filenamePrefix, org, country, county, city, street, zipcode, email, ip, secret string, port int64, years int, ca *x509.Certificate, caKey *rsa.PrivateKey) error

func Decode

func Decode(encData []byte, key string) ([]byte, error)

func Encode

func Encode(data []byte, key string) ([]byte, error)

func FileHash

func FileHash(filename string) (string, error)

func GenerateAES256Key

func GenerateAES256Key() string

func Hash256

func Hash256(data []byte) string

func InitSecureStore

func InitSecureStore(filename string) *storage

Types

This section is empty.

Jump to

Keyboard shortcuts

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