Documentation ¶
Index ¶
- Constants
- func AesDecryptCBC(key, ciphertext []byte) (plaintext []byte, err error)
- func AesEncryptCBC(key, plaintext []byte) (ciphertext []byte, err error)
- func AuthGenSessionKeyTS(key []byte) (sessionKey []byte)
- func Base64Decode(encodedText string) (text []byte, err error)
- func Base64Encode(text []byte) (encodedText string)
- func CreateClientX(cert *[]byte) (client *http.Client, err error)
- func DecodeMessage(message string, key []byte) (plaintext []byte, err error)
- func EncodeMessage(plaintext []byte, key []byte) (message string, err error)
- func GenSecretKey(key []byte, ts int64, id string) (secretKey []byte)
- func GenVerifier(key []byte) (v string, ts int64, err error)
- type CryptoKey
- type Ticket
Constants ¶
View Source
const ( RandomNumberOffset = 0 RandomNumberSize = 8 CheckSumOffset = RandomNumberOffset + RandomNumberSize CheckSumSize = 16 MessageOffset = CheckSumOffset + CheckSumSize MessageMetaDataSize = RandomNumberSize + CheckSumSize )
View Source
const ( TicketVersion = 1 TicketAge = 24 * 60 * 60 )
Variables ¶
This section is empty.
Functions ¶
func AesDecryptCBC ¶
AesDecryptCBC defines aes decryption with CBC
func AesEncryptCBC ¶
AesEncryptCBC defines aes encryption with CBC
func AuthGenSessionKeyTS ¶
AuthGenSessionKeyTS authnode generates a session key according to its master key and current timestamp
func Base64Decode ¶
Base64Decode Decoding using base64
func Base64Encode ¶
Base64Encode encoding using base64
func CreateClientX ¶
CreateClientX creates a https client
func DecodeMessage ¶
DecodeMessage decode a message and verify its validity
func EncodeMessage ¶
EncodeMessage encode a message with aes encrption, md5 signature
func GenSecretKey ¶
GenSecretKey generate a secret key according to pair {ts, id}
Types ¶
type Ticket ¶
type Ticket struct { Version uint8 `json:"version"` ServiceID string `json:"service_id"` SessionKey CryptoKey `json:"session_key"` Exp int64 `json:"exp"` IP string `json:"ip"` Caps []byte `json:"caps"` }
Ticket is a temperary struct to store permissions/caps for clients to access principle
Click to show internal directories.
Click to hide internal directories.