github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/crypto/internal/boring/ecdsa.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
     6  
     7  package boring
     8  
     9  import "C"
    10  
    11  type PrivateKeyECDSA struct {
    12  	key *C.GO_EC_KEY
    13  }
    14  
    15  type PublicKeyECDSA struct {
    16  	key *C.GO_EC_KEY
    17  }
    18  
    19  func NewPublicKeyECDSA(curve string, X, Y BigInt) (*PublicKeyECDSA, error)
    20  
    21  func NewPrivateKeyECDSA(curve string, X, Y BigInt, D BigInt) (*PrivateKeyECDSA, error)
    22  
    23  func SignMarshalECDSA(priv *PrivateKeyECDSA, hash []byte) ([]byte, error)
    24  
    25  func VerifyECDSA(pub *PublicKeyECDSA, hash []byte, sig []byte) bool
    26  
    27  func GenerateKeyECDSA(curve string) (X, Y, D BigInt, err error)