github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/crypto/ecdsa/ecdsa_legacy.go (about) 1 // Copyright 2022 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 package ecdsa 6 7 import ( 8 "github.com/shogo82148/std/io" 9 "github.com/shogo82148/std/math/big" 10 ) 11 12 // Sign は、ハッシュ(大きなメッセージのハッシュの結果である必要があります)をプライベートキー priv を使用して署名します。 13 // もしハッシュがプライベートキーの曲線順序のビット長よりも長い場合、ハッシュはその長さに切り詰められます。 14 // 結果の署名は、2つの整数のペアとして返されます。ほとんどのアプリケーションでは、r, s と直接扱う代わりに [SignASN1] を使用するべきです。 15 func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) 16 17 // Verifyは、公開鍵pubを使用してハッシュのr、sの署名を検証します。 18 // 戻り値は署名の有効性を記録します。ほとんどのアプリケーションでは、r、sと直接取り扱う代わりに、VerifyASN1を使用する必要があります。 19 func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool