Documentation ¶
Index ¶
- Constants
- func AddKeyRing(state *Signalstate, key *[KeySize]byte, ratchetnum uint64)
- func DHRatchet(state *Signalstate, head Mesghead) error
- func Decrypt(encrypted []byte, key *[KeySize]byte) ([]byte, error)
- func Encrypt(message []byte, key *[KeySize]byte) ([]byte, error)
- func Hash64(value []byte) uint64
- func KdfCk(chainkey *[KeySize]byte, rparam *Ratchetparam) (*[KeySize]byte, *[KeySize]byte, error)
- func KdfRk(rootkey *[KeySize]byte, dhout *[KeySize]byte, rparam *Ratchetparam) (*[KeySize]byte, *[KeySize]byte, error)
- func Key() (*[KeySize]byte, error)
- func KeyPair() (*[KeySize]byte, *[KeySize]byte, error)
- func KeyToHex(k *[KeySize]byte) string
- func Level(level string) (int, error)
- func NewDh(pair Keypair, pubkey *[KeySize]byte) *[KeySize]byte
- func Nonce() (*[NonceSize]byte, error)
- func Open(encrypted []byte, senderPublicKey *[KeySize]byte, ...) ([]byte, bool)
- func PasswordKey(password []byte, salt []byte) (*[KeySize]byte, error)
- func Ratchet(state *Signalstate) bool
- func RatchetDecrypt(state *Signalstate, head Mesghead, ciphertext []byte) ([]byte, error)
- func RatchetInitReceiver(state *Signalstate, symkey *[KeySize]byte, recvkp Keypair)
- func RatchetInitSender(state *Signalstate, symkey *[KeySize]byte, rpubkey *[KeySize]byte) error
- func ScryptN(state *Signalstate) int
- func Seal(message []byte, recipientPublicKey *[KeySize]byte, ...) ([]byte, error)
- func SetRatchet(state *Signalstate, count int, period int, level int) error
- func SetScryptN(state *Signalstate, scryptn int)
- func SkipMessageKeys(state *Signalstate, until uint64) error
- func TryKeyRing(ciphertext []byte, state *Signalstate, ratchetnum uint64) ([]byte, error)
- func TrySkippedMessageKeys(state *Signalstate, head Mesghead, ciphertext []byte) ([]byte, error)
- func Zero(data []byte)
- type Keypair
- type Mesghead
- type Ratchetparam
- type Signalstate
Constants ¶
const ( KeySize = 32 NonceSize = 24 )
KeySize and NonceSize : constants used for all encryption functions
const ( VLowSec int = 0 + iota LowSec MedSec HighSec VHighSec )
VLowSec : security level enumerations for scrypt N
const MaxSkip = 100
MaxSkip :
Variables ¶
This section is empty.
Functions ¶
func AddKeyRing ¶
func AddKeyRing(state *Signalstate, key *[KeySize]byte, ratchetnum uint64)
AddKeyRing :
func Decrypt ¶
Decrypt : extracts the nonce from the ciphertext and decrypts with symmetric key cryptography
func Encrypt ¶
Encrypt : encrypted message is the size original message plus overhead bytes and encrypted with symmetric key cryptography
func KdfRk ¶
func KdfRk(rootkey *[KeySize]byte, dhout *[KeySize]byte, rparam *Ratchetparam) (*[KeySize]byte, *[KeySize]byte, error)
KdfRk : New root key derivation function - returns new root key and new chain key
func Open ¶
func Open(encrypted []byte, senderPublicKey *[KeySize]byte, recipientPrivateKey *[KeySize]byte) ([]byte, bool)
Open : decrypt a message with public key cryptography
func PasswordKey ¶
PasswordKey : generate a symmetric key from a passphrase and salt.
func RatchetDecrypt ¶
func RatchetDecrypt(state *Signalstate, head Mesghead, ciphertext []byte) ([]byte, error)
RatchetDecrypt :
func RatchetInitReceiver ¶
func RatchetInitReceiver(state *Signalstate, symkey *[KeySize]byte, recvkp Keypair)
RatchetInitReceiver :
func RatchetInitSender ¶
RatchetInitSender :
func ScryptN ¶
func ScryptN(state *Signalstate) int
ScryptN : return the scrypt KDF algorithm 'N' value
func Seal ¶
func Seal(message []byte, recipientPublicKey *[KeySize]byte, senderPrivateKey *[KeySize]byte) ([]byte, error)
Seal : encrypt a message with public key cryptography
func SetRatchet ¶
func SetRatchet(state *Signalstate, count int, period int, level int) error
SetRatchet : set ratchet parameters, message count between ratchets, period in hours between ratchets, security level
func SetScryptN ¶
func SetScryptN(state *Signalstate, scryptn int)
SetScryptN : set the scrypt KDF algorithm 'N' value
func SkipMessageKeys ¶
func SkipMessageKeys(state *Signalstate, until uint64) error
SkipMessageKeys :
func TryKeyRing ¶
func TryKeyRing(ciphertext []byte, state *Signalstate, ratchetnum uint64) ([]byte, error)
TryKeyRing :
func TrySkippedMessageKeys ¶
func TrySkippedMessageKeys(state *Signalstate, head Mesghead, ciphertext []byte) ([]byte, error)
TrySkippedMessageKeys :
Types ¶
type Mesghead ¶
Mesghead :
func RatchetEncrypt ¶
func RatchetEncrypt(state *Signalstate, plaintext []byte) (Mesghead, []byte, error)
RatchetEncrypt :
type Ratchetparam ¶
Ratchetparam :
type Signalstate ¶
type Signalstate struct { Mesgkey *[KeySize]byte //Current message key // contains filtered or unexported fields }
Signalstate :