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 ¶
- func Check(msg string, signatureString string, publicKeyString string) error
- func Digest(b []byte) (string, error)
- func ParseRSAPrivateKey(rsaPrivateKeyLocation string) (*rsa.PrivateKey, error)
- func ParseRSAPublicKey(rsaPublicKeyLocation string) (*rsa.PublicKey, error)
- func ReadPrivateKey(b []byte) (*rsa.PrivateKey, error)
- func ReadPublicKey(b []byte) (*rsa.PublicKey, error)
- func SignRequest(req *http.Request, data []byte, privateKey string, keyID string) error
- func SignString(privateKey *rsa.PrivateKey, s string) (string, error)
- func VerifyRequest(req *http.Request, content []byte, ...) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseRSAPrivateKey ¶
func ParseRSAPrivateKey(rsaPrivateKeyLocation string) (*rsa.PrivateKey, error)
ParseRSAPrivateKey takes a file path and reads the private key
func ParseRSAPublicKey ¶
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 ¶
ReadPublicKey reads a byte array and returns a pointer to a PublicKey
func SignRequest ¶
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.