Documentation ¶
Index ¶
- Constants
- Variables
- func DeriveTo(out, key []byte, infos ...[]byte) error
- func GetCiphertextFromMessage(m refs.Message) ([]byte, error)
- type Boxer
- func (bxr *Boxer) Decrypt(ctxt []byte, author refs.FeedRef, prev refs.MessageRef, ...) ([]byte, error)
- func (bxr *Boxer) Encrypt(plain []byte, author refs.FeedRef, prev refs.MessageRef, ...) ([]byte, error)
- func (bxr *Boxer) GetReadKey(ctxt []byte, author refs.FeedRef, prev refs.MessageRef, ...) ([]byte, error)
- type Message
Constants ¶
View Source
const ( KeySize = 256 / 8 MaxSlots = 32 )
Variables ¶
View Source
var ( ErrTooManyRecipients = stderr.New("box2: too many recipients") ErrCouldNotDecrypt = stderr.New("box2: could not decrypt") ErrInvalid = stderr.New("box2: message is invalid") ErrEmptyPlaintext = stderr.New("box2: won't encrypt empty plaintext") ErrInvalidOffset = stderr.New("box2: precalculated body offset does not match real body offset") )
API and processing errors
Functions ¶
Types ¶
type Boxer ¶
type Boxer struct {
// contains filtered or unexported fields
}
func (*Boxer) Decrypt ¶
func (bxr *Boxer) Decrypt(ctxt []byte, author refs.FeedRef, prev refs.MessageRef, candidates []keys.Recipient) ([]byte, error)
Decrypt takes the ciphertext, it's auther and the previous hash of the message and some canddiates to try to decrypt with. It returns the decrypted cleartext or an error.
func (*Boxer) Encrypt ¶
func (bxr *Boxer) Encrypt(plain []byte, author refs.FeedRef, prev refs.MessageRef, recpts []keys.Recipient) ([]byte, error)
Encrypt takes a buffer to write into (out), the plaintext to encrypt, the (author) of the message, her (prev)ious message hash and a list of recipients (recpts). If out is too small to hold the full message, additonal allocations will be made. The ciphertext is returned as the first return value.
Click to show internal directories.
Click to hide internal directories.