signedplugin

package module
v0.0.0-...-1068861 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: MIT Imports: 8 Imported by: 0

README

SignedPlugins

Disclaimer

This is a toy implementation of code signed plugins in Go. It is still under development and is not meant to be used in production Go code until it has been vetted by a real cryptographer.

Overview

import "github.com/joncooperworks/signedplugin"

This package allows users of Go's plugin system to increase their security by allowing plugin authors to sign plugins with ECDSA signed SHA256 hashes.

See the example/ directory for a usage example.

Further documentation can be found at https://godoc.org/github.com/joncooperworks/signedplugin

Documentation

Overview

Package signedplugin makes it easier to use code signing certificates (RSA) to sign plugins. It uses file locking to prevent TOCTOU vulnerabilities between the time of verifying the file signature and loading the plugin from disk. It allows plugin authors to create ECDSA signed SHA3-256 hashes of plugins.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLockFailed is returned when locking a plugin fails.
	ErrLockFailed = errors.New("failed to acquire lock on plugin")

	//ErrSignatureValidationFailed is returned when a plugin does not match its expected signature.
	ErrSignatureValidationFailed = errors.New("plugin and signature do not match")
)

Functions

func Open

func Open(publicKey *ecdsa.PublicKey, signature []byte, pluginPath string) (*plugin.Plugin, error)

Open loads a plugin from disk and verifies that its SHA3-256 hash was signed by the expected public key. This implementation does not care where the public key or signature come from, allowing callers to load them from disk, a database or a website. It is vital that public keys and signatures are loaded securely, otherwise an attacker will be able to circumvent the entire scheme.

func Sign

func Sign(privateKey *ecdsa.PrivateKey, data []byte) ([]byte, error)

Sign signs a byte slice by taking its SHA3-256 hash and signing it with an ECDSA private key passed to it.

func Verify

func Verify(publicKey *ecdsa.PublicKey, signature, data []byte) (bool, error)

Verify verifies that a byte slice was signed by a given public key.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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