Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DigestHashMD5 = &DigestHash{"MD5", crypto.MD5} DigestHashSha1 = &DigestHash{"SHA1", crypto.SHA1} DigestHashSha256 = &DigestHash{"SHA256", crypto.SHA256} DigestHashSha384 = &DigestHash{"SHA384", crypto.SHA384} DigestHashSha512 = &DigestHash{"SHA512", crypto.SHA512} )
ErrHashUnavailable the requested hash function is unavailable
View Source
var ErrSignature = errors.New("the signature verify failure.")
ErrSignature the signature verify failure.
Functions ¶
This section is empty.
Types ¶
type Digest ¶
type Digest interface { // returns the alg identifier for this digest. Alg() string // Returns nil if sign is valid, // value format always `algorithm=<encoded digest output with base64>` Sign(p []byte) (string, error) // same as Sign SignReader(r io.Reader) (string, error) // Returns nil if signature is valid Verify(p []byte, sig string) error // same as Verify VerifyReader(r io.Reader, sig string) error }
Digest can be used sign an input. The sign is then usually base64 encoded.
type DigestHash ¶
func (*DigestHash) Alg ¶
func (m *DigestHash) Alg() string
func (*DigestHash) SignReader ¶
func (m *DigestHash) SignReader(r io.Reader) (string, error)
func (*DigestHash) VerifyReader ¶
func (m *DigestHash) VerifyReader(r io.Reader, sig string) error
Click to show internal directories.
Click to hide internal directories.