Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Crypto ¶
type Crypto struct { PrivateKey [32]byte PublicKey [32]byte ServerKey [32]byte SessionKey []byte DecryptionNonce CryptoNonce EncryptionNonce CryptoNonce }
it implements all the needed methods to encrypt and decrypt the messages
type CryptoNonce ¶
type CryptoNonce struct {
EncryptedNonce [24]byte
}
it implements and represents the nonce used to encrypt and decrypt the packets
func NewNonce ¶
func NewNonce(publicKey, serverKey []byte) CryptoNonce
it creates a new nonce object based on the generated public key and the server key
func NewNonceWithNonce ¶
func NewNonceWithNonce(publicKey, serverKey, nonce []byte) CryptoNonce
it creates a new nonce object based on the generated public key, the server key and the received nonce from the server
func NewNonceWithServerNonce ¶
func NewNonceWithServerNonce(nonce []byte) CryptoNonce
it creates a new nonce object based on the received nonce from the server
func (*CryptoNonce) Increment ¶
func (o *CryptoNonce) Increment()
it increments the nonce (we have to increment it every time we encrypt or decrypt a new packet)
Click to show internal directories.
Click to hide internal directories.