signature

package
v1.3.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 17 Imported by: 30

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

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 NewSigner added in v1.3.0

func NewSigner(h *keyset.Handle) (tink.Signer, error)

NewSigner returns a Signer primitive from the given keyset handle.

func NewSignerWithKeyManager added in v1.3.0

func NewSignerWithKeyManager(h *keyset.Handle, km registry.KeyManager) (tink.Signer, error)

NewSignerWithKeyManager returns a Signer primitive from the given keyset handle and custom key manager.

func NewVerifier added in v1.3.0

func NewVerifier(h *keyset.Handle) (tink.Verifier, error)

NewVerifier returns a Verifier primitive from the given keyset handle.

func NewVerifierWithKeyManager added in v1.3.0

func NewVerifierWithKeyManager(h *keyset.Handle, km registry.KeyManager) (tink.Verifier, error)

NewVerifierWithKeyManager returns a Verifier primitive from the given keyset handle and custom key manager.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL