Documentation ¶
Overview ¶
Package signature provides subtle implementations of the Signer and Verifier primitives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ECDSASignature ¶ added in v1.3.0
ECDSASignature is a struct holding r and s values of an ECDSA signature.
func DecodeECDSASignature ¶ added in v1.3.0
func DecodeECDSASignature(encodedBytes []byte, encoding string) (*ECDSASignature, error)
DecodeECDSASignature creates a new ECDSA signature using the given byte slice. The function assumes that the byte slice is the concatenation of the BigEndian representation of two big integer r and s.
func NewECDSASignature ¶ added in v1.3.0
func NewECDSASignature(r, s *big.Int) *ECDSASignature
NewECDSASignature creates a new ecdsaSignature object.
func (*ECDSASignature) EncodeECDSASignature ¶ added in v1.3.0
func (sig *ECDSASignature) EncodeECDSASignature(encoding, curveName string) ([]byte, error)
EncodeECDSASignature converts the signature to the given encoding format.
type ECDSASigner ¶ added in v1.3.0
type ECDSASigner struct {
// contains filtered or unexported fields
}
ECDSASigner is an implementation of Signer for ECDSA. At the moment, the implementation only accepts DER encoding.
func NewECDSASigner ¶ added in v1.3.0
func NewECDSASigner(hashAlg string, curve string, encoding string, keyValue []byte) (*ECDSASigner, error)
NewECDSASigner creates a new instance of ECDSASigner.
func NewECDSASignerFromPrivateKey ¶ added in v1.3.0
func NewECDSASignerFromPrivateKey(hashAlg string, encoding string, privateKey *ecdsa.PrivateKey) (*ECDSASigner, error)
NewECDSASignerFromPrivateKey creates a new instance of ECDSASigner
type ECDSAVerifier ¶ added in v1.3.0
type ECDSAVerifier struct {
// contains filtered or unexported fields
}
ECDSAVerifier is an implementation of Verifier for ECDSA. At the moment, the implementation only accepts signatures with strict DER encoding.
func NewECDSAVerifier ¶ added in v1.3.0
func NewECDSAVerifier(hashAlg string, curve string, encoding string, x []byte, y []byte) (*ECDSAVerifier, error)
NewECDSAVerifier creates a new instance of ECDSAVerifier.
func NewECDSAVerifierFromPublicKey ¶ added in v1.3.0
func NewECDSAVerifierFromPublicKey(hashAlg string, encoding string, publicKey *ecdsa.PublicKey) (*ECDSAVerifier, error)
NewECDSAVerifierFromPublicKey creates a new instance of ECDSAVerifier.
func (*ECDSAVerifier) Verify ¶ added in v1.3.0
func (e *ECDSAVerifier) Verify(signatureBytes, data []byte) error
Verify verifies whether the given signature is valid for the given data. It returns an error if the signature is not valid; nil otherwise.
type ED25519Signer ¶ added in v1.3.0
type ED25519Signer struct {
// contains filtered or unexported fields
}
ED25519Signer is an implementation of Signer for ED25519.
func NewED25519Signer ¶ added in v1.3.0
func NewED25519Signer(keyValue []byte) (*ED25519Signer, error)
NewED25519Signer creates a new instance of ED25519Signer.
func NewED25519SignerFromPrivateKey ¶ added in v1.3.0
func NewED25519SignerFromPrivateKey(privateKey *ed25519.PrivateKey) (*ED25519Signer, error)
NewED25519SignerFromPrivateKey creates a new instance of ED25519Signer
type ED25519Verifier ¶ added in v1.3.0
type ED25519Verifier struct {
// contains filtered or unexported fields
}
ED25519Verifier is an implementation of Verifier for ED25519. At the moment, the implementation only accepts signatures with strict DER encoding.
func NewED25519Verifier ¶ added in v1.3.0
func NewED25519Verifier(pub []byte) (*ED25519Verifier, error)
NewED25519Verifier creates a new instance of ED25519Verifier.
func NewED25519VerifierFromPublicKey ¶ added in v1.3.0
func NewED25519VerifierFromPublicKey(publicKey *ed25519.PublicKey) (*ED25519Verifier, error)
NewED25519VerifierFromPublicKey creates a new instance of ED25519Verifier.
func (*ED25519Verifier) Verify ¶ added in v1.3.0
func (e *ED25519Verifier) Verify(signature, data []byte) error
Verify verifies whether the given signature is valid for the given data. It returns an error if the signature is not valid; nil otherwise.