v.io: v.io/x/ref/lib/security/serialization Index | Files

package serialization

import "v.io/x/ref/lib/security/serialization"

Package serialization implements utilities for reading and writing data with signature-based integrity checking.

nolint:golint

Index

Package Files

serialization.go serialization.vdl.go signing_writer.go verifying_reader.go

func NewSigningWriteCloser Uses

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 Uses

func NewVerifyingReader(data, signature io.Reader, key security.PublicKey) (io.Reader, error)

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 Uses

func VDLReadSignedData(dec vdl.Decoder, x *SignedData) error

type HashCode Uses

type HashCode [32]byte

func (HashCode) VDLIsZero Uses

func (x HashCode) VDLIsZero() bool

func (*HashCode) VDLRead Uses

func (x *HashCode) VDLRead(dec vdl.Decoder) error

func (HashCode) VDLReflect Uses

func (HashCode) VDLReflect(struct {
    Name string `vdl:"v.io/x/ref/lib/security/serialization.HashCode"`
})

func (HashCode) VDLWrite Uses

func (x HashCode) VDLWrite(enc vdl.Encoder) error

type Options Uses

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 Uses

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 Uses

type SignedDataHash struct{ Value HashCode }

SignedDataHash represents field Hash of the SignedData union type.

func (SignedDataHash) Index Uses

func (x SignedDataHash) Index() int

func (SignedDataHash) Interface Uses

func (x SignedDataHash) Interface() interface{}

func (SignedDataHash) Name Uses

func (x SignedDataHash) Name() string

func (SignedDataHash) VDLIsZero Uses

func (x SignedDataHash) VDLIsZero() bool

func (SignedDataHash) VDLReflect Uses

func (x SignedDataHash) VDLReflect(vdlSignedDataReflect)

func (SignedDataHash) VDLWrite Uses

func (x SignedDataHash) VDLWrite(enc vdl.Encoder) error

type SignedDataSignature Uses

type SignedDataSignature struct{ Value security.Signature }

SignedDataSignature represents field Signature of the SignedData union type.

func (SignedDataSignature) Index Uses

func (x SignedDataSignature) Index() int

func (SignedDataSignature) Interface Uses

func (x SignedDataSignature) Interface() interface{}

func (SignedDataSignature) Name Uses

func (x SignedDataSignature) Name() string

func (SignedDataSignature) VDLIsZero Uses

func (x SignedDataSignature) VDLIsZero() bool

func (SignedDataSignature) VDLReflect Uses

func (x SignedDataSignature) VDLReflect(vdlSignedDataReflect)

func (SignedDataSignature) VDLWrite Uses

func (x SignedDataSignature) VDLWrite(enc vdl.Encoder) error

type SignedHeader Uses

type SignedHeader struct {
    ChunkSizeBytes int64
}

func (SignedHeader) VDLIsZero Uses

func (x SignedHeader) VDLIsZero() bool

func (*SignedHeader) VDLRead Uses

func (x *SignedHeader) VDLRead(dec vdl.Decoder) error

func (SignedHeader) VDLReflect Uses

func (SignedHeader) VDLReflect(struct {
    Name string `vdl:"v.io/x/ref/lib/security/serialization.SignedHeader"`
})

func (SignedHeader) VDLWrite Uses

func (x SignedHeader) VDLWrite(enc vdl.Encoder) error

type Signer Uses

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.