baseutils

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignNextTime added in v1.0.8

func AlignNextTime(base time.Time, interval time.Duration, offset time.Duration) time.Time

func Base64Decode added in v1.0.6

func Base64Decode(enc *base64.Encoding, data []byte) ([]byte, error)

func Base64Encode added in v1.0.6

func Base64Encode(enc *base64.Encoding, data []byte) []byte

func GenerateRsaKey added in v1.0.6

func GenerateRsaKey(bits int) (publicKey, privateKey []byte, err error)

func HashData added in v1.0.6

func HashData(hash crypto.Hash, datas ...[]byte) ([]byte, error)

func HashDataSilently added in v1.0.6

func HashDataSilently(hash crypto.Hash, datas ...[]byte) []byte

func NewHash added in v1.0.6

func NewHash(hash crypto.Hash) (hash.Hash, error)

func ParseNetloc added in v1.0.11

func ParseNetloc(loc string, defaultAddr string, defaultPort int) (addr string, port int, err error)

func Pkcs5Padding added in v1.0.6

func Pkcs5Padding(data []byte, blockSize int) []byte

func Pkcs5Unpadding added in v1.0.6

func Pkcs5Unpadding(data []byte) []byte

Types

type AesCipher added in v1.0.6

type AesCipher struct {
	// contains filtered or unexported fields
}

func NewAesCipher added in v1.0.6

func NewAesCipher(key []byte, bits int) (*AesCipher, error)

func (*AesCipher) Decrypt added in v1.0.6

func (a *AesCipher) Decrypt(cipherdata []byte, b64 bool) ([]byte, error)

func (*AesCipher) Encrypt added in v1.0.6

func (a *AesCipher) Encrypt(plaintext []byte, b64 bool) ([]byte, error)

type CookieNotFoundError

type CookieNotFoundError struct {
	// contains filtered or unexported fields
}

func NewCookieNotFoundError

func NewCookieNotFoundError(name string) CookieNotFoundError

func (CookieNotFoundError) Error

func (e CookieNotFoundError) Error() string

func (CookieNotFoundError) Name

func (e CookieNotFoundError) Name() string

type EnvironmentVariableNotFoundError

type EnvironmentVariableNotFoundError struct {
	// contains filtered or unexported fields
}

func NewEnvironmentVariableNotFoundError

func NewEnvironmentVariableNotFoundError(name string) EnvironmentVariableNotFoundError

func (EnvironmentVariableNotFoundError) Error

func (EnvironmentVariableNotFoundError) Name

type Errors added in v1.0.8

type Errors []error

func (Errors) Empty added in v1.0.8

func (errors Errors) Empty() bool

func (Errors) Error added in v1.0.8

func (errors Errors) Error() string

func (Errors) Len added in v1.0.8

func (errors Errors) Len() int

func (Errors) PurgeZero added in v1.0.8

func (errors Errors) PurgeZero() Errors

type NotImplementedError

type NotImplementedError struct {
	// contains filtered or unexported fields
}

func NewNotImplementedError

func NewNotImplementedError(hint string) NotImplementedError

func (NotImplementedError) Error

func (e NotImplementedError) Error() string

type PrivateKeyCipher added in v1.0.6

type PrivateKeyCipher struct {
	PublicKeyCipher
	// contains filtered or unexported fields
}

func NewPrivateKeyCipher added in v1.0.6

func NewPrivateKeyCipher(key *rsa.PrivateKey) *PrivateKeyCipher

func (*PrivateKeyCipher) Decrypt added in v1.0.6

func (c *PrivateKeyCipher) Decrypt(ciphertext []byte) ([]byte, error)

func (*PrivateKeyCipher) DecryptPro added in v1.0.6

func (c *PrivateKeyCipher) DecryptPro(ciphertext []byte, decrypter RsaDecrypter, random io.Reader) ([]byte, error)

func (*PrivateKeyCipher) Sign added in v1.0.6

func (c *PrivateKeyCipher) Sign(data []byte) ([]byte, error)

func (*PrivateKeyCipher) SignPro added in v1.0.6

func (c *PrivateKeyCipher) SignPro(data []byte, signer RsaSigner, random io.Reader, hash crypto.Hash) ([]byte, error)

type PublicKeyCipher added in v1.0.6

type PublicKeyCipher struct {
	// contains filtered or unexported fields
}

func NewPublicKeyCipher added in v1.0.6

func NewPublicKeyCipher(key *rsa.PublicKey) *PublicKeyCipher

func (*PublicKeyCipher) Encrypt added in v1.0.6

func (c *PublicKeyCipher) Encrypt(plaintext []byte) ([]byte, error)

func (*PublicKeyCipher) EncryptPro added in v1.0.6

func (c *PublicKeyCipher) EncryptPro(plaintext []byte, encrypter RsaEncrypter, random io.Reader) ([]byte, error)

func (*PublicKeyCipher) Verify added in v1.0.6

func (c *PublicKeyCipher) Verify(data, sign []byte) error

func (*PublicKeyCipher) VerifyPro added in v1.0.6

func (c *PublicKeyCipher) VerifyPro(data, sign []byte, verifier RsaVerifier, hash crypto.Hash) error

type RsaDecrypter added in v1.0.6

type RsaDecrypter = func(io.Reader, *rsa.PrivateKey, []byte) ([]byte, error)

type RsaEncrypter added in v1.0.6

type RsaEncrypter = func(io.Reader, *rsa.PublicKey, []byte) ([]byte, error)

type RsaSigner added in v1.0.6

type RsaSigner = func(io.Reader, *rsa.PrivateKey, crypto.Hash, []byte) ([]byte, error)

type RsaVerifier added in v1.0.6

type RsaVerifier = func(*rsa.PublicKey, crypto.Hash, []byte, []byte) error

Jump to

Keyboard shortcuts

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