Documentation ¶
Index ¶
- Constants
- func ComparePasswordHash(hashedPassword, givenPassword []byte) bool
- func Decrypt(encryptedValue, secretKey []byte) ([]byte, error)
- func Encrypt(value, secretKey []byte) ([]byte, error)
- func ExportRsaPrivateKeyAsPem(key *rsa.PrivateKey, w io.Writer) error
- func ExportRsaPublicKeyAsPem(key *rsa.PrivateKey, w io.Writer) error
- func GeneratePasswordHash(password []byte) ([]byte, error)
- func GenerateRsaKey() (*rsa.PrivateKey, error)
- func GenerateSecretKey() string
- func ParseRsaPrivateKeyFromPemStr(key string) (*rsa.PrivateKey, error)
- func ParseRsaPublicKeyFromPemStr(key string) (*rsa.PublicKey, error)
Constants ¶
View Source
const SecretKeyLength = 32
Variables ¶
This section is empty.
Functions ¶
func ComparePasswordHash ¶
func ExportRsaPrivateKeyAsPem ¶
func ExportRsaPrivateKeyAsPem(key *rsa.PrivateKey, w io.Writer) error
func ExportRsaPublicKeyAsPem ¶
func ExportRsaPublicKeyAsPem(key *rsa.PrivateKey, w io.Writer) error
func GeneratePasswordHash ¶
func GenerateRsaKey ¶
func GenerateRsaKey() (*rsa.PrivateKey, error)
func GenerateSecretKey ¶
func GenerateSecretKey() string
From https://stackoverflow.com/a/31832326 This is NOT goroutine safe, if it ever needs to be, change src to the default rand source.
func ParseRsaPrivateKeyFromPemStr ¶
func ParseRsaPrivateKeyFromPemStr(key string) (*rsa.PrivateKey, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.