sign

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package sign provides wrappers to compute a signature of data written to an io.Writer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {

	// Performs the signing, and provides implementations for Write and
	// WriteString.
	*Writer
	// contains filtered or unexported fields
}

File is a writable file that will compute it's signature while it is written to. When closed, it will write the signature to the provided io.Writer.

func NewFile

func NewFile(ctx context.Context, f writerFile, w io.Writer, keys *kms.Keys) (*File, error)

NewFile wraps the provided writerFile in a signed File. When the file is closed, its signature is written to w.

func (*File) Close

func (f *File) Close() error

Close closes the wrapped writer and writes the SigInfo to f.signatureWriter.

func (*File) Read

func (f *File) Read(b []byte) (int, error)

Read reads from the underlying fs.File.

func (*File) Stat

func (f *File) Stat() (fs.FileInfo, error)

Stat returns the fs.FileInfo for the underlying fs.File.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is a wrapper that will compute a signature of all the data written to its writer.

func NewWriter

func NewWriter(_ context.Context, w io.Writer, keys *kms.Keys) (*Writer, error)

NewWriter returns a Writer that wraps an io.Writer.

func (*Writer) Close

func (w *Writer) Close() error

Close implements the io.Closer method.

func (*Writer) Sign

func (w *Writer) Sign(ctx context.Context) (*wrapping.SigInfo, error)

Sign returns the signature of the data written to the writer.

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

func (*Writer) WriteString

func (w *Writer) WriteString(s string) (int, error)

WriteString implements the io.StringWriter WriteString method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL