gojwk

package module
v0.0.0-...-4d5ec6e Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2014 License: BSD-2-Clause Imports: 11 Imported by: 33

README

gojwk

Golang implementation of JWK validation

Contact

@_boblan_
https://github.com/mendsley/gojws

License

Copyright 2014 Matthew Endsley

This project is governed by the BSD 2-clause license. For details see the file titled LICENSE in the project root folder.

Using

Simply add the following import import "github.com/mendsley/gojwk"

Documentation

See http://godoc.org/github.com/mendsley/gojwk

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(key *Key) ([]byte, error)

Wrapper to marshal a JSON octet stream from a structured JWK

Types

type Key

type Key struct {
	Keys []*Key `json:"keys,omitempty"`

	Kty string `json:"kty"`
	Use string `json:"use,omitempty"`
	Kid string `json:"kid,omitempty"`
	Alg string `json:"alg,omitempty"`

	Crv string `json:"crv,omitempty"`
	X   string `json:"x,omitempty"`
	Y   string `json:"y,omitempty"`
	D   string `json:"d,omitempty"`
	N   string `json:"n,omitempty"`
	E   string `json:"e,omitempty"`
	K   string `json:"k,omitempty"`
}

func PrivateKey

func PrivateKey(key crypto.PrivateKey) (*Key, error)

Create a JWK from a private key

func PublicKey

func PublicKey(key crypto.PublicKey) (*Key, error)

Create a JWK from a public key

func Unmarshal

func Unmarshal(jwt []byte) (*Key, error)

Wrapper to unmarshal a JSON octet stream to a structured JWK

func (*Key) DecodePrivateKey

func (key *Key) DecodePrivateKey() (crypto.PrivateKey, error)

Decodes as a private key

func (*Key) DecodePublicKey

func (key *Key) DecodePublicKey() (crypto.PublicKey, error)

Decode as a public key

Jump to

Keyboard shortcuts

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