github.com/turingchain2020/turingchain@v1.1.21/system/crypto/none/none.go (about)

     1  // Copyright Turing Corp. 2018 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 none none driver
     6  package none
     7  
     8  import (
     9  	"github.com/turingchain2020/turingchain/common/crypto"
    10  )
    11  
    12  //const
    13  const (
    14  	Name = "none"
    15  	ID   = 10
    16  )
    17  
    18  func init() {
    19  	// 默认启用高度-1, 不开启
    20  	crypto.Register(Name, &Driver{}, crypto.WithOptionTypeID(ID), crypto.WithOptionDefaultDisable())
    21  }
    22  
    23  //Driver 驱动
    24  type Driver struct{}
    25  
    26  //GenKey 生成私钥
    27  func (d Driver) GenKey() (crypto.PrivKey, error) {
    28  	return nil, nil
    29  }
    30  
    31  //PrivKeyFromBytes 字节转为私钥
    32  func (d Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error) {
    33  	return nil, nil
    34  }
    35  
    36  //PubKeyFromBytes 字节转为公钥
    37  func (d Driver) PubKeyFromBytes(b []byte) (pubKey crypto.PubKey, err error) {
    38  	return nil, nil
    39  }
    40  
    41  //SignatureFromBytes 字节转为签名
    42  func (d Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error) {
    43  	return nil, nil
    44  }
    45  
    46  // Validate validate msg and signature
    47  func (d Driver) Validate(msg, pub, sig []byte) error {
    48  	return nil
    49  }