示例#1
0
文件: fuzz.go 项目: qbit/client
func Fuzz(data []byte) int {
	skey, _, err := saltpack.Verify(data, keyring{key})
	if err != nil {
		// errors are ok
		return 0
	}
	// if no error, check that the returned key matches
	if !saltpack.KIDEqual(key, skey) {
		panic("verifier key doesn't match signer key")
	}

	return 1
}
示例#2
0
文件: fuzz.go 项目: qbit/client
func Fuzz(data []byte) int {
	smsg, err := saltpack.Sign(data, &key)
	if err != nil {
		panic(err)
	}
	skey, vmsg, err := saltpack.Verify(smsg, keyring{&key})
	if err != nil {
		panic(err)
	}
	if !bytes.Equal(vmsg, data) {
		panic("message mismatch")
	}
	if !saltpack.KIDEqual(key.PublicKey(), skey) {
		panic("verifier key doesn't match signer key")
	}

	return 0
}