Documentation ¶
Overview ¶
Package subtle provides subtle implementations of the digital signature primitive.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertCurveName ¶
ConvertCurveName converts different forms of a curve name to the name that tink recognizes.
func GetCurve ¶
GetCurve returns the curve object that corresponds to the given curve type. It returns null if the curve type is not supported.
func ValidateSecp256K1Params ¶
ValidateSecp256K1Params validates secp256k1 parameters. The hash's strength must not be weaker than the curve's strength. DER and IEEE_P1363 encodings are supported.
Types ¶
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 NewSecp256K1Verifier ¶
func NewSecp256K1Verifier(hashAlg, curve, encoding string, x, y []byte) (*ECDSAVerifier, error)
NewSecp256K1Verifier creates a new instance of Secp256K1Verifier.
func NewSecp256K1VerifierFromPublicKey ¶
func NewSecp256K1VerifierFromPublicKey(hashAlg, encoding string, publicKey *ecdsa.PublicKey) (*ECDSAVerifier, error)
NewSecp256K1VerifierFromPublicKey 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 Secp256K1Signer ¶
type Secp256K1Signer struct {
// contains filtered or unexported fields
}
Secp256K1Signer is an implementation of Signer for secp256k1 Secp256k2 (Koblitz curve). At the moment, the implementation only accepts DER encoding.
func NewSecp256K1Signer ¶
func NewSecp256K1Signer(hashAlg string, curve string, encoding string, keyValue []byte) (*Secp256K1Signer, error)
NewSecp256K1Signer creates a new instance of Secp256K1Signer.
func NewSecp256K1SignerFromPrivateKey ¶
func NewSecp256K1SignerFromPrivateKey(hashAlg string, encoding string, privateKey *ecdsa.PrivateKey) (*Secp256K1Signer, error)
NewSecp256K1SignerFromPrivateKey creates a new instance of Secp256K1Signer.
type Secp256k1Signature ¶
Secp256k1Signature is a struct holding the r and s values of an secp256k1 signature.
func DecodeSecp256K1Signature ¶
func DecodeSecp256K1Signature(encodedBytes []byte, encoding string) (*Secp256k1Signature, error)
DecodeSecp256K1Signature creates a new secp256k1 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 NewSecp256K1Signature ¶
func NewSecp256K1Signature(r, s *big.Int) *Secp256k1Signature
NewSecp256K1Signature creates a new Secp256k1Signature instance.
func (*Secp256k1Signature) EncodeSecp256K1Signature ¶
func (sig *Secp256k1Signature) EncodeSecp256K1Signature(encoding, curveName string) ([]byte, error)
EncodeSecp256K1Signature converts the signature to the given encoding format.