func SolvePuzzleRSA(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 auction puzzle: %s", err)
		return
	}

	var privkey *rsa.PrivateKey
	if privkey, err = x509.ParsePKCS1PrivateKey(key); err != nil {
		err = fmt.Errorf("Error when parsing private key with pkcs#1 encoding: %s", err)
		return
	}

	if message, err = privkey.Decrypt(rand.Reader, ciphertext, nil); err != nil {
		err = fmt.Errorf("Error when decrypting puzzle message: %s", err)
		return
	}

	return
}
// SolvePuzzleRSA solves the timelock puzzle and decrypts the ciphertext using RSA. We assume the key is in PKCS1 format
SolvePuzzleRSA solves the timelock puzzle and decrypts the ciphertext using RSA. We assume the key is in PKCS1 format
// SolvePuzzleRSA solves the timelock puzzle and decrypts the ciphertext using RSA . We assume the key is in PKCS1 format
func SolvePuzzleRSA(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 auction puzzle: %s", err)
		return
	}
	var privkey *rsa.PrivateKey
	if privkey, err = x509.ParsePKCS1PrivateKey(key); err != nil {
		err = fmt.Errorf("Error when parsing private key with pkcs#1 encoding: %s", err)
		return
	}
	if message, err = privkey.Decrypt(rand.Reader, ciphertext, nil); err != nil {
		err = fmt.Errorf("Error when decrypting puzzle message: %s", err)
		return
	}
	return
}
func SolvePuzzleRSA ( 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 privkey * rsa . PrivateKey if privkey , err = x509 . ParsePKCS1PrivateKey ( key ) ; err != nil { err = fmt . Errorf ( " " , err ) return } if message , err = privkey . Decrypt ( rand . Reader , ciphertext , nil ) ; err != nil { err = fmt . Errorf ( " " , err ) return } return }
SolvePuzzleRSA solves the timelock puzzle and decrypts the ciphertext using RSA.
SolvePuzzleRSA solves the timelock puzzle and decrypts the ciphertext using RSA .