github.com/hyperledger/aries-framework-go@v0.3.2/pkg/crypto/tinkcrypto/primitive/secp256k1/secp256k1.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package secp256k1
     8  
     9  import (
    10  	"github.com/google/tink/go/core/registry"
    11  	"github.com/google/tink/go/keyset"
    12  	tinkpb "github.com/google/tink/go/proto/tink_go_proto"
    13  	"github.com/google/tink/go/tink"
    14  
    15  	"github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/tinkcrypto/primitive/secp256k1"
    16  )
    17  
    18  // This file contains pre-generated KeyTemplates for Signer and Verifier.
    19  // One can use these templates to generate new Keysets.
    20  
    21  // DERKeyTemplate is a KeyTemplate that generates a new ECDSA secp256k1 private key with the following parameters:
    22  //   - Hash function: SHA256
    23  //   - Curve: secp256k1
    24  //   - Signature encoding: DER
    25  //   - Output prefix type: TINK
    26  func DERKeyTemplate() (*tinkpb.KeyTemplate, error) {
    27  	return secp256k1.DERKeyTemplate()
    28  }
    29  
    30  // IEEEP1363KeyTemplate is a KeyTemplate that generates a new ECDSA secp256k1 private key with the following parameters:
    31  //   - Hash function: SHA256
    32  //   - Curve: secp256k1
    33  //   - Signature encoding: IEEE-P1363
    34  //   - Output prefix type: TINK
    35  func IEEEP1363KeyTemplate() (*tinkpb.KeyTemplate, error) {
    36  	return secp256k1.IEEEP1363KeyTemplate()
    37  }
    38  
    39  // NewSigner returns a Signer primitive from the given keyset handle.
    40  func NewSigner(h *keyset.Handle) (tink.Signer, error) {
    41  	return secp256k1.NewSigner(h)
    42  }
    43  
    44  // NewSignerWithKeyManager returns a Signer primitive from the given keyset handle and custom key manager.
    45  // Deprecated: register the KeyManager and use New above.
    46  func NewSignerWithKeyManager(h *keyset.Handle, km registry.KeyManager) (tink.Signer, error) {
    47  	return secp256k1.NewSignerWithKeyManager(h, km)
    48  }
    49  
    50  // NewVerifier returns a Verifier primitive from the given keyset handle.
    51  func NewVerifier(h *keyset.Handle) (tink.Verifier, error) {
    52  	return secp256k1.NewVerifier(h)
    53  }
    54  
    55  // NewVerifierWithKeyManager returns a Verifier primitive from the given keyset handle and custom key manager.
    56  // Deprecated: register the KeyManager and use New above.
    57  func NewVerifierWithKeyManager(h *keyset.Handle, km registry.KeyManager) (tink.Verifier, error) {
    58  	return secp256k1.NewVerifierWithKeyManager(h, km)
    59  }