crypto

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

README

Crypto Helpers

For encryption and signing and validating http requests.

Inspired by and even even using some of

License

All is released under the Apache License 2.0.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonize

func Canonize(req *http.Request, body io.Reader) ([]byte, error)

Canonize ...

func Decode

func Decode(s string) ([]byte, error)

Decode ...

func Decrypt

func Decrypt(ciphertext []byte, key *EncryptionKey) ([]byte, error)

Decrypt ...

func Encode

func Encode(b []byte) string

Encode ...

func Encrypt

func Encrypt(plaintext []byte, key *EncryptionKey) ([]byte, error)

Encrypt ...

func EncryptionKeyEncode

func EncryptionKeyEncode(key *EncryptionKey) string

EncryptionKeyEncode ...

func Sign

func Sign(req *http.Request, body []byte, privKey *SigningKeyPrivate) error

Sign ...

func SigningKeyPrivateEncode

func SigningKeyPrivateEncode(key *SigningKeyPrivate) (string, error)

SigningKeyPrivateEncode ...

func SigningKeyPublicEncode

func SigningKeyPublicEncode(key *SigningKeyPublic) (string, error)

SigningKeyPublicEncode ...

func Verify

func Verify(req *http.Request, body []byte, pubKey *SigningKeyPublic) error

Verify ...

Types

type EncryptionKey

type EncryptionKey = [32]byte

EncryptionKey ...

func CombineKeys

func CombineKeys(hkey *EncryptionKey, keys ...*EncryptionKey) (*EncryptionKey, error)

CombineKeys ...

func EncryptionKeyDecode

func EncryptionKeyDecode(key string) (*EncryptionKey, error)

EncryptionKeyDecode ...

func NewEncryptionKey

func NewEncryptionKey() *EncryptionKey

NewEncryptionKey ...

type SigningKeyPrivate

type SigningKeyPrivate = ecdsa.PrivateKey

func NewSigningKeyPrivate

func NewSigningKeyPrivate() (*SigningKeyPrivate, error)

NewSigningKeyPrivate ...

func SigningKeyPrivateDecode

func SigningKeyPrivateDecode(key string) (*SigningKeyPrivate, error)

SigningKeyPrivateDecode ...

type SigningKeyPublic

type SigningKeyPublic = ecdsa.PublicKey

func SigningKeyPublicDecode

func SigningKeyPublicDecode(key string) (*SigningKeyPublic, error)

SigningKeyPublicDecode ...

Jump to

Keyboard shortcuts

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