I’m trying to generate private key using the Extract() in the Master interface of the ibe package, here’s the link of the package,“ibe package - v.io/x/lib/ibe - Go Packages”. In the package, the input of Extract is id, and consist of {0,1}*, so I convert Mac id to binary string first, and then use the binary string to generate correspond private key. My code is like this.
package main`
import (
"fmt"
"v.io/x/lib/ibe"
)
var Macid = "00055DNEFF"
var id string
type Params struct {
params ibe.Params
}
type Privatekey struct {
params Params
keys ibe.PrivateKey
}
type Root struct {
master ibe.Master
}
func stringToBin(Macid string) (id string) {
for _, c := range Macid {
id = fmt.Sprintf("%s%b", id, c)
}
return id
}
func (r *Root) ExtractPK(id string) ibeKey {
ibeKey, err := r.master.Extract(id)
return ibeKey
}
func main() {
fmt.Println("MacID is " + Macid + ", public key is" + stringToBin(Macid) + ", private key is" + ExtractPK(stringToBin(Macid)))
}
But I always got errors.
xuJennys-MacBook-Pro:pkg ChunjieXu$ go build pkg.go
command-line-arguments
./pkg.go:29: undefined: ibeKey
./pkg.go:36: undefined: ExtractPK
I’m all new to go, and I have read the tour of go, but I couldn’t get it. Can anyone help me with this? Thank you so much.