func SolvePuzzleECIES(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error) {
	if puzzle == nil {
		err = fmt.Errorf("Puzzle cannot be nil, what are you solving")
		return
	}

	var key []byte
	if key, err = puzzle.Solve(); err != nil {
		err = fmt.Errorf("Error solving ecies puzzle: %s", err)
		return
	}

	var ecdsaPrivKey *ecdsa.PrivateKey
	if ecdsaPrivKey, err = ethcrypto.ToECDSA(key); err != nil {
		err = fmt.Errorf("Could not get ecdsa privkey from bytes for ecies puzzle: %s", err)
		return
	}

	var eciesPrivKey *ecies.PrivateKey
	eciesPrivKey = ecies.ImportECDSA(ecdsaPrivKey)

	// sharedInfo1 and sharedInfo2 (s1, s2) are not going to be needed (they are nil) because we assume no shared data
	// between the solver and creator of the puzzle.
	if message, err = eciesPrivKey.Decrypt(ciphertext, nil, nil); err != nil {
		err = fmt.Errorf("Error when decrypting puzzle message: %s", err)
		return
	}

	return
}
// SolvePuzzleECIES solves the timelock puzzle and decrypts the ciphertext using ECIES. We assume the key is an ASN.1 ECPKS
SolvePuzzleECIES solves the timelock puzzle and decrypts the ciphertext using ECIES. We assume the key is an ASN.1 ECPKS
// SolvePuzzleECIES solves the timelock puzzle and decrypts the ciphertext using ECIES . We assume the key is an ASN . 1 ECPKS
func SolvePuzzleECIES(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error) {
	if puzzle == nil {
		err = fmt.Errorf("Puzzle cannot be nil, what are you solving")
		return
	}
	var key []byte
	if key, err = puzzle.Solve(); err != nil {
		err = fmt.Errorf("Error solving ecies puzzle: %s", err)
		return
	}
	var ecdsaPrivKey *ecdsa.PrivateKey
	if ecdsaPrivKey, err = ethcrypto.ToECDSA(key); err != nil {
		err = fmt.Errorf("Could not get ecdsa privkey from bytes for ecies puzzle: %s", err)
		return
	}
	var eciesPrivKey *ecies.PrivateKey
	eciesPrivKey = ecies.ImportECDSA(ecdsaPrivKey)
	if message, err = eciesPrivKey.Decrypt(ciphertext, nil, nil); err != nil {
		err = fmt.Errorf("Error when decrypting puzzle message: %s", err)
		return
	}
	return
}
func SolvePuzzleECIES ( ciphertext [ ] byte , puzzle crypto . Puzzle ) ( message [ ] byte , err error ) { if puzzle == nil { err = fmt . Errorf ( " " ) return } var key [ ] byte if key , err = puzzle . Solve ( ) ; err != nil { err = fmt . Errorf ( " " , err ) return } var ecdsaPrivKey * ecdsa . PrivateKey if ecdsaPrivKey , err = ethcrypto . ToECDSA ( key ) ; err != nil { err = fmt . Errorf ( " " , err ) return } var eciesPrivKey * ecies . PrivateKey eciesPrivKey = ecies . ImportECDSA ( ecdsaPrivKey ) if message , err = eciesPrivKey . Decrypt ( ciphertext , nil , nil ) ; err != nil { err = fmt . Errorf ( " " , err ) return } return }
SolvePuzzleECIES solves the timelock puzzle and decrypts the ciphertext using ECIES.
SolvePuzzleECIES solves the timelock puzzle and decrypts the ciphertext using ECIES .
// sharedInfo1 and sharedInfo2 (s1, s2) are not going to be needed (they are nil) because we assume no shared data // between the solver and creator of the puzzle.