minclient: github.com/katzenpost/minclient/block Index | Files

package block

import "github.com/katzenpost/minclient/block"

Package block provides routines for manipulating End to End blocks.

Index

Package Files

block.go

Constants

const (
    // MessageIDLength is the length of a message ID in bytes.
    MessageIDLength = 16

    // BlockCiphertextLength is the length of a BlockCiphertext in bytes.
    BlockCiphertextLength = constants.UserForwardPayloadLength

    // BlockPayloadLength is the maximum user payload length in a Block.
    BlockPayloadLength = BlockCiphertextLength - (blockCiphertextOverhead + blockOverhead)
)

func EncryptMessage Uses

func EncryptMessage(msgID *[MessageIDLength]byte, msg []byte, sender *ecdh.PrivateKey, recipient *ecdh.PublicKey) ([][]byte, error)

EncryptMessage encrypts a message after fragmenting it into blocks, and returns a vector of byte serialized ciphertexts.

type Block Uses

type Block struct {
    MessageID   [MessageIDLength]byte
    TotalBlocks uint16
    BlockID     uint16
    BlockLength uint32
    Payload     []byte
}

Block is a Katzenpost end to end Block (plaintext).

func DecryptBlock Uses

func DecryptBlock(b []byte, recipient *ecdh.PrivateKey) (*Block, *ecdh.PublicKey, error)

DecryptBlock authenticates and decrypts a encrypted Block, and returns the Block and sender's static PublicKey.

func (*Block) FromBytes Uses

func (b *Block) FromBytes(buf []byte) error

FromBytes deserializes bytes into the Block.

func (*Block) ToBytes Uses

func (b *Block) ToBytes() ([]byte, error)

ToBytes serializes a Block into bytes.

Package block imports 8 packages (graph) and is imported by 2 packages. Updated 2018-02-24. Refresh now. Tools for package owners.