sigs

package module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: ISC Imports: 14 Imported by: 2

Documentation

Overview

sigs is a package that provides utilities implementing the http signature protocol: https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(msg string, signatureString string, publicKeyString string) error

Check validates the signature given a message and public key string

func Digest

func Digest(b []byte) (string, error)

Digest returns a string representing the base64 encoded hashSum of a byte array

func ParseRSAPrivateKey

func ParseRSAPrivateKey(rsaPrivateKeyLocation string) (*rsa.PrivateKey, error)

ParseRSAPrivateKey takes a file path and reads the private key

func ParseRSAPublicKey

func ParseRSAPublicKey(rsaPublicKeyLocation string) (*rsa.PublicKey, error)

ParseRSAPrivateKey takes a file path and reads the public key

func ReadPrivateKey

func ReadPrivateKey(b []byte) (*rsa.PrivateKey, error)

ReadPrivateKey reads a byte array and returns a pointer to a PrivateKey

func ReadPublicKey

func ReadPublicKey(b []byte) (*rsa.PublicKey, error)

ReadPublicKey reads a byte array and returns a pointer to a PublicKey

func SignRequest

func SignRequest(req *http.Request, data []byte, privateKey string, keyID string) error

Sign an http request given rsa `privateKey` string and public key `keyID` string with request body `data`

func SignString

func SignString(privateKey *rsa.PrivateKey, s string) (string, error)

Sign string returns the base64 encoded signature of a string signed by a PrivateKey

func VerifyRequest

func VerifyRequest(req *http.Request, content []byte, fetchPublicKeyString func(string) (string, error)) (string, error)

Verify the Signature header for a request is valid. The request body should be provided separately. The fetchPublicKeyString function takes a keyname and returns a public key. Returns keyname if known, and/or error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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