secsipid

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: BSD-3-Clause-Clear Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SJWTRetOK = 0
	// generic errors
	SJWTRetErr = -1
	// public certificate and private key errors: -100..-199
	SJWTRetErrCertInvalid         = -101
	SJWTRetErrCertInvalidFormat   = -102
	SJWTRetErrCertExpired         = -103
	SJWTRetErrCertBeforeValidity  = -104
	SJWTRetErrCertProcessing      = -105
	SJWTRetErrCertNoCAFile        = -106
	SJWTRetErrCertReadCAFile      = -107
	SJWTRetErrCertNoCAInter       = -108
	SJWTRetErrCertReadCAInter     = -109
	SJWTRetErrCertNoCRLFile       = -110
	SJWTRetErrCertReadCRLFile     = -111
	SJWTRetErrCertRevoked         = -112
	SJWTRetErrCertInvalidEC       = -114
	SJWTRetErrPrvKeyInvalid       = -151
	SJWTRetErrPrvKeyInvalidFormat = -152
	SJWTRetErrPrvKeyInvalidEC     = -152
	// identity JSON header, payload and signature errors: -200..-299
	SJWTRetErrJSONHdrParse          = -201
	SJWTRetErrJSONHdrAlg            = -202
	SJWTRetErrJSONHdrPpt            = -203
	SJWTRetErrJSONHdrTyp            = -204
	SJWTRetErrJSONHdrX5u            = -205
	SJWTRetErrJSONPayloadParse      = -231
	SJWTRetErrJSONPayloadIATExpired = -232
	SJWTRetErrJSONSignatureInvalid  = -251
	SJWTRetErrJSONSignatureHashing  = -252
	SJWTRetErrJSONSignatureSize     = -253
	SJWTRetErrJSONSignatureFailure  = -254
	SJWTRetErrJSONSignatureNob64    = -255
	// identity SIP header errors: -300..-399
	SJWTRetErrSIPHdrParse = -301
	SJWTRetErrSIPHdrAlg   = -302
	SJWTRetErrSIPHdrPpt   = -303
	SJWTRetErrSIPHdrEmpty = -304
	SJWTRetErrSIPHdrInfo  = -305
	// http and file operations errors: -400..-499
	SJWTRetErrHTTPInvalidURL = -401
	SJWTRetErrHTTPGet        = -402
	SJWTRetErrHTTPStatusCode = -403
	SJWTRetErrHTTPReadBody   = -404
	SJWTRetErrFileRead       = -451
)

return and error code values

Variables

This section is empty.

Functions

func ResetSystemCertPool added in v1.2.0

func ResetSystemCertPool()

func SJWTBase64DecodeBytes

func SJWTBase64DecodeBytes(seg string) ([]byte, error)

SJWTBase64DecodeBytes takes in a base 64 encoded string and returns the actual bytes array or an error of it fails to decode the string

func SJWTBase64DecodeString

func SJWTBase64DecodeString(src string) (string, error)

SJWTBase64DecodeString takes in a base 64 encoded string and returns the actual string or an error of it fails to decode the string

func SJWTBase64EncodeBytes

func SJWTBase64EncodeBytes(seg []byte) string

SJWTBase64EncodeBytes encode bytes array to base64 with padding stripped

func SJWTBase64EncodeString

func SJWTBase64EncodeString(src string) string

SJWTBase64EncodeString encode string to base64 with padding stripped

func SJWTCheckAttributes added in v1.2.0

func SJWTCheckAttributes(bToken string, paramInfo string) (int, error)

SJWTCheckAttributes - implements the verify of attributes

func SJWTCheckFullIdentity

func SJWTCheckFullIdentity(identityVal string, expireVal int, pubkeyPath string, timeoutVal int) (int, error)

SJWTCheckFullIdentity - implements the verify of identity

func SJWTCheckFullIdentityPubKey added in v1.2.0

func SJWTCheckFullIdentityPubKey(identityVal string, expireVal int, pubkeyVal string) (int, error)

SJWTCheckFullIdentityPubKey - implements the verify of identity using public key

func SJWTCheckFullIdentityURL

func SJWTCheckFullIdentityURL(identityVal string, expireVal int, timeoutVal int) (int, error)

SJWTCheckFullIdentityURL - implements the verify of identity using URL

func SJWTCheckIdentity

func SJWTCheckIdentity(identityVal string, expireVal int, pubkeyPath string, timeoutVal int) (int, error)

SJWTCheckIdentity - implements the verify of identity

func SJWTCheckIdentityPKMode added in v1.2.0

func SJWTCheckIdentityPKMode(identityVal string, expireVal int, pubkeyVal string, pubkeyMode int, timeoutVal int) (int, error)

SJWTCheckIdentityPKMode - implements the verify of identity

func SJWTEncode

func SJWTEncode(header SJWTHeader, payload SJWTPayload, prvkey interface{}) string

SJWTEncode - encode payload to JWT

func SJWTEncodeText

func SJWTEncodeText(headerJSON string, payloadJSON string, prvkeyPath string) (string, int, error)

SJWTEncodeText - encode header and payload to JWT

func SJWTEncodeTextWithPrvKey added in v1.3.0

func SJWTEncodeTextWithPrvKey(headerJSON string, payloadJSON string, prvkeyData string) (string, int, error)

SJWTEncodeTextWithPrvKey - encode header and payload to JWT with private key data

func SJWTGetIdentity

func SJWTGetIdentity(origTN string, destTN string, attestVal string, origID string, x5uVal string, prvkeyPath string) (string, int, error)

SJWTGetIdentity --

func SJWTGetIdentityPrvKey added in v1.2.0

func SJWTGetIdentityPrvKey(origTN string, destTN string, attestVal string, origID string, x5uVal string, prvkeyData []byte) (string, int, error)

SJWTGetIdentityPrvKey --

func SJWTGetURLCacheFilePath added in v1.2.0

func SJWTGetURLCacheFilePath(urlVal string) string

SJWTRemoveWhiteSpaces --

func SJWTGetURLCachedContent added in v1.2.0

func SJWTGetURLCachedContent(urlVal string) ([]byte, error)

SJWTGetURLCachedContent --

func SJWTGetURLContent

func SJWTGetURLContent(urlVal string, timeoutVal int) ([]byte, int, error)

SJWTGetURLContent --

func SJWTGetValidInfoAttr added in v1.2.0

func SJWTGetValidInfoAttr(hdrtoken []string) (string, int, error)

SJWTGetValidInfoAttr - return info param value of alg and ppt are valid

func SJWTLibOptSetN added in v1.2.0

func SJWTLibOptSetN(optname string, optval int) int

SJWTLibOptSetN --

func SJWTLibOptSetS added in v1.2.0

func SJWTLibOptSetS(optname string, optval string) int

SJWTLibOptSetS --

func SJWTLibOptSetV added in v1.2.0

func SJWTLibOptSetV(optnameval string) int

SJWTLibOptSetV --

func SJWTParseECPrivateKeyFromPEM

func SJWTParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, int, error)

SJWTParseECPrivateKeyFromPEM Parse PEM encoded Elliptic Curve Private Key Structure

func SJWTParseECPublicKeyFromPEM

func SJWTParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, int, error)

SJWTParseECPublicKeyFromPEM Parse PEM encoded PKCS1 or PKCS8 public key

func SJWTPubKeyVerify added in v1.2.0

func SJWTPubKeyVerify(pubKey []byte) (int, error)

SJWTPubKeyVerify -

func SJWTRemoveWhiteSpaces

func SJWTRemoveWhiteSpaces(s string) string

SJWTRemoveWhiteSpaces --

func SJWTSetURLCachedContent added in v1.2.0

func SJWTSetURLCachedContent(urlVal string, data []byte) error

SJWTSetURLCachedContent --

func SJWTSignWithPrvKey

func SJWTSignWithPrvKey(signingString string, key interface{}) (string, int, error)

SJWTSignWithPrvKey - implements the signing For this signing method, key must be an ecdsa.PrivateKey struct

func SJWTVerifyWithPubKey

func SJWTVerifyWithPubKey(signingString string, signature string, key interface{}) (int, error)

SJWTVerifyWithPubKey - implements the verify For this verify method, key must be an ecdsa.PublicKey struct

func SetURLFileCacheOptions added in v1.2.0

func SetURLFileCacheOptions(path string, expire int)

SetFileCacheOptions --

func SystemCertPool added in v1.2.0

func SystemCertPool() (*x509.CertPool, error)

Types

type SJWTDest

type SJWTDest struct {
	TN []string `json:"tn"`
}

SJWTDest --

type SJWTHeader

type SJWTHeader struct {
	Alg string `json:"alg"`
	Ppt string `json:"ppt"`
	Typ string `json:"typ"`
	X5u string `json:"x5u"`
}

SJWTHeader - header for JWT

type SJWTLibOptions added in v1.2.0

type SJWTLibOptions struct {
	// contains filtered or unexported fields
}

type SJWTOrig

type SJWTOrig struct {
	TN string `json:"tn"`
}

SJWTOrig --

type SJWTPayload

type SJWTPayload struct {
	ATTest string   `json:"attest"`
	Dest   SJWTDest `json:"dest"`
	IAT    int64    `json:"iat"`
	Orig   SJWTOrig `json:"orig"`
	OrigID string   `json:"origid"`
}

SJWTPayload - JWT payload

func SJWTDecodeWithPubKey

func SJWTDecodeWithPubKey(jwt string, expireVal int, pubkey interface{}) (*SJWTPayload, error)

SJWTDecodeWithPubKey - decode JWT string

func SJWTGetValidPayload

func SJWTGetValidPayload(base64Payload string, expireVal int) (*SJWTPayload, int, error)

SJWTGetValidPayload --

Jump to

Keyboard shortcuts

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