crypto

package
v3.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPEMDecode             = errors.New("PEM decode failed")
	ErrUnsupportedFormat     = errors.New("key is neither in PKCS#1 nor PKCS#8 format")
	ErrUnsupportedPrivateKey = errors.New("unsupported key type, must be RSA, ECDSA or ED25519 private key")
)
View Source
var ErrCipherTextBlockSize = errors.New("ciphertext block size is too short")
View Source
var ErrUnsupportedAlgorithm = errors.New("unsupported signing algorithm")

Functions

func BytesToPrivateKey

func BytesToPrivateKey(b []byte) (crypto.PublicKey, jose.SignatureAlgorithm, error)

func DecryptAES

func DecryptAES(data string, key string) (string, error)

func DecryptBytesAES

func DecryptBytesAES(cipherText []byte, key string) ([]byte, error)

func EncryptAES

func EncryptAES(data string, key string) (string, error)

func EncryptBytesAES

func EncryptBytesAES(plainText []byte, key string) ([]byte, error)

func GetHashAlgorithm

func GetHashAlgorithm(sigAlgorithm jose.SignatureAlgorithm) (hash.Hash, error)

func HashString

func HashString(hash hash.Hash, s string, firstHalf bool) string

func Sign

func Sign(object any, signer jose.Signer) (string, error)

func SignPayload

func SignPayload(payload []byte, signer jose.Signer) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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