Documentation ¶
Overview ¶
Package protocol implements the core of the Roughtime protocol.
Index ¶
- Constants
- Variables
- func CalculateChainNonce(prevReply, blind []byte) (nonce [NonceSize]byte)
- func CreateCertificate(minTime, maxTime uint64, publicKey, rootPrivateKey []byte) (certBytes []byte, err error)
- func CreateReplies(nonces [][]byte, midpoint uint64, radius uint32, cert []byte, ...) ([][]byte, error)
- func CreateRequest(rand io.Reader, prevReply []byte) (nonce, blind [NonceSize]byte, request []byte, err error)
- func Decode(bytes []byte) (map[uint32][]byte, error)
- func Encode(msg map[uint32][]byte) ([]byte, error)
- func VerifyReply(replyBytes, publicKey []byte, nonce [NonceSize]byte) (time uint64, radius uint32, err error)
Constants ¶
const ( // NonceSize is the number of bytes in a nonce. NonceSize = sha512.Size // MinRequestSize is the minimum number of bytes in a request. MinRequestSize = 1024 )
Variables ¶
var (
// TagNonce names the bytestring containing the client's nonce.
TagNonce = tagNONC
)
Functions ¶
func CalculateChainNonce ¶
CalculateChainNonce calculates the nonce to be used in the next request in a chain given a reply and a blinding factor.
func CreateCertificate ¶
func CreateCertificate(minTime, maxTime uint64, publicKey, rootPrivateKey []byte) (certBytes []byte, err error)
CreateCertificate returns a signed certificate, using rootPrivateKey, delegating authority for the given timestamp to publicKey.
func CreateReplies ¶
func CreateReplies(nonces [][]byte, midpoint uint64, radius uint32, cert []byte, privateKey []byte) ([][]byte, error)
CreateReplies signs, using privateKey, a batch of nonces along with the given time and radius in microseconds. It returns one reply for each nonce using that signature and includes cert in each.
func CreateRequest ¶
func CreateRequest(rand io.Reader, prevReply []byte) (nonce, blind [NonceSize]byte, request []byte, err error)
CreateRequest creates a Roughtime request given an entropy source and the contents of a previous reply for chaining. If this request is the first of a chain, prevReply can be empty. It returns the nonce (needed to verify the reply), the blind (needed to prove correct chaining to an external party) and the request itself.
func Encode ¶
Encode converts a map of tags to bytestrings into an encoded message. The number of elements in msg and the sum of the lengths of all the bytestrings must be ≤ 2**32.
func VerifyReply ¶
func VerifyReply(replyBytes, publicKey []byte, nonce [NonceSize]byte) (time uint64, radius uint32, err error)
VerifyReply parses the Roughtime reply in replyBytes, authenticates it using publicKey and verifies that nonce is included in it. It returns the included timestamp and radius.
Types ¶
This section is empty.