Documentation ¶
Overview ¶
Package signature provides implementations of the Signer and Verifier primitives.
To sign data using Tink you can use ECDSA or ED25519 key templates.
Example:
package main import ( "fmt" "github.com/google/tink/go/signature" "github.com/google/tink/go/keyset" ) func main() { kh, err := keyset.NewHandle(signature.ECDSAP256KeyTemplate()) // other key templates can also be used if err != nil { // handle the error } s := signature.NewSigner(kh) a , err := s.Sign([]byte("this data needs to be signed")) if err != nil { // handle error } v := signature.NewVerifier(kh) if err := v.Verify(a, []byte("this data needs to be signed")); err != nil { // handle error } }
Index ¶
- func ECDSAP256KeyTemplate() *tinkpb.KeyTemplate
- func ECDSAP384KeyTemplate() *tinkpb.KeyTemplate
- func ECDSAP521KeyTemplate() *tinkpb.KeyTemplate
- func ED25519KeyTemplate() *tinkpb.KeyTemplate
- func NewSigner(h *keyset.Handle) (tink.Signer, error)
- func NewSignerWithKeyManager(h *keyset.Handle, km registry.KeyManager) (tink.Signer, error)
- func NewVerifier(h *keyset.Handle) (tink.Verifier, error)
- func NewVerifierWithKeyManager(h *keyset.Handle, km registry.KeyManager) (tink.Verifier, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ECDSAP256KeyTemplate ¶ added in v1.3.0
func ECDSAP256KeyTemplate() *tinkpb.KeyTemplate
ECDSAP256KeyTemplate is a KeyTemplate that generates a new ECDSA private key with the following parameters:
- Hash function: SHA256
- Curve: NIST P-256
- Signature encoding: DER
func ECDSAP384KeyTemplate ¶ added in v1.3.0
func ECDSAP384KeyTemplate() *tinkpb.KeyTemplate
ECDSAP384KeyTemplate is a KeyTemplate that generates a new ECDSA private key with the following parameters:
- Hash function: SHA512
- Curve: NIST P-384
- Signature encoding: DER
func ECDSAP521KeyTemplate ¶ added in v1.3.0
func ECDSAP521KeyTemplate() *tinkpb.KeyTemplate
ECDSAP521KeyTemplate is a KeyTemplate that generates a new ECDSA private key with the following parameters:
- Hash function: SHA512
- Curve: NIST P-521
- Signature encoding: DER
func ED25519KeyTemplate ¶ added in v1.3.0
func ED25519KeyTemplate() *tinkpb.KeyTemplate
ED25519KeyTemplate is a KeyTemplate that generates a new ED25519 private key.
func NewSignerWithKeyManager ¶ added in v1.3.0
NewSignerWithKeyManager returns a Signer primitive from the given keyset handle and custom key manager.
func NewVerifier ¶ added in v1.3.0
NewVerifier returns a Verifier primitive from the given keyset handle.
func NewVerifierWithKeyManager ¶ added in v1.3.0
NewVerifierWithKeyManager returns a Verifier primitive from the given keyset handle and custom key manager.
Types ¶
This section is empty.