auth

package
v0.0.0-...-692b37b Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KTyNames maps key types to string representations
	KTyNames = map[KTy]string{
		KTyUnknown: "UNKNOWN",
		KTyECDSA:   "ECDSA",
		KTyHMAC:    "HMAC",
		KTyRSA:     "RSA",
		KTyRSAPSS:  "RSAPSS",
		KTyEd25519: "ED25519",
	}
	// KTyValues maps key type names to values
	KTyValues = map[string]KTy{
		"UNKNOWN": KTyUnknown,
		"ECDSA":   KTyECDSA,
		"HMAC":    KTyHMAC,
		"RSA":     KTyRSA,
		"RSAPSS":  KTyRSAPSS,
		"ED25519": KTyEd25519,
	}
)
View Source
var (
	// AlgNames maps algorithms to a string representation.
	AlgNames = map[Alg]string{
		AlgUnknown: "UNKNOWN",
		AlgSHA256:  "SHA256",
		AlgSHA384:  "SHA384",
		AlgSHA512:  "SHA512",
	}
	// AlgValues maps algorithm names to values.
	AlgValues = map[string]Alg{
		"UNKNOWN": AlgUnknown,
		"SHA256":  AlgSHA256,
		"SHA384":  AlgSHA384,
		"SHA512":  AlgSHA512,
	}
)

KeyAlgorithms maps a key type to a map of available hashing algorithms.

Functions

func GetSigningAlgorithm

func GetSigningAlgorithm(kty KTy, alg Alg) (algorithms.SigningAlgorithm, error)

GetSigningAlogrithm returns the signing algorithm for the given key type and hashing algorithm.

Types

type Alg

type Alg int

Alg represents a hashing algorithm.

const (
	// Hasing algorithms
	AlgUnknown Alg = 0
	AlgSHA256  Alg = 1
	AlgSHA384  Alg = 2
	AlgSHA512  Alg = 3
)

func ToAlg

func ToAlg(s string) Alg

ToAlg returns the hashing algorithm for the given string.

func (Alg) String

func (alg Alg) String() string

String returns the string representation of the given hashing algorithm.

type KTy

type KTy int

KTy represents a cryptographic key type.

const (
	// Key types
	KTyUnknown KTy = 0
	KTyECDSA   KTy = 1
	KTyHMAC    KTy = 2
	KTyRSA     KTy = 3
	KTyRSAPSS  KTy = 4
	KTyEd25519 KTy = 5
)

func ToKTy

func ToKTy(s string) KTy

ToKTy returns the key type for the given string.

func (KTy) String

func (kty KTy) String() string

String returns the string representation of the given key type.

Jump to

Keyboard shortcuts

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