Documentation
¶
Overview ¶
Package crypto implements verification interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrEmptyPrivateKey = errors.New("trying to sign without private key")
)
Functions ¶
This section is empty.
Types ¶
type RSAPSS ¶
type RSAPSS struct {
// contains filtered or unexported fields
}
RSAPSS represents RSA PSS algo for signing/verification (with SHA256 as digest calculation function).
type Signer ¶
type Signer interface {
// Name returns name of the crypto algorithm, used by signer.
Name() string
// Sign returns signature for passed data.
Sign(data []byte) ([]byte, error)
}
Signer implements high-level API for package signing.
type SignerVerifier ¶
SignerVerifier common interface.
func NewHexRSAPSSSignerVerifier ¶ added in v1.6.1
func NewHexRSAPSSSignerVerifier(privKey rsa.PrivateKey) SignerVerifier
NewHexRSAPSSSignerVerifier creates an RSA-PSS signer/verifier whose signatures are hex-encoded.
func NewHexSignerVerifier ¶ added in v1.6.1
func NewHexSignerVerifier(sv SignerVerifier) SignerVerifier
NewHexSignerVerifier wraps sv so that Sign emits a hex-encoded signature and Verify accepts a hex-encoded one.
func NewRSAPSSSignerVerifier ¶
func NewRSAPSSSignerVerifier(privKey rsa.PrivateKey) SignerVerifier
NewRSAPSSSignerVerifier creates new RSAPSS object that can both sign and verify. The public key is derived from the private key.
type Verifier ¶
type Verifier interface {
// Name returns name of the crypto algorithm, used by verifier.
Name() string
// Verify checks data and signature mapping.
Verify(data []byte, signature []byte) error
}
Verifier is an interface implementing a generic signature verification algorithm.
func NewHexRSAPSSVerifier ¶ added in v1.6.1
NewHexRSAPSSVerifier creates an RSA-PSS verifier that accepts hex-encoded signatures.
func NewHexVerifier ¶ added in v1.6.1
NewHexVerifier wraps v so that Verify accepts a hex-encoded signature.
func NewRSAPSSVerifier ¶
NewRSAPSSVerifier creates new RSAPSS object that can only verify signatures.