autograph: go.mozilla.org/autograph/signer/mar Index | Files

package mar

import "go.mozilla.org/autograph/signer/mar"

Index

Package Files

mar.go

Constants

const (
    // Type of this signer is "mar"
    Type = "mar"
)

type MARSigner Uses

type MARSigner struct {
    signer.Configuration
    // contains filtered or unexported fields
}

MARSigner holds the configuration of the signer

func New Uses

func New(conf signer.Configuration) (s *MARSigner, err error)

New initializes a mar signer using a configuration

func (*MARSigner) Config Uses

func (s *MARSigner) Config() signer.Configuration

Config returns the configuration of the current signer

func (*MARSigner) GetDefaultOptions Uses

func (s *MARSigner) GetDefaultOptions() interface{}

GetDefaultOptions returns default options of the signer

func (*MARSigner) SignData Uses

func (s *MARSigner) SignData(data []byte, options interface{}) (signer.Signature, error)

SignData takes a MAR file already marshalled for signature and returns a base64 encoded signature.

This function expects the caller to handle parsing of the MAR file, which can be really tricky because the signature headers need to be placed in the file prior to marshalling it for signature. You should consider calling the SignFile interface instead, which will handle all that magic for you.

func (*MARSigner) SignFile Uses

func (s *MARSigner) SignFile(input []byte, options interface{}) (signer.SignedFile, error)

SignFile takes a MAR file and returns a signed MAR file

func (*MARSigner) SignHash Uses

func (s *MARSigner) SignHash(hashed []byte, options interface{}) (signer.Signature, error)

SignHash takes the hash of the signable data of a MAR file, signs it and returns a base64 encoded signature

type Options Uses

type Options struct {
    // SigAlg is an integer that represents the type of signature requested.
    // It must map the SigAlg constants from the MAR package
    SigAlg uint32 `json:"sigalg"`
}

Options accepts the name of the signature algorithm used by the SignData interface to decide which algorithm to sign the data with

func GetOptions Uses

func GetOptions(input interface{}) (options Options, err error)

GetOptions takes a input interface and reflects it into a struct of options

type Signature Uses

type Signature struct {
    Data []byte
}

Signature is a MAR signature

func (*Signature) Marshal Uses

func (sig *Signature) Marshal() (string, error)

Marshal returns the base64 representation of a signature

Package mar imports 11 packages (graph) and is imported by 2 packages. Updated 2019-11-20. Refresh now. Tools for package owners.