MAGIC - remove useless code

This commit is contained in:
Emman 2021-06-08 12:58:01 +08:00
parent 6ef7234916
commit 39492b01bf
2 changed files with 2 additions and 6 deletions

View File

@ -44,10 +44,6 @@ type PrivateKey struct {
ecdsa.PrivateKey ecdsa.PrivateKey
} }
type ecdsaSignature struct {
R, S *big.Int
}
type pointMarshalMode byte type pointMarshalMode byte
const ( const (

View File

@ -99,11 +99,11 @@ func Test_signVerify(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
hash := sm3.Sum([]byte(tt.plainText)) hash := sm3.Sum([]byte(tt.plainText))
r, s, err := Sign(rand.Reader, &priv.PrivateKey, hash[:]) signature, err := priv.Sign(rand.Reader, hash[:], nil)
if err != nil { if err != nil {
t.Fatalf("sign failed %v", err) t.Fatalf("sign failed %v", err)
} }
result := Verify(&priv.PublicKey, hash[:], r, s) result := VerifyASN1(&priv.PublicKey, hash[:], signature)
if !result { if !result {
t.Fatal("verify failed") t.Fatal("verify failed")
} }