Documentation ¶
Index ¶
- Constants
- func ResetSystemCertPool()
- func SJWTBase64DecodeBytes(seg string) ([]byte, error)
- func SJWTBase64DecodeString(src string) (string, error)
- func SJWTBase64EncodeBytes(seg []byte) string
- func SJWTBase64EncodeString(src string) string
- func SJWTCheckAttributes(bToken string, paramInfo string) (int, error)
- func SJWTCheckFullIdentity(identityVal string, expireVal int, pubkeyPath string, timeoutVal int) (int, error)
- func SJWTCheckFullIdentityPubKey(identityVal string, expireVal int, pubkeyVal string) (int, error)
- func SJWTCheckFullIdentityURL(identityVal string, expireVal int, timeoutVal int) (int, error)
- func SJWTCheckIdentity(identityVal string, expireVal int, pubkeyPath string, timeoutVal int) (int, error)
- func SJWTCheckIdentityPKMode(identityVal string, expireVal int, pubkeyVal string, pubkeyMode int, ...) (int, error)
- func SJWTEncode(header SJWTHeader, payload SJWTPayload, prvkey interface{}) string
- func SJWTEncodeText(headerJSON string, payloadJSON string, prvkeyPath string) (string, int, error)
- func SJWTEncodeTextWithPrvKey(headerJSON string, payloadJSON string, prvkeyData string) (string, int, error)
- func SJWTGetIdentity(origTN string, destTN string, attestVal string, origID string, x5uVal string, ...) (string, int, error)
- func SJWTGetIdentityPrvKey(origTN string, destTN string, attestVal string, origID string, x5uVal string, ...) (string, int, error)
- func SJWTGetURLCacheFilePath(urlVal string) string
- func SJWTGetURLCachedContent(urlVal string) ([]byte, error)
- func SJWTGetURLContent(urlVal string, timeoutVal int) ([]byte, int, error)
- func SJWTGetValidInfoAttr(hdrtoken []string) (string, int, error)
- func SJWTLibOptSetN(optname string, optval int) int
- func SJWTLibOptSetS(optname string, optval string) int
- func SJWTLibOptSetV(optnameval string) int
- func SJWTParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, int, error)
- func SJWTParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, int, error)
- func SJWTPubKeyVerify(pubKey []byte) (int, error)
- func SJWTRemoveWhiteSpaces(s string) string
- func SJWTSetURLCachedContent(urlVal string, data []byte) error
- func SJWTSignWithPrvKey(signingString string, key interface{}) (string, int, error)
- func SJWTVerifyWithPubKey(signingString string, signature string, key interface{}) (int, error)
- func SetURLFileCacheOptions(path string, expire int)
- func SystemCertPool() (*x509.CertPool, error)
- type SJWTDest
- type SJWTHeader
- type SJWTLibOptions
- type SJWTOrig
- type SJWTPayload
Constants ¶
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 ¶
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 ¶
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 ¶
SJWTBase64EncodeBytes encode bytes array to base64 with padding stripped
func SJWTBase64EncodeString ¶
SJWTBase64EncodeString encode string to base64 with padding stripped
func SJWTCheckAttributes ¶ added in v1.2.0
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
SJWTCheckFullIdentityPubKey - implements the verify of identity using public key
func SJWTCheckFullIdentityURL ¶
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 ¶
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
SJWTRemoveWhiteSpaces --
func SJWTGetURLCachedContent ¶ added in v1.2.0
SJWTGetURLCachedContent --
func SJWTGetURLContent ¶
SJWTGetURLContent --
func SJWTGetValidInfoAttr ¶ added in v1.2.0
SJWTGetValidInfoAttr - return info param value of alg and ppt are valid
func SJWTLibOptSetN ¶ added in v1.2.0
SJWTLibOptSetN --
func SJWTLibOptSetS ¶ added in v1.2.0
SJWTLibOptSetS --
func SJWTParseECPrivateKeyFromPEM ¶
func SJWTParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, int, error)
SJWTParseECPrivateKeyFromPEM Parse PEM encoded Elliptic Curve Private Key Structure
func SJWTParseECPublicKeyFromPEM ¶
SJWTParseECPublicKeyFromPEM Parse PEM encoded PKCS1 or PKCS8 public key
func SJWTPubKeyVerify ¶ added in v1.2.0
SJWTPubKeyVerify -
func SJWTSetURLCachedContent ¶ added in v1.2.0
SJWTSetURLCachedContent --
func SJWTSignWithPrvKey ¶
SJWTSignWithPrvKey - implements the signing For this signing method, key must be an ecdsa.PrivateKey struct
func SJWTVerifyWithPubKey ¶
SJWTVerifyWithPubKey - implements the verify For this verify method, key must be an ecdsa.PublicKey struct
func SetURLFileCacheOptions ¶ added in v1.2.0
SetFileCacheOptions --
func SystemCertPool ¶ added in v1.2.0
Types ¶
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 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 --