Documentation ¶
Index ¶
- Constants
- func Input(certificatePath string, signature string, input []byte) (bool, error)
- func InputVerifiedByAnyKey(certOrKeyFiles []string, signature string, input []byte) (bool, string, map[string]error)
- func ValidKeyOrCert(keyOrCert []byte) (*rsa.PublicKey, error)
- type KeyError
- type KeyMapping
- type VerificationError
Constants ¶
const COMMON_ERROR = "COMMON_ERROR"
Variables ¶
This section is empty.
Functions ¶
func Input ¶
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 ¶
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 KeyMapping ¶
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 ¶
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).