Documentation ¶
Overview ¶
Package serialization implements utilities for reading and writing data with signature-based integrity checking.
Index ¶
- func NewSigningWriteCloser(data, signature io.WriteCloser, s Signer, opts *Options) (io.WriteCloser, error)
- func NewVerifyingReader(data, signature io.Reader, key security.PublicKey) (io.Reader, error)
- func VDLReadSignedData(dec vdl.Decoder, x *SignedData) error
- type HashCode
- type Options
- type SignedData
- type SignedDataHash
- type SignedDataSignature
- func (x SignedDataSignature) Index() int
- func (x SignedDataSignature) Interface() interface{}
- func (x SignedDataSignature) Name() string
- func (x SignedDataSignature) VDLIsZero() bool
- func (x SignedDataSignature) VDLReflect(vdlSignedDataReflect)
- func (x SignedDataSignature) VDLWrite(enc vdl.Encoder) error
- type SignedHeader
- type Signer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSigningWriteCloser ¶
func NewSigningWriteCloser(data, signature io.WriteCloser, s Signer, opts *Options) (io.WriteCloser, error)
NewSigningWriteCloser returns an io.WriteCloser that writes data along with an appropriate signature that establishes the integrity and authenticity of the data. It behaves as follows:
- A Write call writes chunks (of size provided by the Options or 1MB by default) of data to the provided data WriteCloser and a hash of the chunks to the provided signature WriteCloser.
- A Close call writes a signature (computed using the provided signer) of all the hashes written, and then closes the data and signature WriteClosers.
func NewVerifyingReader ¶
NewVerifyingReader returns an io.Reader that ensures that all data returned by Read calls was written using a NewSigningWriter (by a principal possessing a signer corresponding to the provided public key), and has not been modified since (ensuring integrity and authenticity of data).
func VDLReadSignedData ¶
func VDLReadSignedData(dec vdl.Decoder, x *SignedData) error
Types ¶
type Options ¶
type Options struct { // ChunkSizeBytes controls the maximum amount of memory devoted to buffering // data provided to Write calls. See NewSigningWriteCloser. ChunkSizeBytes int64 }
Options specifies parameters to tune a SigningWriteCloser.
type SignedData ¶
type SignedData interface { // Index returns the field index. Index() int // Interface returns the field value as an interface. Interface() interface{} // Name returns the field name. Name() string // VDLReflect describes the SignedData union type. VDLReflect(vdlSignedDataReflect) VDLIsZero() bool VDLWrite(vdl.Encoder) error }
SignedData represents any single field of the SignedData union type.
SignedData describes the information sent by a SigningWriter and read by VerifiyingReader.
type SignedDataHash ¶
type SignedDataHash struct{ Value HashCode }
SignedDataHash represents field Hash of the SignedData union type.
func (SignedDataHash) Index ¶
func (x SignedDataHash) Index() int
func (SignedDataHash) Interface ¶
func (x SignedDataHash) Interface() interface{}
func (SignedDataHash) Name ¶
func (x SignedDataHash) Name() string
func (SignedDataHash) VDLIsZero ¶
func (x SignedDataHash) VDLIsZero() bool
func (SignedDataHash) VDLReflect ¶
func (x SignedDataHash) VDLReflect(vdlSignedDataReflect)
type SignedDataSignature ¶
SignedDataSignature represents field Signature of the SignedData union type.
func (SignedDataSignature) Index ¶
func (x SignedDataSignature) Index() int
func (SignedDataSignature) Interface ¶
func (x SignedDataSignature) Interface() interface{}
func (SignedDataSignature) Name ¶
func (x SignedDataSignature) Name() string
func (SignedDataSignature) VDLIsZero ¶
func (x SignedDataSignature) VDLIsZero() bool
func (SignedDataSignature) VDLReflect ¶
func (x SignedDataSignature) VDLReflect(vdlSignedDataReflect)
type SignedHeader ¶
type SignedHeader struct {
ChunkSizeBytes int64
}
func (SignedHeader) VDLIsZero ¶
func (x SignedHeader) VDLIsZero() bool
func (SignedHeader) VDLReflect ¶
func (SignedHeader) VDLReflect(struct { Name string `vdl:"v.io/x/ref/lib/security/serialization.SignedHeader"` })