crypto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_RSA   = "rsa"
	TYPE_ECDSA = "ecdsa"
)

Variables

View Source
var (
	UnkownKeyTypeError = errors.New("UnkownKeyType").Msg("cannot create key of type %s")
	GenerateKeyError   = errors.New("GenerateKeyError").Msg("failed to generate %s key: %s")
	WriteKeyError      = errors.New("WriteKeyError").Msg("failed to write key to file: %s")
	MarshallKeyError   = errors.New("MarshallKeyError").Msg("failed to marshall key to json").Make()
)

Functions

func CreateJwk

func CreateJwk(keytype string) (*jose.JSONWebKey, error)

CreateJwk creates a new JWK of type keytype and stores it to filename keytype can be "rsa" or "ecdsa"

func ReadKeyFromFile

func ReadKeyFromFile(filename string) (*jose.JSONWebKey, error)

func ReadKeyFromJson

func ReadKeyFromJson(jsonbytes []byte) (*jose.JSONWebKey, error)

func WriteKeyToFile

func WriteKeyToFile(key *jose.JSONWebKey, filename string) error

Types

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

func NewSigner

func NewSigner(key *jose.JSONWebKey) (*Signer, error)

func (*Signer) DetachPayload

func (s *Signer) DetachPayload(jws *jose.JSONWebSignature) (string, string, error)

func (*Signer) EmbedKey

func (s *Signer) EmbedKey(mode bool)

func (*Signer) SetOption

func (s *Signer) SetOption(key jose.HeaderKey, data interface{})

func (*Signer) SetOptions

func (s *Signer) SetOptions(options *jose.SignerOptions)

func (*Signer) SignPayload

func (s *Signer) SignPayload(payload string) (*jose.JSONWebSignature, error)

Jump to

Keyboard shortcuts

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