crypto

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCerts = errors.New("no certificates found")

Functions

func GeneratePrivateKey

func GeneratePrivateKey(keyType KeyType) (crypto.Signer, error)

func LoadCertificates

func LoadCertificates(filepath string) (certs *x509.CertPool, err error)

func LoadPrivateKey

func LoadPrivateKey(pkeyPEM []byte) (crypto.Signer, error)

func SavePrivateKey

func SavePrivateKey(pkey crypto.Signer, path string) error

Types

type ED25519Signer

type ED25519Signer ed25519.PrivateKey

func (ED25519Signer) Public

func (p ED25519Signer) Public() crypto.PublicKey

func (ED25519Signer) Sign

func (p ED25519Signer) Sign(rand io.Reader, message []byte, _ crypto.SignerOpts) ([]byte, error)

type KeyType

type KeyType string
const (
	KeyTypeRSA2048   KeyType = "rsa2048"
	KeyTypeRSA3072   KeyType = "rsa3072"
	KeyTypeRSA4096   KeyType = "rsa4096"
	KeyTypeSECP256R1 KeyType = "secp256r1"
	KeyTypeSECP384R1 KeyType = "secp384r1"
	KeyTypeSECP521R1 KeyType = "secp521r1"
	KeyTypeED25519   KeyType = "ed25519"
)

func ParseKeyType

func ParseKeyType(s string) (KeyType, error)

Jump to

Keyboard shortcuts

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