auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSA   = "RSA"
	ECDSA = "ECDSA"
)
View Source
const (
	PRIVATE_KEY keyType = "pri"
	PUBLIC_KEY  keyType = "pub"
)

Variables

View Source
var DefaultRSAOption = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: crypto.SHA256}

Functions

func DERToPrivateKey

func DERToPrivateKey(data []byte) (interface{}, error)

func DERToPublicKey

func DERToPublicKey(data []byte) (interface{}, error)

func PEMToPrivateKey

func PEMToPrivateKey(data []byte) (interface{}, error)

func PEMToPublicKey

func PEMToPublicKey(data []byte) (interface{}, error)

func PrivateKeyToPEM

func PrivateKeyToPEM(pri Key) ([]byte, error)

func PublicKeyToPEM

func PublicKeyToPEM(pub Key) ([]byte, error)

Types

type Crypto

type Crypto interface {
	Sign(data []byte, opts SignerOpts) ([]byte, error)

	Verify(key Key, signature, digest []byte, opts SignerOpts) (bool, error)

	GetKey() (pri, pub Key, err error)
}

func NewCryptoImpl

func NewCryptoImpl(path string, keyGenOpts KeyGenOpts) (Crypto, error)

type ECDSAKeyGenOpts

type ECDSAKeyGenOpts struct{}

func (*ECDSAKeyGenOpts) Algorithm

func (opts *ECDSAKeyGenOpts) Algorithm() string

type Key

type Key interface {
	SKI() (ski []byte)

	Algorithm() string
}

type KeyGenOpts

type KeyGenOpts interface {
	Algorithm() string
}

type RSAKeyGenOpts

type RSAKeyGenOpts struct{}

func (*RSAKeyGenOpts) Algorithm

func (opts *RSAKeyGenOpts) Algorithm() string

type SignerOpts

type SignerOpts interface {
	crypto.SignerOpts
}

Jump to

Keyboard shortcuts

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