Documentation ¶
Overview ¶
Package s11n implements serialization routines for the various PKI data structures.
Index ¶
- Constants
- Variables
- func GetVerifierFromDescriptor(rawDesc []byte) (cert.Verifier, error)
- func IsDescriptorWellFormed(d *pki.MixDescriptor, epoch uint64) error
- func IsDocumentWellFormed(d *pki.Document) error
- func ParseDescriptorWithoutVerify(b []byte) (*pki.MixDescriptor, error)
- func SerializeDocument(d *Document) ([]byte, error)
- func SignDescriptor(signer cert.Signer, base *pki.MixDescriptor) ([]byte, error)
- func VerifyAndParseDescriptor(verifier cert.Verifier, b []byte, epoch uint64) (*pki.MixDescriptor, error)
- func VerifyAndParseDocument(payload []byte) (*pki.Document, error)
- type Document
Constants ¶
const (
// DocumentVersion is the string identifying the format of the Document
DocumentVersion = "document-v0"
)
Variables ¶
var ( // CertificateExpiration is the time a descriptor certificate will be valid for. CertificateExpiration = (epochtime.Period * 3) + (time.Minute * 10) )
var ( // ErrInvalidEpoch is the error to return when the document epoch is // invalid. ErrInvalidEpoch = errors.New("invalid document epoch") )
Functions ¶
func GetVerifierFromDescriptor ¶
GetVerifierFromDescriptor returns a verifier for the given mix descriptor certificate.
func IsDescriptorWellFormed ¶
func IsDescriptorWellFormed(d *pki.MixDescriptor, epoch uint64) error
IsDescriptorWellFormed validates the descriptor and returns a descriptive error iff there are any problems that would make it unusable as part of a PKI Document.
func IsDocumentWellFormed ¶
IsDocumentWellFormed validates the document and returns a descriptive error iff there are any problems that invalidates the document.
func ParseDescriptorWithoutVerify ¶
func ParseDescriptorWithoutVerify(b []byte) (*pki.MixDescriptor, error)
func SerializeDocument ¶
func SignDescriptor ¶
SignDescriptor signs and serializes the descriptor with the provided signing key.
func VerifyAndParseDescriptor ¶
func VerifyAndParseDescriptor(verifier cert.Verifier, b []byte, epoch uint64) (*pki.MixDescriptor, error)
VerifyAndParseDescriptor verifies the signature and deserializes the descriptor. MixDescriptors returned from this routine are guaranteed to have been correctly self signed by the IdentityKey listed in the MixDescriptor.
Types ¶
type Document ¶
type Document struct { // Version uniquely identifies the document format as being for the // specified version so that it can be rejected if the format changes. Version string Epoch uint64 GenesisEpoch uint64 SendRatePerMinute uint64 Mu float64 MuMaxDelay uint64 LambdaP float64 LambdaPMaxDelay uint64 LambdaL float64 LambdaLMaxDelay uint64 LambdaD float64 LambdaDMaxDelay uint64 LambdaM float64 LambdaMMaxDelay uint64 Topology [][][]byte Providers [][]byte }
Document is the on-the-wire representation of a PKI Document.