verify

package
v0.0.0-...-2fc75eb Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const COMMON_ERROR = "COMMON_ERROR"

Variables

This section is empty.

Functions

func Input

func Input(certificatePath string, signature string, input []byte) (bool, error)

Input takes given publicKeyPath, input byte array, and signature string. This function returns true iff the signature of the input can be verified by the public key.

func InputVerifiedByAnyKey

func InputVerifiedByAnyKey(certOrKeyFiles []string, signature string, input []byte) (bool, string, map[string]error)

Verify the input with given signature and a list of either certificates containing public keys or public keys themselves. It returns true if any of the key verifies successfuly. The file name of the successful key is returned. (true, fn, nil). It returns false if all keys failed. The errors are returned as a map keyed by the key file name. The common errors are keyed by COMMON_ERROR. (false, "", map).

func ValidKeyOrCert

func ValidKeyOrCert(keyOrCert []byte) (*rsa.PublicKey, error)

ValidKeyOrCert succeeds if given data is a valid PEM-encoded x509 cert containing an RSAPSS public key or a PEM-encoded raw RSAPSS public key, either of which are valid. If the given data does not validate a KeyError is returned. If no error occurs a reference to the public key is returned.

Types

type KeyError

type KeyError struct {
	Msg           string
	InternalError error
}

Error found while checking the public key

func (KeyError) Error

func (e KeyError) Error() string

Error provides a loggable error message including the message of an internal error (one enclosed in this error).

type KeyMapping

type KeyMapping struct {
	CertificatePath string
	Signature       string
}

KeyMapping is a simple container for (key, signature) pairs

func InputVerifiedByAll

func InputVerifiedByAll(keyMappings []*KeyMapping, input []byte) (bool, []*KeyMapping, error)

InputVerifiedByAll returns true iff the signature of the input is verified by all of the specified keyfiles. In case of errors processing keyfiles, an error will be returned. In case of verification failure, all failed KeyMappings will be returned.

func (*KeyMapping) String

func (m *KeyMapping) String() string

type VerificationError

type VerificationError struct {
	Msg           string
	InternalError error
}

Verification error

func (VerificationError) Error

func (e VerificationError) Error() string

Error provides a loggable error message including the message of an internal error (one enclosed in this error).

Jump to

Keyboard shortcuts

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