xhmac

package
v0.0.0-...-ed9fe1d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package xhmac provides some ulitities for hmac

Index

Constants

This section is empty.

Variables

View Source
var ErrSignatureModified = fmt.Errorf("xhmac: signed value was modified")

ErrSignatureModified is an error object when the modified singed value is passed.

View Source
var ErrWrongSignatureFormat = fmt.Errorf("xhmac: wrong signature format")

ErrWrongSignatureFormat is an error object when receiving the wrong signature.

Functions

This section is empty.

Types

type Base64

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

Base64 is hmac utility to sign/unsign hmac with base64-encoding.

func NewBase64

func NewBase64(key []byte, h func() hash.Hash) *Base64

NewBase64 returns *Base64HMAC

func (*Base64) Sign

func (b *Base64) Sign(value []byte) []byte

Sign returns []byte where HMAC base64-encoded signature is appended.

func (*Base64) SignString

func (b *Base64) SignString(value string) string

SignString is a string version of Sign

func (*Base64) Unsign

func (b *Base64) Unsign(singedMessage []byte) ([]byte, error)

Unsign returns a value extracted from a signed message made by Sign.

func (*Base64) UnsignString

func (b *Base64) UnsignString(value string) (string, error)

UnsignString is a string version of Unsign

Jump to

Keyboard shortcuts

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