Documentation ¶
Overview ¶
Package crypto contents type and methods for encryption/decryption
Index ¶
- Constants
- func CheckToken(tkn string, key []byte) (string, error)
- func DecryptKey(symm []byte, data string) ([]byte, error)
- func EncryptKey(symmKey []byte, data []byte) (string, error)
- func GenServerKey(n int) (string, error)
- func GenSymmKey(n int) ([]byte, error)
- func GenX509KeyPair() (tls.Certificate, error)
- func GetToken(_ context.Context, login string, passwd string, userData types.StorageModel, ...) (string, error)
- func HashPasswd(_ context.Context, passwd []byte) (string, error)
Constants ¶
View Source
const (
SymmKeyLength = 24 // length of user symmetric key
)
Variables ¶
This section is empty.
Functions ¶
func CheckToken ¶
CheckToken checks jwt token is provided by cli
func DecryptKey ¶
DecryptKey decrypt data with symmKey
func EncryptKey ¶
EncryptKey encrypt data with symmKey
func GenServerKey ¶
GenServerKey generates master server key when it isn't provided
func GenSymmKey ¶
GenKey return symmetric key for user when signup and for server
func GenX509KeyPair ¶
func GenX509KeyPair() (tls.Certificate, error)
GenX509KeyPair generates the TLS keypair for the server https://gist.github.com/shivakar/cd52b5594d4912fbeb46
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.