crypto

package
Version: v0.0.0-...-c4b491b Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: GPL-3.0, GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key")
	ErrNotRSAPrivateKey    = errors.New("Key is not a valid RSA private key")
	ErrNotRSAPublicKey     = errors.New("Key is not a valid RSA public key")
)

Functions

func CreateKeyPair

func CreateKeyPair(bitsSizeOfKey int) (asserts.PrivateKey, *rsa.PrivateKey)

func ExportRsaPrivateKeyAsPemStr

func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string

func ExportRsaPublicKeyAsPemStr

func ExportRsaPublicKeyAsPemStr(pubkey *rsa.PublicKey) (string, error)

func GetPrivateKeyFromPEMFile

func GetPrivateKeyFromPEMFile(keyPath string) asserts.PrivateKey

func GetPublicKeyPEM

func GetPublicKeyPEM(key *rsa.PrivateKey) (string, error)

func ParseRSAPrivateKeyFromPEM

func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)

from: "github.com/dgrijalva/jwt-go" Parse PEM encoded PKCS1 or PKCS8 private key

Types

type Key

type Key struct {
	Name     string `json:"name"`
	Sha3_384 string `json:"sha3-384"`
}

Key represents a key that can be used for signing assertions.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL