modules

package
v0.0.0-...-e6c3ac7 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessAuth

func AccessAuth(c *gin.Context) (string, error)

func AccessAuth_Detached

func AccessAuth_Detached(key_id string) (string, error)

func BytesToCert

func BytesToCert(cert []byte) (*x509.Certificate, error)

func BytesToPrivateKey

func BytesToPrivateKey(priv []byte) (*rsa.PrivateKey, error)

func BytesToPublicKey

func BytesToPublicKey(pub []byte) (*rsa.PublicKey, error)

func CertTemplate

func CertTemplate(cn string, validYear int) (*x509.Certificate, error)

func CertToBytes

func CertToBytes(crt *x509.Certificate) ([]byte, error)

func CheckIfSliceContains

func CheckIfSliceContains[T comparable](slice []T, ele T) bool

func CreateCert

func CreateCert(template, parent *x509.Certificate, pub interface{}, parentPriv interface{}) (cert *x509.Certificate, certPEM []byte, err error)

func DecryptWithPrivateKey

func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)

func DecryptWithSymmetricKey

func DecryptWithSymmetricKey(key []byte, file_byte []byte) ([]byte, error)

func EncryptWithPublicKey

func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) ([]byte, error)

func EncryptWithSymmetricKey

func EncryptWithSymmetricKey(key []byte, file_byte []byte) ([]byte, error)

func GenKeyPair

func GenKeyPair(keylen int) (*rsa.PrivateKey, *rsa.PublicKey)

func GenerateKeyPair

func GenerateKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)

func GetContextClusterPublicKeyBytes

func GetContextClusterPublicKeyBytes(context_nm string) ([]byte, error)

func GetContextUserCertificateBytes

func GetContextUserCertificateBytes(context_nm string) ([]byte, error)

func GetContextUserCertificateBytes_Detached

func GetContextUserCertificateBytes_Detached(config_b []byte, context_nm string) ([]byte, error)

func GetContextUserPrivateKeyBytes

func GetContextUserPrivateKeyBytes(context_nm string) ([]byte, error)

func GetContextUserPublicKeyBytes

func GetContextUserPublicKeyBytes(context_nm string) ([]byte, error)

func GetContextUserPublicKeyBytes_Detached

func GetContextUserPublicKeyBytes_Detached(config_b []byte, context_nm string) ([]byte, error)

func GetKubeConfigPath

func GetKubeConfigPath() (string, error)

func GetRandIntInRange

func GetRandIntInRange(min int, max int) int

func PrivateKeyToBytes

func PrivateKeyToBytes(priv *rsa.PrivateKey) ([]byte, error)

func PublicKeyToBytes

func PublicKeyToBytes(pub *rsa.PublicKey) ([]byte, error)

func RandomHex

func RandomHex(n int) (string, error)

func VerifyChallange_Key

func VerifyChallange_Key(answer ChallengRecord) (string, error)

Types

type CertSet

type CertSet struct {
	RootCertPEM   []byte
	RootKeyPEM    []byte
	RootPubPEM    []byte
	ClientCertPEM []byte
	ClientKeyPEM  []byte
	ClientPubPEM  []byte
	ServCertPEM   []byte
	ServKeyPEM    []byte
	ServPubPEM    []byte
}

func NewCertsPipeline

func NewCertsPipeline() *CertSet

type ChallengRecord

type ChallengRecord map[string]map[string]string

func GenerateChallenge

func GenerateChallenge(client_ca_pub_key ChallengRecord) (ChallengRecord, error)

func GenerateChallenge_Detached

func GenerateChallenge_Detached(config_b []byte, client_ca_pub_key ChallengRecord) (ChallengRecord, error)

func GenerateChallenge_Key

func GenerateChallenge_Key(email string, pub_str string) (ChallengRecord, error)

type KeyRecord

type KeyRecord map[string]string

func VerifyChallange

func VerifyChallange(answer ChallengRecord) (string, KeyRecord, error)

func VerifyChallange_Detached

func VerifyChallange_Detached(config_b []byte, answer ChallengRecord) (string, KeyRecord, error)

Jump to

Keyboard shortcuts

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