Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateMultiSignSignature(s []byte, r []byte) ([]byte, error)
- func GetRUsingAllRi(key *ecdsa.PublicKey, arrayOfRi [][]byte) []byte
- func GetRandom32Bytes() ([]byte, error)
- func GetRiUsingRandomBytes(key *ecdsa.PublicKey, k []byte) []byte
- func GetSUsingAllSi(arrayOfSi [][]byte) []byte
- func GetSharedPublicKeyForPublicKeys(keys []*ecdsa.PublicKey) ([]byte, error)
- func GetSiUsingKCRM(key *ecdsa.PrivateKey, k []byte, c []byte, r []byte, message []byte) []byte
- func MultiSign(keys []*ecdsa.PrivateKey, message []byte) ([]byte, error)
- func VerifyMultiSig(keys []*ecdsa.PublicKey, signature []byte, message []byte) (bool, error)
Constants ¶
const (
MinimumParticipant = 2
)
Variables ¶
var ( InvalidInputParamsError = errors.New("Invalid input params") NotExactTheSameCurveInputError = errors.New("The private keys of all the keys are not using the the same curve") TooSmallNumOfkeysError = errors.New("The total num of keys should be greater than one") EmptyMessageError = errors.New("Message to be sign should not be nil") NotValidSignatureError = errors.New("Signature is invalid") )
Functions ¶
func GenerateMultiSignSignature ¶
生成多重签名的流程如下: 1. 各方分别生成自己的随机数Ki(K1, K2, ..., Kn) --- func getRandomBytes() ([]byte, error) TODO: Compute k = H(m || x)
This makes k unpredictable for anyone who do not know x, therefor it's impossible for the attacker to retrive x by breaking the random number generator of the system, which has happend in the Sony PlayStation 3 firmware attack. 不再使用临时随机数,而改用H(m || x)来计算k
2. 各方计算自己的 Ri = Ki*G,G代表基点 --- func getRiUsingRandomBytes(key *ecdsa.PublicKey, k []byte) []byte 3. 发起者收集Ri,计算:R = sum(Ri) --- func getRUsingAllRi(key *ecdsa.PublicKey, arrayOfRi [][]byte) []byte 4. 发起者收集公钥Pi,计算公共公钥:C = P1 + P2 + ... + Pn --- func getSharedPublicKeyForPrivateKeys(keys []*ecdsa.PrivateKey) ([]byte, error) 5. 各方计算自己的Si:si = Ki + HASH(C,R,m) * xi,x代表私钥中的参数大数D --- func getSiUsingKCRM(key *ecdsa.PrivateKey, k []byte, c []byte, r []byte, message []byte) []byte 6. 发起者收集Si,生成多重签名:(s1 + s2 + ... + sn, R) --- func getSUsingAllSi(arrayOfSi [][]byte) []byte --- func GenerateMultiSignSignature(s []byte, r []byte) (*MultiSignature, error) GenerateMultiSignSignature生成对特定消息的多重签名,所有参与签名的私钥必须使用同一条椭圆曲线 func GenerateMultiSignSignature(s []byte, r []byte) (*MultiSignature, error) {
func GetRUsingAllRi ¶
计算:R = k1*G + k2*G + ... + kn*G
func GetRiUsingRandomBytes ¶
计算:Ri = Ki*G
func GetSharedPublicKeyForPublicKeys ¶
计算公共公钥:C = P1 + P2 + ... + Pn
func GetSiUsingKCRM ¶
计算 si = ki + HASH(C,R,m) * xi x代表大数D,也就是私钥的关键参数
func MultiSign ¶
func MultiSign(keys []*ecdsa.PrivateKey, message []byte) ([]byte, error)
生成多重签名的算法如下: 1. 生成公私钥对(x1, P1), (x2, P2), ..., (xn, Pn), x代表私钥中的参数大数D,P代表公钥 2. 生成临时随机数(k1, k2, ..., kn) TODO: Compute k = H(m || x)
This makes k unpredictable for anyone who do not know x, therefor it's impossible for the attacker to retrive x by breaking the random number generator of the system, which has happend in the Sony PlayStation 3 firmware attack. 不再使用临时随机数,而改用H(m || x)来计算k
3. 计算:R = k1*G + k2*G + ... + kn*G,G代表基点 4. 计算公共公钥:C = P1 + P2 + ... + Pn 5. 各方计算:si = ki + HASH(C,R,m) * xi 6. 生成多重签名:(s1 + s2 + ... + sn, R) MultiSign生成对特定消息的多重签名,所有参与签名的私钥必须使用同一条椭圆曲线 func MultiSign(keys []*ecdsa.PrivateKey, message []byte) (*MultiSignature, error) {
Types ¶
This section is empty.