signer

package
v0.0.0-...-0fc6d53 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright © 2018 Zhao Ming <mint.zhao.chiu@gmail.com>.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2018 Zhao Ming <mint.zhao.chiu@gmail.com>.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2018 Zhao Ming <mint.zhao.chiu@gmail.com>.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2018 Zhao Ming <mint.zhao.chiu@gmail.com>.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSignerAlreadyRegistered indicated a signer already registered in to signers
	ErrSignerAlreadyRegistered = errors.New("signer already registered")

	// ErrSignerNotFound indicated a signer can not found in signers
	ErrSignerNotFound = errors.New("signer not found")

	// ErrNilSignerOptions indicated a nil signer options
	ErrNilSignerOptions = errors.New("invalid options, it must not be nil")

	// ErrInvalidSignerOptions indicated invalid signer options
	ErrInvalidSignerOptions = errors.New("invalid options")
)

Functions

func DeRegisterSigner

func DeRegisterSigner(signerName string)

DeRegisterSigner delete signer from signers, SHOULD ONLY USED IN TEST

func RegisterSigner

func RegisterSigner(signerName string, s Signer) error

RegisterSigner stores signer into signers, if signerName is already registered, return error

Types

type Signer

type Signer interface {

	// Sign signs msg using PrivateKey k.
	Sign(k crypto.PrivateKey, msg []byte, opts crypto.SignerOpts) ([]byte, error)

	// Verify verifies signature against key k and digest
	Verify(k crypto.PublicKey, signature, msg []byte, opts crypto.SignerOpts) (bool, error)
}

Signer contains signing functions

func GetSigner

func GetSigner(signerName string) (Signer, error)

GetHash return a hash function that already registered in hashes, if not return error

Jump to

Keyboard shortcuts

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