Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterEncryptor ¶
func RegisterEncryptor(encryptor Encryptor)
RegisterEncryptor registers an encryptor. It panics when the encryptor is nil or has an empty name, and overwrites the encryptor registered under the same name.
func RegisterSigner ¶
func RegisterSigner(signer Signer)
RegisterSigner registers a signer. It panics when the signer is nil or has an empty name, and overwrites the signer registered under the same name.
Types ¶
type Encryptor ¶
type Encryptor interface {
// Name returns the name of the encryptor.
Name() string
// Encrypt encrypts data.
Encrypt(data []byte) ([]byte, error)
// Decrypt decrypts data.
Decrypt(data []byte) ([]byte, error)
}
func InvokeEncryptor ¶
InvokeEncryptor returns the encryptor registered under name. It panics when no encryptor is registered under that name.
type Signer ¶
type Signer interface {
// Name returns the name of the signer.
Name() string
// Sign signs data.
Sign(data []byte) ([]byte, error)
// Verify verifies the signature of data.
Verify(data []byte, signature []byte) (bool, error)
}
func InvokeSigner ¶
InvokeSigner returns the signer registered under name. It panics when no signer is registered under that name.
Click to show internal directories.
Click to hide internal directories.