Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(data []byte, key []byte) ([]byte, error)
- func DecryptKey(data []byte, privateKey *rsa.PrivateKey) ([]byte, error)
- func Encrypt(data []byte, key []byte) ([]byte, error)
- func EncryptKey(data []byte, key *rsa.PublicKey) ([]byte, error)
- func KeysGenerate(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)
- func KeysGenerateStandard() (*rsa.PrivateKey, *rsa.PublicKey, error)
- func NewSessionKey() [32]byte
- func NewSessionKeyBytes() []byte
- func Serialize(data interface{}) []byte
- type NioMessage
- func (instance *NioMessage) Clone() (response *NioMessage)
- func (instance *NioMessage) GetBodyAsBool() bool
- func (instance *NioMessage) GetBodyAsString() string
- func (instance *NioMessage) IsHandshake() bool
- func (instance *NioMessage) IsIdentityDescriptor() bool
- func (instance *NioMessage) SetBody(body interface{}) *NioMessage
- type NioSettings
Constants ¶
View Source
const KEY_LEN = 1024 * 3
Variables ¶
View Source
var ( HANDSHAKE = &NioMessage{ PublicKey: nil, Body: []byte("ACK"), } )
Functions ¶
func DecryptKey ¶
func DecryptKey(data []byte, privateKey *rsa.PrivateKey) ([]byte, error)
func KeysGenerate ¶
func KeysGenerateStandard ¶
func KeysGenerateStandard() (*rsa.PrivateKey, *rsa.PublicKey, error)
func NewSessionKey ¶
func NewSessionKey() [32]byte
func NewSessionKeyBytes ¶
func NewSessionKeyBytes() []byte
Types ¶
type NioMessage ¶
type NioMessage struct { PublicKey *rsa.PublicKey // public key for response SessionKey []byte // session key Body interface{} // message object }
func NewMessage ¶
func NewMessage() (instance *NioMessage)
func NewResponseToHandshakeMessage ¶
func NewResponseToHandshakeMessage(sessionKey []byte, clientKey, serverKey *rsa.PublicKey) (instance *NioMessage)
func (*NioMessage) Clone ¶
func (instance *NioMessage) Clone() (response *NioMessage)
func (*NioMessage) GetBodyAsBool ¶
func (instance *NioMessage) GetBodyAsBool() bool
func (*NioMessage) GetBodyAsString ¶
func (instance *NioMessage) GetBodyAsString() string
func (*NioMessage) IsHandshake ¶
func (instance *NioMessage) IsHandshake() bool
func (*NioMessage) IsIdentityDescriptor ¶
func (instance *NioMessage) IsIdentityDescriptor() bool
func (*NioMessage) SetBody ¶
func (instance *NioMessage) SetBody(body interface{}) *NioMessage
type NioSettings ¶
type NioSettings struct { Address string `json:"address"` // contains filtered or unexported fields }
func (*NioSettings) Host ¶
func (instance *NioSettings) Host() string
func (*NioSettings) Parse ¶
func (instance *NioSettings) Parse(text string) error
func (*NioSettings) Port ¶
func (instance *NioSettings) Port() int
Click to show internal directories.
Click to hide internal directories.