import "v.io/x/ref/lib/security/serialization"
Package serialization implements utilities for reading and writing data with signature-based integrity checking.
nolint:golint
serialization.go serialization.vdl.go signing_writer.go verifying_reader.go
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.
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(dec vdl.Decoder, x *SignedData) error
func (HashCode) VDLReflect(struct { Name string `vdl:"v.io/x/ref/lib/security/serialization.HashCode"` })
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 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.
SignedDataHash represents field Hash of the SignedData union type.
func (x SignedDataHash) Index() int
func (x SignedDataHash) Interface() interface{}
func (x SignedDataHash) Name() string
func (x SignedDataHash) VDLIsZero() bool
func (x SignedDataHash) VDLReflect(vdlSignedDataReflect)
func (x SignedDataHash) VDLWrite(enc vdl.Encoder) error
SignedDataSignature represents field Signature of the SignedData union type.
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
func (x SignedHeader) VDLIsZero() bool
func (x *SignedHeader) VDLRead(dec vdl.Decoder) error
func (SignedHeader) VDLReflect(struct { Name string `vdl:"v.io/x/ref/lib/security/serialization.SignedHeader"` })
func (x SignedHeader) VDLWrite(enc vdl.Encoder) error
type Signer interface { Sign(message []byte) (security.Signature, error) PublicKey() security.PublicKey }
Signer is the interface for digital signature operations used by NewSigningWriteCloser.
Package serialization imports 9 packages (graph) and is imported by 4 packages. Updated 2020-10-24. Refresh now. Tools for package owners.