package subtle
import "github.com/google/tink/go/signature/subtle"
Package subtle provides subtle implementations of the digital signature primitive.
Index ¶
- func ValidateECDSAParams(hashAlg string, curve string, encoding string) error
- type ECDSASignature
- func DecodeECDSASignature(encodedBytes []byte, encoding string) (*ECDSASignature, error)
- func NewECDSASignature(r, s *big.Int) *ECDSASignature
- func (sig *ECDSASignature) EncodeECDSASignature(encoding, curveName string) ([]byte, error)
- type ECDSASigner
- func NewECDSASigner(hashAlg string, curve string, encoding string, keyValue []byte) (*ECDSASigner, error)
- func NewECDSASignerFromPrivateKey(hashAlg string, encoding string, privateKey *ecdsa.PrivateKey) (*ECDSASigner, error)
- func (e *ECDSASigner) Sign(data []byte) ([]byte, error)
- type ECDSAVerifier
- func NewECDSAVerifier(hashAlg string, curve string, encoding string, x []byte, y []byte) (*ECDSAVerifier, error)
- func NewECDSAVerifierFromPublicKey(hashAlg string, encoding string, publicKey *ecdsa.PublicKey) (*ECDSAVerifier, error)
- func (e *ECDSAVerifier) Verify(signatureBytes, data []byte) error
- type ED25519Signer
- func NewED25519Signer(keyValue []byte) (*ED25519Signer, error)
- func NewED25519SignerFromPrivateKey(privateKey *ed25519.PrivateKey) (*ED25519Signer, error)
- func (e *ED25519Signer) Sign(data []byte) ([]byte, error)
- type ED25519Verifier
Functions ¶
func ValidateECDSAParams ¶
ValidateECDSAParams validates ECDSA parameters. The hash's strength must not be weaker than the curve's strength. DER and IEEE_P1363 encodings are supported.
Types ¶
type ECDSASignature ¶
ECDSASignature is a struct holding the r and s values of an ECDSA signature.
func DecodeECDSASignature ¶
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 ¶
func NewECDSASignature(r, s *big.Int) *ECDSASignature
NewECDSASignature creates a new ECDSASignature instance.
func (*ECDSASignature) EncodeECDSASignature ¶
func (sig *ECDSASignature) EncodeECDSASignature(encoding, curveName string) ([]byte, error)
EncodeECDSASignature converts the signature to the given encoding format.
type ECDSASigner ¶
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 ¶
func NewECDSASigner(hashAlg string, curve string, encoding string, keyValue []byte) (*ECDSASigner, error)
NewECDSASigner creates a new instance of ECDSASigner.
func NewECDSASignerFromPrivateKey ¶
func NewECDSASignerFromPrivateKey(hashAlg string, encoding string, privateKey *ecdsa.PrivateKey) (*ECDSASigner, error)
NewECDSASignerFromPrivateKey creates a new instance of ECDSASigner
func (*ECDSASigner) Sign ¶
func (e *ECDSASigner) Sign(data []byte) ([]byte, error)
Sign computes a signature for the given data.
type ECDSAVerifier ¶
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 ¶
func NewECDSAVerifier(hashAlg string, curve string, encoding string, x []byte, y []byte) (*ECDSAVerifier, error)
NewECDSAVerifier creates a new instance of ECDSAVerifier.
func NewECDSAVerifierFromPublicKey ¶
func NewECDSAVerifierFromPublicKey(hashAlg string, encoding string, publicKey *ecdsa.PublicKey) (*ECDSAVerifier, error)
NewECDSAVerifierFromPublicKey creates a new instance of ECDSAVerifier.
func (*ECDSAVerifier) Verify ¶
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 ¶
type ED25519Signer struct {
// contains filtered or unexported fields
}
ED25519Signer is an implementation of Signer for ED25519.
func NewED25519Signer ¶
func NewED25519Signer(keyValue []byte) (*ED25519Signer, error)
NewED25519Signer creates a new instance of ED25519Signer.
func NewED25519SignerFromPrivateKey ¶
func NewED25519SignerFromPrivateKey(privateKey *ed25519.PrivateKey) (*ED25519Signer, error)
NewED25519SignerFromPrivateKey creates a new instance of ED25519Signer
func (*ED25519Signer) Sign ¶
func (e *ED25519Signer) Sign(data []byte) ([]byte, error)
Sign computes a signature for the given data.
type ED25519Verifier ¶
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 ¶
func NewED25519Verifier(pub []byte) (*ED25519Verifier, error)
NewED25519Verifier creates a new instance of ED25519Verifier.
func NewED25519VerifierFromPublicKey ¶
func NewED25519VerifierFromPublicKey(publicKey *ed25519.PublicKey) (*ED25519Verifier, error)
NewED25519VerifierFromPublicKey creates a new instance of ED25519Verifier.
func (*ED25519Verifier) Verify ¶
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.
Source Files ¶
ecdsa.go ecdsa_signer.go ecdsa_verifier.go ed25519_signer.go ed25519_verifier.go encoding.go subtle.go
- Version
- v1.7.0 (latest)
- Published
- Aug 10, 2022
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 3 months ago –
Tools for package owners.